Ask Your Question
0

haartraining counting

asked 2014-01-29 07:18:31 -0600

Amit gravatar image

i used haartraininng to count the object, but this will count frame by frame. So can we use this to count a object one time only.

for( i = 0; i < (object ? object->total : 0); i++ )
                {
                    CvRect* r = (CvRect*)cvGetSeqElem( object, i );

                    pt1.x = r->x*scale;    
                    pt2.x = (r->x+r->width)*scale;
                    pt1.y = r->y*scale;
                    pt2.y = (r->y+r->height)*scale;

                    cvRectangle( img, pt1, pt2, CV_RGB(230,20,232), 3, 8, 0 );

                }
                cout << "Total: " << object->total << " cars" << endl;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-01-29 07:24:25 -0600

updated 2014-01-29 07:30:08 -0600

Once you have a large set of rectangles, you can use the groupRectangles() functionality which combines overlapping rectangles into a single positive detection.

Take a look here.

However, to use this, you will either have to

  • Transform your project to the C++ interface
  • Transform your data locally to a C++ data structure, to apply the function

The C-API doesn't provide this interface, nor will it provide newer functionality....

edit flag offensive delete link more

Comments

Thanks, first i will transform my code then I will look into this and get back to you

Amit gravatar imageAmit ( 2014-01-29 23:37:08 -0600 )edit

You will notice how much easier your life becomes programming OpenCV code once you switch to the C++ interface.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-30 02:38:41 -0600 )edit

Question Tools

Stats

Asked: 2014-01-29 07:18:31 -0600

Seen: 289 times

Last updated: Jan 29 '14