Best function to analyze 2D mosquito position

asked 2016-09-01 04:33:31 -0600

Vizier87 gravatar image

Hi guys,

I've been findcontours on my webcam to map a 2-D position of mosquitoes in a chamber but the results are marginal.

Here's a snippet:

for (int i = 0; i < contours.size(); i++){
            vector<Point> contour_poly;
            approxPolyDP(Mat(contours[i]), contour_poly, 3, true);

            //Simplifying the whole "contours[i].at(0)" thing
            int x = contours[i].at(0).x, y = contours[i].at(0).y;
            circle(current_frame, Point(x, y), 3, Scalar(0, 255, 0), 1, 8, 0);

        }

Any other suggestions on more suitable functions out there?

Thanks. Vizier87

edit retag flag offensive close merge delete

Comments

1

any image ?

pklab gravatar imagepklab ( 2016-09-01 05:04:04 -0600 )edit
1

Can you reliably binarize the image so only the mosquitoes are white and everything else is black?

Tetragramm gravatar imageTetragramm ( 2016-09-01 11:45:53 -0600 )edit

pklab: Here's the picture: https://postimg.org/image/bm9uwhviv/

Sorry the quality is poor. This is a demo on using low-resolution cameras for low-cost projects.

Tetragramm: Yes I can use the threshold function but then the image is so occluded that I land into getting a lot of false points or getting nothing.

Vizier87 gravatar imageVizier87 ( 2016-09-01 21:00:26 -0600 )edit
1

Umm. Which ones are the mosquitoes? I'm assuming they move? Try using the background subtractors. They should help you remove the background, so long as it's mostly stationary.

Tetragramm gravatar imageTetragramm ( 2016-09-01 22:39:35 -0600 )edit

Thanks for the suggestion man.. They sometimes move, but most of the time they're stationary.

But the video feed is always like "noisy".. I don't know how to describe it.

Lemme play around with this function for a while.

Vizier87 gravatar imageVizier87 ( 2016-09-04 23:16:22 -0600 )edit

you could get the background at start up and detect successive changes. BTW try to post 2 or 3 frames without scaling

pklab gravatar imagepklab ( 2016-09-05 04:16:06 -0600 )edit