How can I compute the gradient of a noiseless image?

30 Views Asked by At

I need to generate an image with 11x11 pixels having in the center of the image a square of 5x5 pixels, with the gray level of the background 0 and the gray level of the square is 50. I need to compute the gradient of the image given by the compass operator, taking into account that the image is not noisy(simple derivation). I don't know how to compute this, I don't know what it's my image function, I only have some formulas that are ,, useful", but very hard to apply. I've tried to apply the Sobel operator and I got 0, I think the result it's wrong, but since the image, it's noiseless the computation will be simplified if I'm using this formula, but I don't know where to start from...

enter image description here

enter image description here