How to detect between any two pixels (preferably far) there exist an number of foreground pixels of an image (foreground=white and background=black)???
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have to count black pixels between two white pixels in any direction???
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192077/image.jpeg)
0 件のコメント
回答 (1 件)
Guillaume
2018 年 7 月 18 日
improfile (with the default 'nearest' interpolation) should give you all the pixels between your two points. It's then trivial to sum the pixels that are 0.
numblackpixels = sum(improfile(yourimage, locationofpixel1, locationofpixel2) == 0)
3 件のコメント
Guillaume
2018 年 7 月 18 日
I have absolutely no idea what you are asking now. There's only one direction between two given pixels.
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!