MATLAB Answers

Save object's boundary as coordinate arrays.

3 views (last 30 days)
yaswanth pushpak
yaswanth pushpak on 26 May 2017
Commented: yaswanth pushpak on 28 May 2017
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 Comments

yaswanth pushpak
yaswanth pushpak on 28 May 2017
I've attached the thermal image and I need to detect the face.Thanks for ur help in advance.

Sign in to comment.

Answers (1)

MathReallyWorks
MathReallyWorks on 26 May 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.

  1 Comment

yaswanth pushpak
yaswanth pushpak on 26 May 2017
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

Sign in to comment.

Sign in to answer this question.