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???
![](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!