How to detect AAL
7 views (last 30 days)
Show older comments
How do I detect
Ive tried the coding below, but the segmentation is awful.
I=imread('black.jpg');
I2=rgb2gray(I);
J = imnoise(I2,'salt & pepper',0.02);
figure
imshow(J)
Kaverage = filter2(fspecial('average',3),J)/255;
figure
imshow(Kaverage)
Kmedian = medfilt2(J);
imshowpair(Kaverage,Kmedian,'montage')
BW1 = edge(Kmedian,'Canny');
BW2 = edge(Kmedian,'Prewitt');
3 Comments
Image Analyst
on 14 Jan 2021
Yeah, and removed the image and some words, and made the explanation incomprehensible, which essentially makes this question worthless.
Answers (1)
Image Analyst
on 7 Jan 2021
Edited: Image Analyst
on 7 Jan 2021
There is no justification for doing edge detection on that image. Just because you can see edges does not mean you should do edge detection. If another novice told you to do that, then they are wrong.
What you should do it to threshold for non-black. That will find the foil. Then, if you don't have aligned foils, you should align the image. You can do that by scanning the middle half of the image to find the left edge and then getting the slope and calling imrotate. Then threshold again and call crop. Then you should have a mask prepared with locations of the circles. Pass that mask and the rotated, cropped image into regionprops to get the MeanIntensity and PixelValues of each circle. compare those to the values you'd get from a perfect/filled blister pack to determine which circles are filled and which are empty/broken.
So those are the steps. Are you willing to try them on your own first?
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!