How to detect AAL

7 次查看(过去 30 天)
Brian Pravin
Brian Pravin 2021-1-6
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 个评论
Brian Pravin
Brian Pravin 2021-1-7
Ive updated the question and coding.
Image Analyst
Image Analyst 2021-1-14
Yeah, and removed the image and some words, and made the explanation incomprehensible, which essentially makes this question worthless.

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2021-1-7
编辑:Image Analyst 2021-1-7
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?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by