The Detection structure provides object detection with using of HAAR and LBP cascade classifiers. More...
#include <SimdDetection.hpp>
Data Structures | |
struct | Object |
The Object structure describes detected object. More... | |
Public Types | |
typedef A< uint8_t > | Allocator |
typedef Simd::View< A > | View |
typedef Simd::Point< ptrdiff_t > | Size |
typedef std::vector< Size > | Sizes |
typedef Simd::Rectangle< ptrdiff_t > | Rect |
typedef std::vector< Rect > | Rects |
typedef int | Tag |
typedef std::vector< Object > | Objects |
Public Member Functions | |
Detection () | |
~Detection () | |
bool | LoadStringXml (const std::string &xml, Tag tag=UNDEFINED_OBJECT_TAG) |
bool | Load (const std::string &path, Tag tag=UNDEFINED_OBJECT_TAG) |
bool | Init (const Size &imageSize, double scaleFactor=1.1, const Size &sizeMin=Size(0, 0), const Size &sizeMax=Size(INT_MAX, INT_MAX), const View &roi=View(), ptrdiff_t threadNumber=-1) |
bool | Detect (const View &src, Objects &objects, int groupSizeMin=3, double sizeDifferenceMax=0.2, bool motionMask=false, const Rects &motionRegions=Rects()) |
Static Public Attributes | |
static const Tag | UNDEFINED_OBJECT_TAG = -1 |
Detailed Description
struct Simd::Detection< A >
The Detection structure provides object detection with using of HAAR and LBP cascade classifiers.
Using example (face detection in the image):
Using example (face detection in the video captured by OpenCV):
- Note
- This is wrapper around low-level Object Detection API.
Member Typedef Documentation
◆ Allocator
◆ View
typedef Simd::View<A> View |
An image type definition.
◆ Size
typedef Simd::Point<ptrdiff_t> Size |
An image size type definition.
◆ Sizes
◆ Rect
typedef Simd::Rectangle<ptrdiff_t> Rect |
A rectangle type definition.
◆ Rects
◆ Tag
typedef int Tag |
A tag type definition.
◆ Objects
Constructor & Destructor Documentation
◆ Detection()
◆ ~Detection()
Member Function Documentation
◆ LoadStringXml()
bool LoadStringXml | ( | const std::string & | xml, |
Tag | tag = UNDEFINED_OBJECT_TAG |
||
) |
Loads from file classifier cascade. Supports OpenCV HAAR and LBP cascades type. You can call this function more than once if you want to use several object detectors at the same time.
- Note
- Tree based cascades and old cascade formats are not supported!
- Parameters
-
[in] xml - a string containing XML with cascade. [in] tag - an user defined tag. This tag will be inserted in output Object structure.
- Returns
- a result of this operation.
◆ Load()
bool Load | ( | const std::string & | path, |
Tag | tag = UNDEFINED_OBJECT_TAG |
||
) |
Loads from file classifier cascade. Supports OpenCV HAAR and LBP cascades type. You can call this function more than once if you want to use several object detectors at the same time.
- Note
- Tree based cascades and old cascade formats are not supported!
- Parameters
-
[in] path - a path to cascade. [in] tag - an user defined tag. This tag will be inserted in output Object structure.
- Returns
- a result of this operation.
◆ Init()
bool Init | ( | const Size & | imageSize, |
double | scaleFactor = 1.1 , |
||
const Size & | sizeMin = Size(0, 0) , |
||
const Size & | sizeMax = Size(INT_MAX, INT_MAX) , |
||
const View & | roi = View() , |
||
ptrdiff_t | threadNumber = -1 |
||
) |
Prepares Detection structure to work with image of given size.
- Parameters
-
[in] imageSize - a size of input image. [in] scaleFactor - a scale factor. To detect objects of different sizes the algorithm uses many scaled image. This parameter defines size difference between neighboring images. This parameter strongly affects to performance. [in] sizeMin - a minimal size of detected objects. This parameter strongly affects to performance. [in] sizeMax - a maximal size of detected objects. [in] roi - a 8-bit image mask which defines Region Of Interest. User can restricts detection region with using this mask. The mask affects to the center of detected object. [in] threadNumber - a number of work threads. It useful for multi core CPU. Use value -1 to auto choose of thread number.
- Returns
- a result of this operation.
◆ Detect()
bool Detect | ( | const View & | src, |
Objects & | objects, | ||
int | groupSizeMin = 3 , |
||
double | sizeDifferenceMax = 0.2 , |
||
bool | motionMask = false , |
||
const Rects & | motionRegions = Rects() |
||
) |
Detects objects at given image.
- Parameters
-
[in] src - a input image. [out] objects - detected objects. [in] groupSizeMin - a minimal weight (number of elementary detections) of detected image. [in] sizeDifferenceMax - a parameter to group elementary detections. [in] motionMask - an using of motion detection flag. Useful for dynamical restriction of detection region to addition to ROI. [in] motionRegions - a set of rectangles (motion regions) to restrict detection region to addition to ROI. The regions affect to the center of detected object.
- Returns
- a result of this operation.
Field Documentation
◆ UNDEFINED_OBJECT_TAG
|
static |
The undefined object tag.