mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Instrumentation for OpenCV API regions and IPP functions;
This commit is contained in:
@@ -59,6 +59,8 @@ template<typename _Tp> void copyVectorToUMat(const std::vector<_Tp>& v, UMat& um
|
||||
void groupRectangles(std::vector<Rect>& rectList, int groupThreshold, double eps,
|
||||
std::vector<int>* weights, std::vector<double>* levelWeights)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( groupThreshold <= 0 || rectList.empty() )
|
||||
{
|
||||
if( weights )
|
||||
@@ -359,23 +361,31 @@ static void groupRectangles_meanshift(std::vector<Rect>& rectList, double detect
|
||||
|
||||
void groupRectangles(std::vector<Rect>& rectList, int groupThreshold, double eps)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
groupRectangles(rectList, groupThreshold, eps, 0, 0);
|
||||
}
|
||||
|
||||
void groupRectangles(std::vector<Rect>& rectList, std::vector<int>& weights, int groupThreshold, double eps)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
groupRectangles(rectList, groupThreshold, eps, &weights, 0);
|
||||
}
|
||||
//used for cascade detection algorithm for ROC-curve calculating
|
||||
void groupRectangles(std::vector<Rect>& rectList, std::vector<int>& rejectLevels,
|
||||
std::vector<double>& levelWeights, int groupThreshold, double eps)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
groupRectangles(rectList, groupThreshold, eps, &rejectLevels, &levelWeights);
|
||||
}
|
||||
//can be used for HOG detection algorithm only
|
||||
void groupRectangles_meanshift(std::vector<Rect>& rectList, std::vector<double>& foundWeights,
|
||||
std::vector<double>& foundScales, double detectThreshold, Size winDetSize)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
groupRectangles_meanshift(rectList, detectThreshold, &foundWeights, foundScales, winDetSize);
|
||||
}
|
||||
|
||||
@@ -1217,6 +1227,8 @@ void CascadeClassifierImpl::detectMultiScaleNoGrouping( InputArray _image, std::
|
||||
double scaleFactor, Size minObjectSize, Size maxObjectSize,
|
||||
bool outputRejectLevels )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Size imgsz = _image.size();
|
||||
|
||||
Mat grayImage;
|
||||
@@ -1320,6 +1332,8 @@ void CascadeClassifierImpl::detectMultiScale( InputArray _image, std::vector<Rec
|
||||
int flags, Size minObjectSize, Size maxObjectSize,
|
||||
bool outputRejectLevels )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( scaleFactor > 1 && _image.depth() == CV_8U );
|
||||
|
||||
if( empty() )
|
||||
@@ -1352,6 +1366,8 @@ void CascadeClassifierImpl::detectMultiScale( InputArray _image, std::vector<Rec
|
||||
double scaleFactor, int minNeighbors,
|
||||
int flags, Size minObjectSize, Size maxObjectSize)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<int> fakeLevels;
|
||||
std::vector<double> fakeWeights;
|
||||
detectMultiScale( _image, objects, fakeLevels, fakeWeights, scaleFactor,
|
||||
@@ -1363,6 +1379,8 @@ void CascadeClassifierImpl::detectMultiScale( InputArray _image, std::vector<Rec
|
||||
int minNeighbors, int flags, Size minObjectSize,
|
||||
Size maxObjectSize )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Mat image = _image.getMat();
|
||||
CV_Assert( scaleFactor > 1 && image.depth() == CV_8U );
|
||||
|
||||
@@ -1636,6 +1654,8 @@ void CascadeClassifier::detectMultiScale( InputArray image,
|
||||
Size minSize,
|
||||
Size maxSize )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert(!empty());
|
||||
cc->detectMultiScale(image, objects, scaleFactor, minNeighbors, flags, minSize, maxSize);
|
||||
clipObjects(image.size(), objects, 0, 0);
|
||||
@@ -1648,6 +1668,8 @@ void CascadeClassifier::detectMultiScale( InputArray image,
|
||||
int minNeighbors, int flags,
|
||||
Size minSize, Size maxSize )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert(!empty());
|
||||
cc->detectMultiScale(image, objects, numDetections,
|
||||
scaleFactor, minNeighbors, flags, minSize, maxSize);
|
||||
@@ -1663,6 +1685,8 @@ void CascadeClassifier::detectMultiScale( InputArray image,
|
||||
Size minSize, Size maxSize,
|
||||
bool outputRejectLevels )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert(!empty());
|
||||
cc->detectMultiScale(image, objects, rejectLevels, levelWeights,
|
||||
scaleFactor, minNeighbors, flags,
|
||||
|
||||
@@ -618,6 +618,8 @@ cv::DetectionBasedTracker::~DetectionBasedTracker()
|
||||
|
||||
void DetectionBasedTracker::process(const Mat& imageGray)
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert(imageGray.type()==CV_8UC1);
|
||||
|
||||
if ( separateDetectionWork && !separateDetectionWork->isWorking() ) {
|
||||
|
||||
@@ -1275,6 +1275,8 @@ CV_IMPL int
|
||||
cvRunHaarClassifierCascade( const CvHaarClassifierCascade* _cascade,
|
||||
CvPoint pt, int start_stage )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
double stage_sum;
|
||||
return cvRunHaarClassifierCascadeSum(_cascade, pt, stage_sum, start_stage);
|
||||
}
|
||||
@@ -1308,6 +1310,8 @@ public:
|
||||
|
||||
void operator()( const Range& range ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
Size winSize0 = cascade->orig_window_size;
|
||||
Size winSize(cvRound(winSize0.width*factor), cvRound(winSize0.height*factor));
|
||||
int y1 = range.start*stripSize, y2 = std::min(range.end*stripSize, sum1.rows - 1 - winSize0.height);
|
||||
@@ -1322,10 +1326,10 @@ public:
|
||||
if(CV_IPP_CHECK_COND && cascade->hid_cascade->ipp_stages )
|
||||
{
|
||||
IppiRect iequRect = {equRect.x, equRect.y, equRect.width, equRect.height};
|
||||
ippiRectStdDev_32f_C1R(sum1.ptr<float>(y1), (int)sum1.step,
|
||||
CV_INSTRUMENT_FUN_IPP(ippiRectStdDev_32f_C1R, sum1.ptr<float>(y1), (int)sum1.step,
|
||||
sqsum1.ptr<double>(y1), (int)sqsum1.step,
|
||||
norm1->ptr<float>(y1), (int)norm1->step,
|
||||
ippiSize(ssz.width, ssz.height), iequRect );
|
||||
ippiSize(ssz.width, ssz.height), iequRect);
|
||||
|
||||
int positive = (ssz.width/ystep)*((ssz.height + ystep-1)/ystep);
|
||||
|
||||
@@ -1344,7 +1348,7 @@ public:
|
||||
|
||||
for( int j = 0; j < cascade->count; j++ )
|
||||
{
|
||||
if( ippiApplyHaarClassifier_32f_C1R(
|
||||
if (CV_INSTRUMENT_FUN_IPP(ippiApplyHaarClassifier_32f_C1R,
|
||||
sum1.ptr<float>(y1), (int)sum1.step,
|
||||
norm1->ptr<float>(y1), (int)norm1->step,
|
||||
mask1->ptr<uchar>(y1), (int)mask1->step,
|
||||
@@ -1441,6 +1445,8 @@ public:
|
||||
|
||||
void operator()( const Range& range ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int iy, startY = range.start, endY = range.end;
|
||||
const int *p0 = p[0], *p1 = p[1], *p2 = p[2], *p3 = p[3];
|
||||
const int *pq0 = pq[0], *pq1 = pq[1], *pq2 = pq[2], *pq3 = pq[3];
|
||||
@@ -1500,6 +1506,8 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
|
||||
double scaleFactor, int minNeighbors, int flags,
|
||||
CvSize minSize, CvSize maxSize, bool outputRejectLevels )
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
const double GROUP_EPS = 0.2;
|
||||
CvMat stub, *img = (CvMat*)_img;
|
||||
cv::Ptr<CvMat> temp, sum, tilted, sqsum, normImg, sumcanny, imgSmall;
|
||||
|
||||
@@ -236,6 +236,8 @@ inline float32x4_t vsetq_f32(float f0, float f1, float f2, float f3)
|
||||
void HOGDescriptor::computeGradient(const Mat& img, Mat& grad, Mat& qangle,
|
||||
Size paddingTL, Size paddingBR) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
CV_Assert( img.type() == CV_8U || img.type() == CV_8UC3 );
|
||||
|
||||
Size gradsize(img.cols + paddingTL.width + paddingBR.width,
|
||||
@@ -1582,6 +1584,8 @@ static bool ocl_compute(InputArray _img, Size win_stride, std::vector<float>& _d
|
||||
void HOGDescriptor::compute(InputArray _img, std::vector<float>& descriptors,
|
||||
Size winStride, Size padding, const std::vector<Point>& locations) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( winStride == Size() )
|
||||
winStride = cellSize;
|
||||
Size cacheStride(gcd(winStride.width, blockStride.width),
|
||||
@@ -1647,6 +1651,8 @@ void HOGDescriptor::detect(const Mat& img,
|
||||
std::vector<Point>& hits, std::vector<double>& weights, double hitThreshold,
|
||||
Size winStride, Size padding, const std::vector<Point>& locations) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
hits.clear();
|
||||
weights.clear();
|
||||
if( svmDetector.empty() )
|
||||
@@ -1758,6 +1764,8 @@ void HOGDescriptor::detect(const Mat& img,
|
||||
void HOGDescriptor::detect(const Mat& img, std::vector<Point>& hits, double hitThreshold,
|
||||
Size winStride, Size padding, const std::vector<Point>& locations) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<double> weightsV;
|
||||
detect(img, hits, weightsV, hitThreshold, winStride, padding, locations);
|
||||
}
|
||||
@@ -2040,6 +2048,8 @@ void HOGDescriptor::detectMultiScale(
|
||||
double hitThreshold, Size winStride, Size padding,
|
||||
double scale0, double finalThreshold, bool useMeanshiftGrouping) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
double scale = 1.;
|
||||
int levels = 0;
|
||||
|
||||
@@ -2093,6 +2103,8 @@ void HOGDescriptor::detectMultiScale(InputArray img, std::vector<Rect>& foundLoc
|
||||
double hitThreshold, Size winStride, Size padding,
|
||||
double scale0, double finalThreshold, bool useMeanshiftGrouping) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<double> foundWeights;
|
||||
detectMultiScale(img, foundLocations, foundWeights, hitThreshold, winStride,
|
||||
padding, scale0, finalThreshold, useMeanshiftGrouping);
|
||||
@@ -3489,6 +3501,8 @@ public:
|
||||
|
||||
void operator()( const Range& range ) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
int i, i1 = range.start, i2 = range.end;
|
||||
|
||||
Size maxSz(cvCeil(img.cols/(*locations)[0].scale), cvCeil(img.rows/(*locations)[0].scale));
|
||||
@@ -3531,6 +3545,8 @@ void HOGDescriptor::detectROI(const cv::Mat& img, const std::vector<cv::Point> &
|
||||
CV_OUT std::vector<cv::Point>& foundLocations, CV_OUT std::vector<double>& confidences,
|
||||
double hitThreshold, cv::Size winStride, cv::Size padding) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
foundLocations.clear();
|
||||
confidences.clear();
|
||||
|
||||
@@ -3641,6 +3657,8 @@ void HOGDescriptor::detectMultiScaleROI(const cv::Mat& img,
|
||||
CV_OUT std::vector<cv::Rect>& foundLocations, std::vector<DetectionROI>& locations,
|
||||
double hitThreshold, int groupThreshold) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
std::vector<Rect> allCandidates;
|
||||
Mutex mtx;
|
||||
|
||||
@@ -3747,6 +3765,8 @@ void HOGDescriptor::readALTModel(String modelfile)
|
||||
|
||||
void HOGDescriptor::groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const
|
||||
{
|
||||
CV_INSTRUMENT_REGION()
|
||||
|
||||
if( groupThreshold <= 0 || rectList.empty() )
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user