move gpu version of soft cascade to dedicated module
This commit is contained in:
@@ -212,6 +212,96 @@ public:
|
||||
|
||||
CV_EXPORTS bool initModule_softcascade(void);
|
||||
|
||||
// ======================== GPU version for soft cascade ===================== //
|
||||
|
||||
class CV_EXPORTS ChannelsProcessor
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
GENERIC = 1 << 4,
|
||||
SEPARABLE = 2 << 4
|
||||
};
|
||||
|
||||
// Appends specified number of HOG first-order features integrals into given vector.
|
||||
// Param frame is an input 3-channel bgr image.
|
||||
// Param channels is a GPU matrix of optionally shrinked channels
|
||||
// Param stream is stream is a high-level CUDA stream abstraction used for asynchronous execution.
|
||||
virtual void apply(InputArray frame, OutputArray channels, cv::gpu::Stream& stream = cv::gpu::Stream::Null()) = 0;
|
||||
|
||||
// Creates a specific preprocessor implementation.
|
||||
// Param shrinkage is a resizing factor. Resize is applied before the computing integral sum
|
||||
// Param bins is a number of HOG-like channels.
|
||||
// Param flags is a channel computing extra flags.
|
||||
static cv::Ptr<ChannelsProcessor> create(const int shrinkage, const int bins, const int flags = GENERIC);
|
||||
|
||||
virtual ~ChannelsProcessor();
|
||||
|
||||
protected:
|
||||
ChannelsProcessor();
|
||||
};
|
||||
|
||||
// Implementation of soft (stage-less) cascaded detector.
|
||||
class CV_EXPORTS SCascade : public cv::Algorithm
|
||||
{
|
||||
public:
|
||||
|
||||
// Representation of detectors result.
|
||||
struct CV_EXPORTS Detection
|
||||
{
|
||||
ushort x;
|
||||
ushort y;
|
||||
ushort w;
|
||||
ushort h;
|
||||
float confidence;
|
||||
int kind;
|
||||
|
||||
enum {PEDESTRIAN = 0};
|
||||
};
|
||||
|
||||
enum { NO_REJECT = 1, DOLLAR = 2, /*PASCAL = 4,*/ DEFAULT = NO_REJECT, NMS_MASK = 0xF};
|
||||
|
||||
// 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 applied.
|
||||
// Param minScale is a maximum scale relative to the original size of the image on which cascade will be applied.
|
||||
// Param scales is a number of scales from minScale to maxScale.
|
||||
// Param flags is an extra tuning flags.
|
||||
SCascade(const double minScale = 0.4, const double maxScale = 5., const int scales = 55,
|
||||
const int flags = NO_REJECT || ChannelsProcessor::GENERIC);
|
||||
|
||||
virtual ~SCascade();
|
||||
|
||||
cv::AlgorithmInfo* info() const;
|
||||
|
||||
// Load cascade from FileNode.
|
||||
// Param fn is a root node for cascade. Should be <cascade>.
|
||||
virtual bool load(const FileNode& fn);
|
||||
|
||||
// Load cascade config.
|
||||
virtual void read(const FileNode& fn);
|
||||
|
||||
// Return the matrix of of detected objects.
|
||||
// Param image is a frame on which detector will be applied.
|
||||
// Param rois is a regions of interests mask generated by genRoi.
|
||||
// Only the objects that fall into one of the regions will be returned.
|
||||
// Param objects is an output array of Detections represented as GpuMat of detections (SCascade::Detection)
|
||||
// The first element of the matrix is actually a count of detections.
|
||||
// Param stream is stream is a high-level CUDA stream abstraction used for asynchronous execution
|
||||
virtual void detect(InputArray image, InputArray rois, OutputArray objects, cv::gpu::Stream& stream = cv::gpu::Stream::Null()) const;
|
||||
|
||||
private:
|
||||
|
||||
struct Fields;
|
||||
Fields* fields;
|
||||
|
||||
double minScale;
|
||||
double maxScale;
|
||||
int scales;
|
||||
|
||||
int flags;
|
||||
};
|
||||
|
||||
|
||||
}} // namespace cv { namespace softcascade {
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user