move soft cascade functionality into dedicated module
This commit is contained in:
@@ -488,105 +488,6 @@ protected:
|
||||
Ptr<MaskGenerator> maskGenerator;
|
||||
};
|
||||
|
||||
|
||||
class CV_EXPORTS_W ICFPreprocessor
|
||||
{
|
||||
public:
|
||||
CV_WRAP ICFPreprocessor();
|
||||
CV_WRAP void apply(cv::InputArray _frame, cv::OutputArray _integrals) const;
|
||||
protected:
|
||||
enum {BINS = 10};
|
||||
};
|
||||
|
||||
// Implementation of soft (stageless) cascaded detector.
|
||||
class CV_EXPORTS_W SCascade : public Algorithm
|
||||
{
|
||||
public:
|
||||
|
||||
// Representation of detectors result.
|
||||
struct CV_EXPORTS Detection
|
||||
{
|
||||
// Default object type.
|
||||
enum {PEDESTRIAN = 1};
|
||||
|
||||
// Creates Detection from an object bounding box and confidence.
|
||||
// Param b is a bounding box
|
||||
// Param c is a confidence that object belongs to class k
|
||||
// Paral k is an object class
|
||||
Detection(const cv::Rect& b, const float c, int k = PEDESTRIAN) : bb(b), confidence(c), kind(k) {}
|
||||
|
||||
cv::Rect bb;
|
||||
float confidence;
|
||||
int kind;
|
||||
};
|
||||
|
||||
// Create channel integrals for Soft Cascade detector.
|
||||
class CV_EXPORTS Channels
|
||||
{
|
||||
public:
|
||||
// constrictor form resizing factor.
|
||||
// Param shr is a resizing factor. Resize is applied before the computing integral sum
|
||||
Channels(const int shrinkage);
|
||||
|
||||
// Appends specified number of HOG first-order features integrals into given vector.
|
||||
// Param gray is an input 1-channel gray image.
|
||||
// Param integrals is a vector of integrals. Hog-channels will be appended to it.
|
||||
// Param bins is a number of hog-bins
|
||||
void appendHogBins(const cv::Mat& gray, std::vector<cv::Mat>& integrals, int bins) const;
|
||||
|
||||
// Converts 3-channel BGR input frame in Luv and appends each channel to the integrals.
|
||||
// Param frame is an input 3-channel BGR colored image.
|
||||
// Param integrals is a vector of integrals. Computed from the frame luv-channels will be appended to it.
|
||||
void appendLuvBins(const cv::Mat& frame, std::vector<cv::Mat>& integrals) const;
|
||||
|
||||
private:
|
||||
int shrinkage;
|
||||
};
|
||||
|
||||
enum { NO_REJECT = 1, DOLLAR = 2, /*PASCAL = 4,*/ DEFAULT = NO_REJECT};
|
||||
|
||||
// An empty cascade will be created.
|
||||
// Param minScale is a minimum scale relative to the original size of the image on which cascade will be applyed.
|
||||
// Param minScale is a maximum scale relative to the original size of the image on which cascade will be applyed.
|
||||
// Param scales is a number of scales from minScale to maxScale.
|
||||
// Param rejCriteria is used for NMS.
|
||||
CV_WRAP SCascade(const double minScale = 0.4, const double maxScale = 5., const int scales = 55, const int rejCriteria = 1);
|
||||
|
||||
CV_WRAP virtual ~SCascade();
|
||||
|
||||
cv::AlgorithmInfo* info() const;
|
||||
|
||||
// Load cascade from FileNode.
|
||||
// Param fn is a root node for cascade. Should be <cascade>.
|
||||
CV_WRAP virtual bool load(const FileNode& fn);
|
||||
|
||||
// Load cascade config.
|
||||
CV_WRAP virtual void read(const FileNode& fn);
|
||||
|
||||
// Return the vector of Decection objcts.
|
||||
// Param image is a frame on which detector will be applied.
|
||||
// Param rois is a vector of regions of interest. Only the objects that fall into one of the regions will be returned.
|
||||
// Param objects is an output array of Detections
|
||||
virtual void detect(InputArray image, InputArray rois, std::vector<Detection>& objects) const;
|
||||
// Param rects is an output array of bounding rectangles for detected objects.
|
||||
// Param confs is an output array of confidence for detected objects. i-th bounding rectangle corresponds i-th configence.
|
||||
CV_WRAP virtual void detect(InputArray image, InputArray rois, OutputArray rects, OutputArray confs) const;
|
||||
|
||||
private:
|
||||
void detectNoRoi(const Mat& image, std::vector<Detection>& objects) const;
|
||||
|
||||
struct Fields;
|
||||
Fields* fields;
|
||||
|
||||
double minScale;
|
||||
double maxScale;
|
||||
|
||||
int scales;
|
||||
int rejCriteria;
|
||||
};
|
||||
|
||||
CV_EXPORTS bool initModule_objdetect(void);
|
||||
|
||||
//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
|
||||
|
||||
// struct for detection region of interest (ROI)
|
||||
|
Reference in New Issue
Block a user