Note that there are some explanatory texts on larger screens.

plurals
  1. POafter background subtraction how to detect segmented object?
    primarykey
    data
    text
    <p>I am trying for object detection using opencv 2.4.2. Here is the code for my moving foreground subtraction. Now I want to detect moving object in original frame and draw bounding box around it. can anybody please help me? how to do that?</p> <pre><code> #include "stdafx.h" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/contrib/contrib.hpp" #include "conio.h" #include "time.h" #include "opencv/cvaux.hpp" #include "opencv2/core/core.hpp" #include "opencv2/calib3d/calib3d.hpp" using namespace std; using namespace cv; int main(int argc, char *argv[]) { int key = 0; CvSize imgSize; CvCapture* capture = cvCaptureFromFile( "S:\\offline object detection database\\TwoEnterShop2cor.MPG" ); IplImage* frame = cvQueryFrame( capture ); imgSize = cvGetSize(frame); IplImage* grayImage = cvCreateImage( imgSize, IPL_DEPTH_8U, 1); IplImage* currframe = cvCreateImage(imgSize,IPL_DEPTH_8U,3); IplImage* destframe = cvCreateImage(imgSize,IPL_DEPTH_8U,3); if ( !capture ) { fprintf( stderr, "Cannot open AVI!\n" ); return 1; } int fps = ( int )cvGetCaptureProperty( capture, CV_CAP_PROP_FPS ); cvNamedWindow( "dest", CV_WINDOW_AUTOSIZE ); while( key != 'y' ) { frame = cvQueryFrame( capture ); currframe = cvCloneImage( frame );// copy frame to current frame = cvQueryFrame( capture );// grab frame cvAbsDiff(frame,currframe,destframe); cvCvtColor(destframe,grayImage,CV_RGB2GRAY); cvSmooth(grayImage,grayImage,CV_MEDIAN,3,3,0); cvAdaptiveThreshold(grayImage,grayImage,230,CV_THRESH_BINARY,CV_ADAPTIVE_THRESH_GAUSSIAN_C,3,5); cvDilate(grayImage, grayImage, 0,1); cvErode(grayImage,grayImage, 0, 0); if(key==27 )break; cvShowImage( "fram",currframe); cvShowImage( "dest",grayImage); key = cvWaitKey( 100 ); } cvDestroyWindow( "dest" ); cvReleaseCapture( &amp;capture ); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload