How to store the difference between adjacent pixel values of image
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Benjamin Thompson
2022 年 4 月 11 日
編集済み: Benjamin Thompson
2022 年 4 月 11 日
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 件のコメント
DGM
2022 年 4 月 11 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Filtering and Enhancement についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
