![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/181680/image.jpeg)
Hi for the past 2 days i am working on a code to get a binary image of my rice samples through edge detection technique.I have used Sobel and Canny but the problem that i face is that at some points the edges are not that sharp kindly help me.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi for the past 2 days i am working on a code to get a binary image of my rice samples through edge detection technique.I have used Sobel and Canny but the problem that i face is that while using canny filter as it provide a better result over Sobel, at some points the edges are not that sharp and due to that some grains are missing in the final binary image kindly help me. Result that i get
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169710/image.jpeg)
0 Commenti
Risposta accettata
Matt J
il 31 Gen 2018
Modificato: Matt J
il 31 Gen 2018
This seems to work
A=double(rgb2gray(imread('ricesam6.jpg'))); A=A/max(A(:));
B=imtophat((entropyfilt(A,ones(11))) ,strel('disk',21));
C=(medfilt2(double(B>.8),[1,1]*11));
result=bwpropfilt(C>0,'MajorAxisLength',[120,inf]);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/181680/image.jpeg)
4 Commenti
Matt J
il 25 Feb 2018
You're welcome, but please click "Accept" to certify that it solved your problem.
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!