Create the generated curve differently (function "bwboundaries")
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Object Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


