join close lines in one thicker
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have this image
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169823/image.jpeg)
How could I close the borders with just one continuous line? To something like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169825/image.jpeg)
Thank you
0 Kommentare
Antworten (2)
Image Analyst
am 19 Nov. 2017
Take the coordinates of the green lines and burn them into a binary image. See attached demo and adapt it.
Then use imclose() to enlarge and blend them into a bigger connected mass.
binaryImage = imclose(binaryImage, ones(9));
Then use bwareafilt() to extract out the largest blob:
binaryImage = bwareafilt(binaryImage, 1);
Then blacken the image where the white pixels are
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
maskedRgbImage = bsxfun(@times, rgbImage, cast(~binaryImage, 'like', rgbImage));
2 Kommentare
Image Analyst
am 19 Nov. 2017
Maybe try calling plot() onto the image, then use getframe() to get the frame (though it might not be the same size anymore) and find the pure green pixels, then use imclose(). Might be a lot faster.
prasanth s
am 3 Dez. 2018
why matlab did not have functions to draw and burn basic shapes (line, triange,..) in image.i did not find any file exchange also.
2 Kommentare
Image Analyst
am 3 Dez. 2018
It does. See attached demos.
If you have the Computer Vision System Toolbox, you can also use insertShape().
Siehe auch
Kategorien
Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!