Save object's boundary as coordinate arrays.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have traced an image boundary and I need to save it as coordinate arrays. Actually I'm working on thermal image where I first extracted only the red component of the RGB image and then to black and white image then I have done morphological closing on it and obtained object's boundary.Actually I'm confused abt how to get boundary then I found it here and I have to save it in coordinate arrays.Thanks for your help in advance. My code looks like this
a = imread('D:\New folder (5)\New folder (5)\VID-20170522-WA0021 (5-23-2017 3-45-10 PM)\yash.jpg');
a_red=a;
a_green=a;
a_blue=a;
a_red(:,:,2)=0;
a_red(:,:,3)=0;
BW = im2bw(a_red, 0.2);
se=strel('disk',10);
closeBW=imclose(BW,se);
[B,L] = bwboundaries(closeBW,'noholes');
c=label2rgb(L, @jet, [.5 .5 .5]);
imshow(c);
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2)
end
3 comentarios
Respuestas (1)
MathReallyWorks
el 26 de Mayo de 2017
Hello yaswanth,
As you have not shared how you have traced object boundary, it is a bit difficult to answer you question efficiently.
Anyways, I can tell you a simple approach to do this task.
Convert your image to grayscale and pass it to a high pass filter. This will remove all points except the boundary of object.
Then use
C=corner(I); %I is modified image
It will store all the corner points in an array C.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!