Convert binary image to a line plot

조회 수: 4 (최근 30일)
Bruno Neto
Bruno Neto 2022년 6월 6일
댓글: Bruno Neto 2022년 6월 7일
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일
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
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)

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

카테고리

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