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 件のコメント
Guillaume
Guillaume 2018 年 7 月 18 日
I have absolutely no idea what you are asking now. There's only one direction between two given pixels.
Mohammad Bhat
Mohammad Bhat 2018 年 7 月 18 日
horizontal, vertical and diagonal wise.....

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by