1

I'm new to opencv, i'm doing my project that need to be able to detect how many object moving in front of the webcam. I try to search, but it doesn't seem to be any result what I have been looking for.

I'm using...

    Point2f rect_points[4]; rect.points( rect_points );

    for(j = 0; j < 4; j++ )
    {
     line(pic, rect_points[j], rect_points[(j+1)%4], Scalar(0,0,0), 3, 4 );
     circle(frame,rect_points[j],5,Scalar(144,144,255),3);
    }

.. to draw rectangles(4lines) and circles in each corner to cover the object, but they're create in loop, is there any way I can count the objects.

Here the result that i'm working on : http://postimg.org/image/pt3g8m4il/

In the snapshot there are 2 squares drawn by lines, I want to count the objects in the squares any idea? please help

Thank you for reading and helping.

Anoop K. Prabhu
  • 5,417
  • 2
  • 26
  • 43
Por
  • 21
  • 1
  • You should specify what you mean with 'count' - are the fingers relevant? If you want to find the balls take a look here: http://stackoverflow.com/questions/21770948/ball-detection-with-opencv/21776777?noredirect=1#comment32971645_21776777 Also you can focus only on regions of interest in your image: http://docs.opencv.org/doc/tutorials/core/mat_the_basic_image_container/mat_the_basic_image_container.html – Sebastian Schmitz Feb 19 '14 at 16:58
  • So you want to count the objects present in each square. ie, a single square can contain more than one object? – Anoop K. Prabhu Feb 19 '14 at 18:06
  • I think that you should some more code about how are you detecting all the objects in a given webcam frame? – skm Feb 19 '14 at 22:34
  • Thank you for trying to help me. What I mean here is to count the squares those are drawn, 1 square = 1 object(doesn't matter with fingers,hands ....just what ever in the square is = to an object) Here is the full source code I'm working on : http://pastebin.com/3krr1xMS I use contours and hulls to distinguish between background and video. Thank you again for reading and helping. – Por Feb 20 '14 at 05:23

0 Answers0