# Given a Vertical Derivative Kernel, Find the output image after K is applied to the above input image [closed]

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).

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.

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

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 :)

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