Tutorials for Beginner Cascade Classifier Training in C++? [closed]
I am a fifth-year University art student and hobbyist programmer. I am fairly familiar with C++ and have managed to familiarize myself with OpenCV thanks to the abundance of fine resources. I am working on an ongoing project that will culminate in a museum installation.
So far I have created a program that tracks movement in live webcam video stream. The program can track many different objects by using absdiff comparisons on image frames, creating a threshold image, and analyzing the contours. I am using variables for threshold sensitivity and blur amount to somewhat control contour sizes. I have provided my source code at the bottom of this post.
The problem I have, is that a single person or object may be treated/tracked as many different objects based on lighting and other factors. I am interested in Cascade Classifier Training in order to identify the human figure. The background of my live stream is simple, monochromatic, static, and well-lit - so I don't imagine it will be hard to create negative training examples. The position of the camera will be unchanging, so I should be able to use it to take many still images of human figures throughout the space, for use as positive training examples.
I hope my understanding of Cascade Classifier Training is somewhat accurate. I am seeking simple beginner tutorials to instruct me step-by-step in training a classifier, with example code. Any help or resources that you can provide are of great help and interest, and I thank you in advance.
I am also interested in attempting to map the detected movement to a drawn space: although I am tracking the X & Y coordinates of the center of the contour objects, I have no way to, say, map the human figure's movement to a very basic rendered figure. This thread is likely not the place for this question, but perhaps someone looking at my cascade question can point me in the right direction.
Thing.h
#pragma once
#include <string>
using namespace std;
class Thing{
public:
Thing();
~Thing();
int getXPos();
void setXPos(int x);
int getYPos();
void setYPos(int y);
private:
int xPos, yPos;
string type;
};
Thing.cpp
#include "Thing.h"
Thing::Thing(){}
Thing::~Thing(){}
int Thing::getXPos(){
return Thing::xPos;
}
void Thing::setXPos(int x){
Thing::xPos = x;
}
int Thing::getYPos(){
return Thing::yPos;
}
void Thing::setYPos(int y){
Thing::yPos = y;
}
main.cpp
#define _CRT_SECURE_NO_DEPRECATE
#include <sstream>
#include <string>
#include <iostream>
#include <vector>
#include <opencv\cv.h>
#include <opencv\highgui.h>
#include "Thing.h"
using namespace std;
using namespace cv;
const static int SENSITIVITY_VALUE = 10;
const static int BLUR_SIZE = 70;
const int FRAME_WIDTH = 640;
const int FRAME_HEIGHT = 480;
const int MIN_OBJECT_AREA = 20 * 20;
string intToString(int number){
std::stringstream ss;
ss << number;
return ss.str();
}
void drawObject(vector<Thing> theThings, Mat &frame){
for (int i = 0; i<theThings.size(); i++){
cv::circle(frame, cv::Point(theThings.at(i).getXPos(), theThings.at(i).getYPos()), 10, cv::Scalar(0, 0, 255));
cv::putText(frame, intToString(theThings ...
There is already a cascade for person detection, so don't think you need to train your own cascade.
However, I didn't get good results on person detection using the cascade, so I can send you some links to external packages if you want.
Also, you can use the HOG person detector or latent-svm detector (use latent svm detector only if running times are not a problem)
Please reply if you want me to send you links on people detection and people tracking and also packages for general object detection.
Yes I would certainly appreciate if you could send me those resources. You can send them to [email protected], or post here or whatever you prefer.