How do I extract outer and inner contour in an image? Is there a inbuilt function available or do I have to do it from scratch?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to extract inner contour of an Image. I tried to do this:
>> I3=imread('Image.jpg'); >> I2=bwboundaries(I3);
And I am getting error like this:
Error using bwboundaries Expected input number 1, BW, to be two-dimensional.
Error in bwboundaries>parseInputs (line 187) validateattributes(BW_in, {'numeric','logical'}, {'real','2d','nonsparse'}, ...
Error in bwboundaries (line 140) [BW, conn, findHoles] = parseInputs(args{:});
I tried to even convert the image to binary explicitly and then do it, but still I am getting a different error saying the image size is too large to perform the function.
I am trying to do this command window btw, I don't think that might be one of the problem anyway.
If I have to code it myself, can somebody explain how to do it?
Thanks in advance
0 Kommentare
Antworten (1)
Sayan Saha
am 7 Mai 2018
Here is an example of using "bwboundaries" to find the inner contours of an image based on the example in the documentation:
I = imread('coins.png');
imshow(I);
BW = imbinarize(I);
[B,L] = bwboundaries(BW,'noholes');
figure;
hold on;
for k=1:length(B)
boundary = B{k};
hold on;
plot(boundary(:,2), boundary(:,1));
end
Following MATLAB Answers post might also be relevant:
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Filtering and Enhancement finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!