merged all the latest changes from 2.4 to trunk
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
set(the_description "Object Detection")
|
||||
ocv_define_module(objdetect opencv_calib3d OPTIONAL opencv_highgui)
|
||||
ocv_define_module(objdetect OPTIONAL opencv_highgui)
|
||||
|
||||
@@ -12,7 +12,7 @@ First, a classifier (namely a *cascade of boosted classifiers working with haar-
|
||||
|
||||
After a classifier is trained, it can be applied to a region of interest (of the same size as used during the training) in an input image. The classifier outputs a "1" if the region is likely to show the object (i.e., face/car), and "0" otherwise. To search for the object in the whole image one can move the search window across the image and check every location using the classifier. The classifier is designed so that it can be easily "resized" in order to be able to find the objects of interest at different sizes, which is more efficient than resizing the image itself. So, to find an object of an unknown size in the image the scan procedure should be done several times at different scales.
|
||||
|
||||
The word "cascade" in the classifier name means that the resultant classifier consists of several simpler classifiers (*stages*) that are applied subsequently to a region of interest until at some stage the candidate is rejected or all the stages are passed. The word "boosted" means that the classifiers at every stage of the cascade are complex themselves and they are built out of basic classifiers using one of four different ``boosting`` techniques (weighted voting). Currently Discrete Adaboost, Real Adaboost, Gentle Adaboost and Logitboost are supported. The basic classifiers are decision-tree classifiers with at least 2 leaves. Haar-like features are the input to the basic classifers, and are calculated as described below. The current algorithm uses the following Haar-like features:
|
||||
The word "cascade" in the classifier name means that the resultant classifier consists of several simpler classifiers (*stages*) that are applied subsequently to a region of interest until at some stage the candidate is rejected or all the stages are passed. The word "boosted" means that the classifiers at every stage of the cascade are complex themselves and they are built out of basic classifiers using one of four different ``boosting`` techniques (weighted voting). Currently Discrete Adaboost, Real Adaboost, Gentle Adaboost and Logitboost are supported. The basic classifiers are decision-tree classifiers with at least 2 leaves. Haar-like features are the input to the basic classifiers, and are calculated as described below. The current algorithm uses the following Haar-like features:
|
||||
|
||||
|
||||
.. image:: pics/haarfeatures.png
|
||||
@@ -205,7 +205,7 @@ Detects objects of different sizes in the input image. The detected objects are
|
||||
|
||||
:param scaleFactor: Parameter specifying how much the image size is reduced at each image scale.
|
||||
|
||||
:param minNeighbors: Parameter specifying how many neighbors each candiate rectangle should have to retain it.
|
||||
:param minNeighbors: Parameter specifying how many neighbors each candidate rectangle should have to retain it.
|
||||
|
||||
:param flags: Parameter with the same meaning for an old cascade as in the function ``cvHaarDetectObjects``. It is not used for a new cascade.
|
||||
|
||||
@@ -213,6 +213,7 @@ Detects objects of different sizes in the input image. The detected objects are
|
||||
|
||||
:param maxSize: Maximum possible object size. Objects larger than that are ignored.
|
||||
|
||||
The function is parallelized with the TBB library.
|
||||
|
||||
|
||||
CascadeClassifier::setImage
|
||||
|
||||
@@ -248,7 +248,7 @@ and corresponding confidence levels.
|
||||
|
||||
LatentSvmDetector::getClassNames
|
||||
--------------------------------
|
||||
Return the class (model) names that were passed in constructor or method ``load`` or extructed from models filenames in those methods.
|
||||
Return the class (model) names that were passed in constructor or method ``load`` or extracted from models filenames in those methods.
|
||||
|
||||
.. ocv:function:: const vector<string>& LatentSvmDetector::getClassNames() const
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#define __OPENCV_OBJDETECT_HPP__
|
||||
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <map>
|
||||
|
||||
@@ -1500,7 +1500,8 @@ cvLoadHaarClassifierCascade( const char* directory, CvSize orig_window_size )
|
||||
fseek( f, 0, SEEK_END );
|
||||
size = ftell( f );
|
||||
fseek( f, 0, SEEK_SET );
|
||||
fread( ptr, 1, size, f );
|
||||
size_t elements_read = fread( ptr, 1, size, f );
|
||||
CV_Assert(elements_read == (size_t)(size));
|
||||
fclose(f);
|
||||
input_cascade[i] = ptr;
|
||||
ptr += size;
|
||||
|
||||
@@ -272,12 +272,12 @@ void quantizedOrientations(const Mat& src, Mat& magnitude,
|
||||
|
||||
// Allocate temporary buffers
|
||||
Size size = src.size();
|
||||
Mat_<Vec3s> sobel_3dx(size); // per-channel horizontal derivative
|
||||
Mat_<Vec3s> sobel_3dy(size); // per-channel vertical derivative
|
||||
Mat_<float> sobel_dx(size); // maximum horizontal derivative
|
||||
Mat_<float> sobel_dy(size); // maximum vertical derivative
|
||||
Mat_<float> sobel_ag(size); // final gradient orientation (unquantized)
|
||||
Mat_<Vec3b> smoothed(size);
|
||||
Mat sobel_3dx; // per-channel horizontal derivative
|
||||
Mat sobel_3dy; // per-channel vertical derivative
|
||||
Mat sobel_dx(size, CV_32F); // maximum horizontal derivative
|
||||
Mat sobel_dy(size, CV_32F); // maximum vertical derivative
|
||||
Mat sobel_ag; // final gradient orientation (unquantized)
|
||||
Mat smoothed;
|
||||
|
||||
// Compute horizontal and vertical image derivatives on all color channels separately
|
||||
static const int KERNEL_SIZE = 7;
|
||||
@@ -306,27 +306,27 @@ void quantizedOrientations(const Mat& src, Mat& magnitude,
|
||||
for (int i = 0; i < length0; i += 3)
|
||||
{
|
||||
// Use the gradient orientation of the channel whose magnitude is largest
|
||||
unsigned short mag1 = CV_SQR((unsigned short)ptrx[i]) + CV_SQR((unsigned short)ptry[i]);
|
||||
unsigned short mag2 = CV_SQR((unsigned short)ptrx[i + 1]) + CV_SQR((unsigned short)ptry[i + 1]);
|
||||
unsigned short mag3 = CV_SQR((unsigned short)ptrx[i + 2]) + CV_SQR((unsigned short)ptry[i + 2]);
|
||||
int mag1 = CV_SQR(ptrx[i]) + CV_SQR(ptry[i]);
|
||||
int mag2 = CV_SQR(ptrx[i + 1]) + CV_SQR(ptry[i + 1]);
|
||||
int mag3 = CV_SQR(ptrx[i + 2]) + CV_SQR(ptry[i + 2]);
|
||||
|
||||
if (mag1 >= mag2 && mag1 >= mag3)
|
||||
{
|
||||
ptr0x[ind] = ptrx[i];
|
||||
ptr0y[ind] = ptry[i];
|
||||
ptrmg[ind] = mag1;
|
||||
ptrmg[ind] = (float)mag1;
|
||||
}
|
||||
else if (mag2 >= mag1 && mag2 >= mag3)
|
||||
{
|
||||
ptr0x[ind] = ptrx[i + 1];
|
||||
ptr0y[ind] = ptry[i + 1];
|
||||
ptrmg[ind] = mag2;
|
||||
ptrmg[ind] = (float)mag2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr0x[ind] = ptrx[i + 2];
|
||||
ptr0y[ind] = ptry[i + 2];
|
||||
ptrmg[ind] = mag3;
|
||||
ptrmg[ind] = (float)mag3;
|
||||
}
|
||||
++ind;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,8 @@ void parserRFilter (FILE * xmlf, int p, CvLSVMFilterObject * model, float *b){
|
||||
}
|
||||
if(tagVal == WEIGHTS){
|
||||
data = (double *)malloc( sizeof(double) * p * sizeX * sizeY);
|
||||
fread(data, sizeof(double), p * sizeX * sizeY, xmlf);
|
||||
size_t elements_read = fread(data, sizeof(double), p * sizeX * sizeY, xmlf);
|
||||
CV_Assert(elements_read == (size_t)(p * sizeX * sizeY));
|
||||
model->H = (float *)malloc(sizeof(float)* p * sizeX * sizeY);
|
||||
for(ii = 0; ii < p * sizeX * sizeY; ii++){
|
||||
model->H[ii] = (float)data[ii];
|
||||
@@ -502,7 +503,8 @@ void parserPFilter (FILE * xmlf, int p, int /*N_path*/, CvLSVMFilterObject * mo
|
||||
}
|
||||
if(tagVal == WEIGHTS){
|
||||
data = (double *)malloc( sizeof(double) * p * sizeX * sizeY);
|
||||
fread(data, sizeof(double), p * sizeX * sizeY, xmlf);
|
||||
size_t elements_read = fread(data, sizeof(double), p * sizeX * sizeY, xmlf);
|
||||
CV_Assert(elements_read == (size_t)(p * sizeX * sizeY));
|
||||
model->H = (float *)malloc(sizeof(float)* p * sizeX * sizeY);
|
||||
for(ii = 0; ii < p * sizeX * sizeY; ii++){
|
||||
model->H[ii] = (float)data[ii];
|
||||
|
||||
@@ -56,8 +56,6 @@
|
||||
#include "opencv2/imgproc/imgproc_c.h"
|
||||
#include "opencv2/core/core_c.h"
|
||||
#include "opencv2/core/internal.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "opencv2/calib3d/calib3d.hpp"
|
||||
|
||||
#include "opencv2/opencv_modules.hpp"
|
||||
#ifdef HAVE_OPENCV_HIGHGUI
|
||||
|
||||
Reference in New Issue
Block a user