¿can someone tell me how can i threshold this grayscale image to later count the white squares?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
i'm using an usb camera and taking snapshots from it, but i cant figure it out how to threshold the image to get only the white squares, then im going to count them but i always get noise. @Image Analyst i need your help! i upload photos of the original RGB picture and the gray scale ones. this is the code:
im=snapshot(vid); im=imcrop(ima,roi); imG=rgb2gray(im); imG=imadjust(imG); imB=im2bw(imagenG2,0.72); subplot(3,1,1); imshow(im); subplot(3,1,2); imshow(imG); subplot(3,1,3); imshow(imB);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190928/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190929/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190930/image.png)
0 Kommentare
Antworten (1)
Nate Ellingson
am 30 Mai 2018
Bearbeitet: Nate Ellingson
am 30 Mai 2018
The best way I see to do this:
Use "imcontour" on your thresholded image, and then figure out how to parse the "C" output argument of this function (OpenCV's function is a little easier to use)
Find the area of each contour with a function like polyarea.
Then only count areas large enough to be one of the white squares.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Camera Calibration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!