0
$\begingroup$

enter image description here

Im not sure how to solve this, if someone can please help me a bit id appreciate it. I have to solve this by hand. (I know how to solve using matlab).

$\endgroup$

closed as unclear what you're asking by Marcus Müller, A_A, Peter K. Apr 28 '17 at 19:27

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

0
$\begingroup$

The size of the kernel determines the block of pixels to be used. Here, you have a filter kernel

$$\begin{bmatrix}0 & -1 & 0\\ 0 & 0 & 0\\ 0 & 1 & 0\end{bmatrix}$$ and for each $3\times 3$ block of pixels: $$\begin{bmatrix}a & b & c\\ d & e & f\\ g & h & i\end{bmatrix}$$

The recipe is: flip one (only) of them left-right and up-down:

$$\begin{bmatrix}i & h & g\\ f & e & d\\ c & b & a\end{bmatrix}$$

multiply term-wise:

$$\begin{bmatrix}0.i & -1.h & 0.g\\ 0.f & 0.e & 0.d\\ 0.c & 1.b & 0.a\end{bmatrix}$$

and sum, put that value at the place of $e$ in the output image:

$$ e' = b-h$$.

Repeat. Verify to got the same result if you had flipped the kernel instead of the pixel block. This second option might be simpler in your case.

$\endgroup$
  • $\begingroup$ so do i have to do it for every 3x3 matrix in the input image? $\endgroup$ – Master Mhd Apr 20 '17 at 22:31
  • $\begingroup$ Indeed. You may assume 0 values outside $\endgroup$ – Laurent Duval Apr 20 '17 at 23:06
0
$\begingroup$

Read about convolution here. The link has a web tool to understand convolution better. That will help you. Here is a quick primer on how to go about solving your problem.

enter image description here

You have to choose a pixel, place kernel such that centre of kernel is on the pixel you want to compute. Multiply the overlapping pixels and dive by number of non-zero pixels as shown above. For the boundary pixels you have to take a call as to what you will do. There are many options like use zeros as boundary etc. For derivatives it is better to keep the boundaries as zero. Hope this helped you :)

$\endgroup$
  • $\begingroup$ Can You please do the first 2 rows so i can understand it better? $\endgroup$ – Master Mhd Apr 20 '17 at 17:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.