Convert binary image to a line plot

12 visualizaciones (últimos 30 días)
Bruno Neto
Bruno Neto el 6 de Jun. de 2022
Comentada: Bruno Neto el 7 de Jun. de 2022
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.

Respuestas (1)

Image Analyst
Image Analyst el 6 de Jun. de 2022
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 comentarios
Image Analyst
Image Analyst el 7 de Jun. de 2022
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 el 7 de Jun. de 2022
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)

Iniciar sesión para comentar.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by