How to remove the footstalks (shown in fig.A) of the leaf?
2 views (last 30 days)
Show older comments
0 Comments
Answers (3)
Image Analyst
on 1 Jul 2018
If they're still in your segmentation, I'd sum the binary image horizontally and set any lines with a sum of less than 5 pixels or so equal to the background intensity. Let me know if you need code.
13 Comments
jonas
on 1 Jul 2018
Edited: jonas
on 1 Jul 2018
I'm a beginner, so I'm sure there is a better way. However, I managed to remove those lines in two simple steps using thresholding to convert to binary and bwconncomp to check for objects having low connectivity. This works only because threholding removes part of the stalks, with the remaining parts being isolated small objects.
clear all;close all
RGB=imread('foot.png');
GRAY = rgb2gray(RGB);
threshold = graythresh(GRAY);
BW = im2bw(GRAY, threshold);
CC = bwconncomp(~BW)
for i=1:CC.NumObjects
if length(CC.PixelIdxList{i})<20;
BW(CC.PixelIdxList{i})=255;
end
end
imshow(BW)
GRAY(BW==1)=255;
imshow(GRAY)
0 Comments
NASU NASU
on 22 Sep 2018
hello please let me know how can i remove footstalks of a RGB image without binarize them..that mean the output shoulg also be in rgb for but only footstalks are removed
1 Comment
jonas
on 24 Sep 2018
I'd open another question if I were you. It is unclear if your question is about removing footstalks or dealing with RGB images, or both.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!