How to store the difference between adjacent pixel values of image
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a black and white image and I need to store the value of the differences between each adjacent pixel so that i may plot the values in a histogram.
3 Kommentare
Antworten (2)
Benjamin Thompson
am 11 Apr. 2022
Bearbeitet: Benjamin Thompson
am 11 Apr. 2022
Use imfilter with a 1D filter argument. If your h is vertical then the difference operation is in the vertical direction. If the filter coefficients h are horizontal then the difference operation is horizontal.
>> imshow(phantom)
>> imshow(imfilter(phantom, [-1 1]))
>> imshow(imfilter(phantom, [-1 1]'))
0 Kommentare
DGM
am 11 Apr. 2022
If all you want is the difference in one direction, then just use diff().
A = randi([0 255],10);
dAdx = diff(A,1,2);
histogram(dAdx(:))
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Filtering and Enhancement finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
