Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How can I use a loop to subtract a pixel's gray level to it´s neighbor pixel's gray level?

Asked by Teemu on 13 Feb 2013

How can I use a loop to subtract a pixel's gray level to it´s neighbor pixel's gray level?

0 Comments

Teemu

1 Answer

Answer by Thorsten on 13 Feb 2013
Edited by Thorsten on 13 Feb 2013
Accepted answer
 I = im2double(imread('cameraman.tif'));
 Ix = diff(I')';
 Iy = diff(I);

5 Comments

Teemu on 13 Feb 2013

That is a good function. thank you, that helps me a lot.

Teemu on 13 Feb 2013

Can I do diff function to one file to both x- and y-direction? Or can I make one file from Ix and Iy? I mean that I do diff function and get one file.

Teemu on 14 Feb 2013

Can I use diff function to subtract pixel from 2-pixel away from it? So it not neigbour pixel anymore.

Thorsten

Contact us