How to detect between any two pixels (preferably far) there exist an number of foreground pixels of an image (foreground=white and background=black)???

1 次查看(过去 30 天)
Hi,
I have to count black pixels between two white pixels in any direction???

回答(1 个)

Guillaume
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 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by