Create the generated curve differently (function "bwboundaries")
Show older comments
Hi. I would like to be able to improve the following code so that:
1) the background always remains white and the curves always black (such as the .png figure);
2) the red curve that creates the code I would like it to become red but inside the black curve (see image obtained from the code)
3) I want to save all the coordinates ("boundary") that the code creates.

Below is the code:
baseFileName = 'image.png';
fullFileName = fullfile(pwd, baseFileName);
imag = imread(fullFileName);
figure();
imshow(imag);
%
imag_int8 = int8(imag);
BW = imbinarize(imag_int8);
%
[B,L] = bwboundaries(BW,'noholes');
figure
imshow(label2rgb(L, @jet, [0 0 0]))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 5)
end
Accepted Answer
More Answers (0)
Categories
Find more on Object Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

