How to connect each pair of pixels Image A taken from image B (Image A and Image B are given as under)
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I have extracted some pixels (based on some criteria ) from image A and got Image B
as shown below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191915/image.jpeg)
Now, I need to connect each pair pixel of Image B, if the corresponding points/pixels are connected in A?? How to do that.???
댓글 수: 0
답변 (1개)
Image Analyst
2018년 7월 14일
편집: Image Analyst
2018년 7월 14일
Very easy. Just call bwlabel on A
[labeledImage, numRegions] = bwlabel(A);
where A is a binary image.
Then use find() and pdist2() (stats toolbox) on B to get distances and select the smallest non-zero distance - trivial, but let me know if you can't do it.
Then, for your two pixels locations in B you want to check on, simply check if the labels are the same or different.
if labeledImage(row1, col1) == labeledImage(row2, col2)
% Those two locations in B are on the same curve in A
else
% Those two locations in B are on different curves in A
end
댓글 수: 3
Image Analyst
2018년 7월 14일
and then upload your original image A and image B. Also provide what you'd like your final image to look like - mock something up in Photoshop if you have to.
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!