How to find the difference of adjacent pixels in an image? Thanks

9 views (last 30 days)
How to find the difference of adjacent pixels in an image? Thanks

Accepted Answer

Image Analyst
Image Analyst on 4 Aug 2016
In which direction? Assuming left and right, you can use conv2() or imfilter():
img = imread('moon.tif');
diffImage = imfilter(img, [1, -1]);
imshow(diffImage, [])
  8 Comments
Image Analyst
Image Analyst on 27 Mar 2017
That would have been helpful to know in advance. I have no time to program this up for you but it's very similar to my local binary pattern demo where I get the values in a circle around the pixel like that. You just have to add or subtract them rather than take them as a binary number. See attached demo.

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!