Ask Your Question

raj's profile - activity

2013-01-31 00:02:03 -0500 received badge  Peer Pressure (source)
2013-01-11 02:36:51 -0500 received badge  Editor (source)
2013-01-11 02:31:28 -0500 asked a question opencv code doubt

i want to make outdoor system which count people standing in front of camera and ignore the tress like moving objects... i wrote code written below but its not working in my system having openCV 2.3.1 . can anyone tell me why and what changes should i make in it to run it successfully ...

#include "opencv2/video/tracking.hpp"

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/video/background_segm.hpp"
#include "opencv2/features2d/features2d.hpp"

using namespace cv;  
int main()
VideoCapture cap;
int thresh = 8 ;//
//;//"sidewalk.avi"); // Reads the video image
if( !cap.isOpened() ) //
puts("***Could not initialize capturing...***\n");
return 0;
namedWindow( "Capture ", CV_WINDOW_AUTOSIZE);
namedWindow( "Foreground ", CV_WINDOW_AUTOSIZE );
namedWindow( "Control Window", CV_WINDOW_AUTOSIZE );
createTrackbar("Threshold", "Control Window", &thresh, 100);
Mat frame,foreground,image;
BackgroundSubtractorMOG2 mog;
int fps=cap.get(CV_CAP_PROP_FPS);

// Show on the display part
imshow( "Capture ",image );
// image.copyTo(foreground,foreground); // Try it and see what happens at one
imshow("Foreground ",foreground);
// set up the parameters (check the defaults in opencv's code in blobdetector.cpp)
cv::SimpleBlobDetector::Params params;
params.minDistBetweenBlobs = 50.0f;
params.filterByInertia = false;
params.filterByConvexity = false;
params.filterByColor = false;
params.filterByCircularity = false;
params.filterByArea = true;
params.minArea = 10.0f;
params.maxArea = 1000.0f;

// set up and create the detector using the parameters
cv::Ptr<cv::featuredetector> blob_detector = new cv::SimpleBlobDetector(params);

// detect!
vector<cv::keypoint> keypoints; 
blob_detector->detect(foreground, keypoints); 

for(int j = 0; j<keypoints.size(); j++)
string text = format("%d", (int)j);
putText(foreground, text, keypoints[j].pt, FONT_HERSHEY_PLAIN, 0.8, CV_RGB(255,0,0), 1.0);
string text = format("%d People", (int)keypoints.size()) ;
putText(foreground, text, Point(20, 20), FONT_HERSHEY_PLAIN, 1.3, CV_RGB(255,255,255), 1.2);
imshow("Foreground ",foreground);
char c = (char)waitKey(fps);
if( c == 27 ) 

thanks in advance..

2013-01-11 02:30:41 -0500 received badge  Student (source)
2013-01-11 01:52:48 -0500 asked a question openCV general library info

I am using openCV 2.3.1 since last 1 month and have made many projects with it in C LANGUAGE. I recently got to know that openCV 2.4.3 has already defined advanced data classes like BackgroundSubtractorMOG2(which uses Gaussian Mixture-based Background/Foreground Segmentation Algorithm) and many more. So, i want to shift to openCV 2.4.3 but i have one fear whether my earlier project source codes written in C LANGUAGE would still work or not? If not,what changes i have to do with those codes to make them run under openCV 2.4.3 ? Thanks in advance..