Convert binary image to a line plot
10 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!