Convert binary image to a line plot

I have a image with the contours of an object I'm analyzing, this image is a binary image where it shows the contours of the object as white and the rest as black. And I have the object mesh.
What I'm trying to do is overlay the contour image, as a line plot, on the mesh plot so i can see where are the limits of the mesh and remove the excess mesh.

답변 (1개)

Image Analyst
Image Analyst 2022년 6월 6일

0 개 추천

Your mesh doesn't have the same x and y limits/ranges as the binary image so you might have to scale it, but it's basically like this
[y, x] = find(binaryImage); % Note: it's [y, x], NOT [x, y], because it's really [row, column].
hold on
plot(x, y, 'k.', 'MarkerSize', 20) % Adjust markersize to what you want.

댓글 수: 5

Bruno Neto
Bruno Neto 2022년 6월 7일
It worked but now both images don't match. My binary image is way bigger than the mesh, besides, I have some negatives coordinates on the mesh and none on the binary image. I'm still not able to match them.
My mesh image is apparently inside the red box i draw
Bruno Neto
Bruno Neto 2022년 6월 7일
I finally could match the contours with the mesh but i still have the contours as points at not as a line. Is there anyway to connect the point to convert it to a line? So i can create a region inside the contours
Bruno Neto
Bruno Neto 2022년 6월 7일
Image Analyst
Image Analyst 2022년 6월 7일
Why do you want a mesh anyway?
How did you get your binary image? Why is it not one pixel wide? Did you not use bwperim or bwboundaries?
I don't know what this means: "but i still have the contours as points at not as a line"? I think of contours like isolevels, like curves at a particular elevation/altitude for a topographic map, or iso-gray level lines on a gray scale image. That is your definition of contour, and why do you expect it to be a line? If you want the list of (x,y) coordinates for the perimeter of the binary image to be in an oder where all the points are adjacent, then use bwboundaries.
Bruno Neto
Bruno Neto 2022년 6월 7일
I got my binary image using Edge command. And I need those as a line so I can remove the excess mesh (red in image)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2022년 6월 6일

댓글:

2022년 6월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by