clc;
clear
close all;
load('cropped.mat');
cropped = cortada;
figure, imshow(cropped);
gray = rgb2gray(cropped);
figure, imshow(gray);
thresh = im2bw(gray, 0.7);
figure, imshow(thresh);
remove = bwareaopen(thresh,13200);
figure, imshow(remove);
se = strel('line',400,0);
closingOperation = imclose(remove,se);
figure, imshow(closingOperation);
OriginalLine = closingOperation(1 , :);
OriginalLine2 = closingOperation(end , :);
closingOperation(1, :) = true;
closingOperation(end, :) = true;
filtered = imfill(closingOperation, 'holes');
closingOperation(end,:) = false;
closingOperation(1,:) = false;
filtered(1, :) = OriginalLine;
filtered(end, :) = OriginalLine2;
figure, imshow(filtered);
4 Comments
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/616628-how-to-create-lines-and-calculate-their-lenghts#comment_1070303
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/616628-how-to-create-lines-and-calculate-their-lenghts#comment_1070303
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/616628-how-to-create-lines-and-calculate-their-lenghts#comment_1094128
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/616628-how-to-create-lines-and-calculate-their-lenghts#comment_1094128
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/616628-how-to-create-lines-and-calculate-their-lenghts#comment_1166098
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/616628-how-to-create-lines-and-calculate-their-lenghts#comment_1166098
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/616628-how-to-create-lines-and-calculate-their-lenghts#comment_1171198
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/616628-how-to-create-lines-and-calculate-their-lenghts#comment_1171198
Sign in to comment.