How to do operation on an image after making boundary?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I attached the input image before making boundary and output image after making boundary with matlab code. Now how to perform next operation on image with boundary?
if true
% code
% Display the binary image.
subplot(2, 2, 3);
imshow(handImage1);
title('Binary Image', 'FontSize', fontSize, 'Interpreter', 'None');
subplot(2,2,4);
imshow(handImage1);
title('binary image with border');
boundaries=bwboundaries(handImage1);
x = boundaries{1}(:, 2);
y = boundaries{1}(:, 1);
hold on;
plot(x, y, 'black', 'LineWidth', 2);
newImage = bwlabel(handImage1);
measurements = regionprops(newImage, 'Centroid', 'BoundingBox');
xCentroid = measurements.Centroid(1);
yCentroid = measurements.Centroid(2);
figure;
imshow(newImage);
title('Binary Image with Centroid Marked');
hold on;
plot(xCentroid, yCentroid, 'r*', 'MarkerSize', 10, 'LineWidth', 2);
end
In this the problem that I am facing is that when I try to label the image for finding centroid after forming a boundary, then it performs the operation on binary image without boundary. So, the binary image with boundary is stored in which variable here?
0 comentarios
Respuestas (1)
Image Analyst
el 8 de Sept. de 2017
"when I try to label the image for finding centroid after forming a boundary, then it performs the operation on binary image without boundary." bwlabel() is operating on handImage1 so handImage1 better be a logical image, not a uint8 or color image. Also, handImage1 is the full image. I don't know what you want. What is the binary image with boundary that you would rather have it work on? Do you want to mask it? Why? Is it just to get rid of the smaller blobs, which you can do more directly with bwareafilt(), the function meant for that?
"So, the binary image with boundary is stored in which variable here?" Well, you're saying it's handImage1 because that's what you titled it when you showed it and that's what you passed in to bwboundaries().
1 comentario
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!