44#ifndef OPENCV_OBJDETECT_HPP
45#define OPENCV_OBJDETECT_HPP
47#include "opencv2/core.hpp"
109typedef struct CvHaarClassifierCascade CvHaarClassifierCascade;
125 inline bool operator()(
const Rect& r1,
const Rect& r2)
const
151CV_EXPORTS
void groupRectangles(std::vector<Rect>& rectList,
int groupThreshold,
double eps = 0.2);
153CV_EXPORTS_W
void groupRectangles(CV_IN_OUT std::vector<Rect>& rectList, CV_OUT std::vector<int>& weights,
154 int groupThreshold,
double eps = 0.2);
157 double eps, std::vector<int>* weights, std::vector<double>* levelWeights );
159CV_EXPORTS
void groupRectangles(std::vector<Rect>& rectList, std::vector<int>& rejectLevels,
160 std::vector<double>& levelWeights,
int groupThreshold,
double eps = 0.2);
163 std::vector<double>& foundScales,
164 double detectThreshold = 0.0,
Size winDetSize =
Size(64, 128));
166template<>
struct DefaultDeleter<CvHaarClassifierCascade>{ CV_EXPORTS
void operator ()(CvHaarClassifierCascade* obj)
const; };
168enum { CASCADE_DO_CANNY_PRUNING = 1,
169 CASCADE_SCALE_IMAGE = 2,
170 CASCADE_FIND_BIGGEST_OBJECT = 4,
171 CASCADE_DO_ROUGH_SEARCH = 8
178 virtual bool empty() const CV_OVERRIDE = 0;
179 virtual
bool load( const String& filename ) = 0;
180 virtual
void detectMultiScale( InputArray image,
181 CV_OUT std::vector<
Rect>& objects,
183 int minNeighbors,
int flags,
186 virtual
void detectMultiScale( InputArray image,
187 CV_OUT std::vector<
Rect>& objects,
188 CV_OUT std::vector<
int>& numDetections,
190 int minNeighbors,
int flags,
193 virtual
void detectMultiScale( InputArray image,
194 CV_OUT std::vector<
Rect>& objects,
195 CV_OUT std::vector<
int>& rejectLevels,
196 CV_OUT std::vector<
double>& levelWeights,
198 int minNeighbors,
int flags,
200 bool outputRejectLevels ) = 0;
202 virtual
bool isOldFormatCascade() const = 0;
203 virtual
Size getOriginalWindowSize() const = 0;
204 virtual
int getFeatureType() const = 0;
205 virtual
void* getOldCascade() = 0;
211 virtual Mat generateMask(
const Mat& src)=0;
212 virtual void initializeMask(
const Mat& ) { }
236 CV_WRAP
bool empty()
const;
243 CV_WRAP
bool load(
const String& filename );
270 CV_WRAP
void detectMultiScale( InputArray image,
271 CV_OUT std::vector<Rect>& objects,
272 double scaleFactor = 1.1,
273 int minNeighbors = 3,
int flags = 0,
292 CV_WRAP_AS(detectMultiScale2)
void detectMultiScale( InputArray image,
293 CV_OUT std::vector<Rect>& objects,
294 CV_OUT std::vector<int>& numDetections,
295 double scaleFactor=1.1,
296 int minNeighbors=3,
int flags=0,
317 CV_WRAP_AS(detectMultiScale3)
void detectMultiScale( InputArray image,
318 CV_OUT std::vector<Rect>& objects,
319 CV_OUT std::vector<int>& rejectLevels,
320 CV_OUT std::vector<double>& levelWeights,
321 double scaleFactor = 1.1,
322 int minNeighbors = 3,
int flags = 0,
325 bool outputRejectLevels =
false );
327 CV_WRAP
bool isOldFormatCascade()
const;
328 CV_WRAP
Size getOriginalWindowSize()
const;
329 CV_WRAP
int getFeatureType()
const;
330 void* getOldCascade();
332 CV_WRAP
static bool convert(
const String& oldcascade,
const String& newcascade);
377 enum { DEFAULT_NLEVELS = 64
379 enum DescriptorStorageFormat { DESCR_FORMAT_COL_BY_COL, DESCR_FORMAT_ROW_BY_ROW };
385 CV_WRAP
HOGDescriptor() : winSize(64,128), blockSize(16,16), blockStride(8,8),
386 cellSize(8,8), nbins(9), derivAperture(1), winSigma(-1),
388 free_coef(-1.f), nlevels(
HOGDescriptor::DEFAULT_NLEVELS), signedGradient(false)
406 Size _cellSize,
int _nbins,
int _derivAperture=1,
double _winSigma=-1,
408 double _L2HysThreshold=0.2,
bool _gammaCorrection=
false,
410 : winSize(_winSize), blockSize(_blockSize), blockStride(_blockStride), cellSize(_cellSize),
411 nbins(_nbins), derivAperture(_derivAperture), winSigma(_winSigma),
412 histogramNormType(_histogramNormType), L2HysThreshold(_L2HysThreshold),
413 gammaCorrection(_gammaCorrection), free_coef(-1.f), nlevels(_nlevels), signedGradient(_signedGradient)
438 CV_WRAP
size_t getDescriptorSize()
const;
442 CV_WRAP
bool checkDetectorSize()
const;
446 CV_WRAP
double getWinSigma()
const;
453 CV_WRAP
virtual void setSVMDetector(InputArray svmdetector);
470 CV_WRAP
virtual bool load(
const String& filename,
const String& objname = String());
476 CV_WRAP
virtual void save(
const String& filename,
const String& objname = String())
const;
492 CV_WRAP
virtual void compute(InputArray img,
493 CV_OUT std::vector<float>& descriptors,
495 const std::vector<Point>& locations = std::vector<Point>())
const;
508 CV_WRAP
virtual void detect(InputArray img, CV_OUT std::vector<Point>& foundLocations,
509 CV_OUT std::vector<double>& weights,
510 double hitThreshold = 0,
Size winStride =
Size(),
512 const std::vector<Point>& searchLocations = std::vector<Point>())
const;
524 virtual void detect(InputArray img, CV_OUT std::vector<Point>& foundLocations,
525 double hitThreshold = 0,
Size winStride =
Size(),
527 const std::vector<Point>& searchLocations=std::vector<Point>())
const;
543 CV_WRAP
virtual void detectMultiScale(InputArray img, CV_OUT std::vector<Rect>& foundLocations,
544 CV_OUT std::vector<double>& foundWeights,
double hitThreshold = 0,
546 double finalThreshold = 2.0,
bool useMeanshiftGrouping =
false)
const;
562 double hitThreshold = 0,
Size winStride =
Size(),
563 Size padding =
Size(),
double scale = 1.05,
564 double finalThreshold = 2.0,
bool useMeanshiftGrouping =
false)
const;
578 CV_WRAP
static std::vector<float> getDefaultPeopleDetector();
584 CV_WRAP
static std::vector<float> getDaimlerPeopleDetector();
602 CV_PROP
int derivAperture;
605 CV_PROP
double winSigma;
611 CV_PROP
double L2HysThreshold;
617 CV_PROP std::vector<float> svmDetector;
629 CV_PROP
bool signedGradient;
642 virtual void detectROI(InputArray img,
const std::vector<cv::Point> &locations,
643 CV_OUT std::vector<cv::Point>& foundLocations, CV_OUT std::vector<double>& confidences,
656 CV_OUT std::vector<cv::Rect>& foundLocations,
657 std::vector<DetectionROI>& locations,
658 double hitThreshold = 0,
659 int groupThreshold = 0)
const;
667 void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights,
int groupThreshold,
double eps)
const;
680 CV_WRAP
void setEpsX(
double epsX);
685 CV_WRAP
void setEpsY(
double epsY);
700 CV_WRAP std::string decode(InputArray img, InputArray points,
OutputArray straight_qrcode = noArray());
709 CV_WRAP cv::String decodeCurved(InputArray img, InputArray points,
OutputArray straight_qrcode = noArray());
717 CV_WRAP std::string detectAndDecode(InputArray img,
OutputArray points=noArray(),
726 CV_WRAP std::string detectAndDecodeCurved(InputArray img,
OutputArray points=noArray(),
744 InputArray img, InputArray points,
745 CV_OUT std::vector<std::string>& decoded_info,
757 InputArray img, CV_OUT std::vector<std::string>& decoded_info,
770#include "opencv2/objdetect/detection_based_tracker.hpp"
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
This is a base class for all more or less complex algorithms in OpenCV
Definition: core.hpp:3091
Definition: objdetect.hpp:208
Definition: objdetect.hpp:175
virtual bool empty() const CV_OVERRIDE=0
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
Cascade classifier class for object detection.
Definition: objdetect.hpp:225
CV_WRAP_AS(detectMultiScale3) void detectMultiScale(InputArray image
CV_WRAP_AS(detectMultiScale2) void detectMultiScale(InputArray image
File Storage Node class.
Definition: persistence.hpp:482
XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or readi...
Definition: persistence.hpp:304
n-dimensional dense array class
Definition: mat.hpp:802
Definition: objdetect.hpp:671
CV_WRAP bool decodeMulti(InputArray img, InputArray points, CV_OUT std::vector< std::string > &decoded_info, OutputArrayOfArrays straight_qrcode=noArray()) const
Decodes QR codes in image once it's found by the detect() method.
CV_WRAP bool detectMulti(InputArray img, OutputArray points) const
Detects QR codes in image and returns the vector of the quadrangles containing the codes.
CV_WRAP bool detectAndDecodeMulti(InputArray img, CV_OUT std::vector< std::string > &decoded_info, OutputArray points=noArray(), OutputArrayOfArrays straight_qrcode=noArray()) const
Both detects and decodes QR codes
Template class for 2D rectangles
Definition: core/types.hpp:421
_Tp x
x coordinate of the top-left corner
Definition: core/types.hpp:453
_Tp y
y coordinate of the top-left corner
Definition: core/types.hpp:454
_Tp width
width of the rectangle
Definition: core/types.hpp:455
_Tp height
height of the rectangle
Definition: core/types.hpp:456
Definition: objdetect.hpp:122
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element minimum of two arrays or an array and a scalar.
softfloat abs(softfloat a)
Absolute value
Definition: softfloat.hpp:444
CV_EXPORTS void groupRectangles_meanshift(std::vector< Rect > &rectList, std::vector< double > &foundWeights, std::vector< double > &foundScales, double detectThreshold=0.0, Size winDetSize=Size(64, 128))
CV_EXPORTS void groupRectangles(std::vector< Rect > &rectList, int groupThreshold, double eps=0.2)
Groups the object candidate rectangles.
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:32
struct for detection region of interest (ROI)
Definition: objdetect.hpp:346
std::vector< double > confidences
vector that will contain confidence values for each location
Definition: objdetect.hpp:352
double scale
scale(size) of the bounding box
Definition: objdetect.hpp:348
std::vector< cv::Point > locations
set of requested locations to be evaluated
Definition: objdetect.hpp:350
Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector.
Definition: objdetect.hpp:373
@ DEFAULT_NLEVELS
Default nlevels value.
Definition: objdetect.hpp:377
virtual bool read(FileNode &fn)
Reads HOGDescriptor parameters from a cv::FileNode.
virtual void detectMultiScale(InputArray img, CV_OUT std::vector< Rect > &foundLocations, double hitThreshold=0, Size winStride=Size(), Size padding=Size(), double scale=1.05, double finalThreshold=2.0, bool useMeanshiftGrouping=false) const
Detects objects of different sizes in the input image. The detected objects are returned as a list of...
virtual void write(FileStorage &fs, const String &objname) const
Stores HOGDescriptor parameters in a cv::FileStorage.
UMat oclSvmDetector
coefficients for the linear SVM classifier used when OpenCL is enabled
Definition: objdetect.hpp:620
float free_coef
not documented
Definition: objdetect.hpp:623
virtual ~HOGDescriptor()
Default destructor.
Definition: objdetect.hpp:434
virtual void detect(InputArray img, CV_OUT std::vector< Point > &foundLocations, double hitThreshold=0, Size winStride=Size(), Size padding=Size(), const std::vector< Point > &searchLocations=std::vector< Point >()) const
Performs object detection without a multi-scale window.
HistogramNormType
Definition: objdetect.hpp:375
@ L2Hys
Default histogramNormType
Definition: objdetect.hpp:375
virtual void copyTo(HOGDescriptor &c) const
clones the HOGDescriptor
HOGDescriptor(const HOGDescriptor &d)
Definition: objdetect.hpp:427
virtual void detectROI(InputArray img, const std::vector< cv::Point > &locations, CV_OUT std::vector< cv::Point > &foundLocations, CV_OUT std::vector< double > &confidences, double hitThreshold=0, cv::Size winStride=Size(), cv::Size padding=Size()) const
evaluate specified ROI and return confidence value for each location
void groupRectangles(std::vector< cv::Rect > &rectList, std::vector< double > &weights, int groupThreshold, double eps) const
Groups the object candidate rectangles.
virtual void detectMultiScaleROI(InputArray img, CV_OUT std::vector< cv::Rect > &foundLocations, std::vector< DetectionROI > &locations, double hitThreshold=0, int groupThreshold=0) const
evaluate specified ROI and return confidence value for each location in multiple scales
Definition: cvstd_wrapper.hpp:74