1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Alekhin
2022-02-22 19:33:07 +00:00
256 changed files with 10503 additions and 5119 deletions
+9
View File
@@ -6,13 +6,16 @@
#include "opencv2/imgproc.hpp"
#include "opencv2/core.hpp"
#ifdef HAVE_OPENCV_DNN
#include "opencv2/dnn.hpp"
#endif
#include <algorithm>
namespace cv
{
#ifdef HAVE_OPENCV_DNN
class FaceDetectorYNImpl : public FaceDetectorYN
{
public:
@@ -273,6 +276,7 @@ private:
std::vector<Rect2f> priors;
};
#endif
Ptr<FaceDetectorYN> FaceDetectorYN::create(const String& model,
const String& config,
@@ -283,7 +287,12 @@ Ptr<FaceDetectorYN> FaceDetectorYN::create(const String& model,
const int backend_id,
const int target_id)
{
#ifdef HAVE_OPENCV_DNN
return makePtr<FaceDetectorYNImpl>(model, config, input_size, score_threshold, nms_threshold, top_k, backend_id, target_id);
#else
CV_UNUSED(model); CV_UNUSED(config); CV_UNUSED(input_size); CV_UNUSED(score_threshold); CV_UNUSED(nms_threshold); CV_UNUSED(top_k); CV_UNUSED(backend_id); CV_UNUSED(target_id);
CV_Error(cv::Error::StsNotImplemented, "cv::FaceDetectorYN requires enabled 'dnn' module.");
#endif
}
} // namespace cv
+10
View File
@@ -4,13 +4,17 @@
#include "precomp.hpp"
#include "opencv2/core.hpp"
#ifdef HAVE_OPENCV_DNN
#include "opencv2/dnn.hpp"
#endif
#include <algorithm>
namespace cv
{
#ifdef HAVE_OPENCV_DNN
class FaceRecognizerSFImpl : public FaceRecognizerSF
{
public:
@@ -173,10 +177,16 @@ private:
private:
dnn::Net net;
};
#endif
Ptr<FaceRecognizerSF> FaceRecognizerSF::create(const String& model, const String& config, int backend_id, int target_id)
{
#ifdef HAVE_OPENCV_DNN
return makePtr<FaceRecognizerSFImpl>(model, config, backend_id, target_id);
#else
CV_UNUSED(model); CV_UNUSED(config); CV_UNUSED(backend_id); CV_UNUSED(target_id);
CV_Error(cv::Error::StsNotImplemented, "cv::FaceRecognizerSF requires enabled 'dnn' module");
#endif
}
} // namespace cv
+6 -7
View File
@@ -42,7 +42,6 @@
#include "precomp.hpp"
#include "cascadedetect.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/core/hal/intrin.hpp"
#include "opencl_kernels_objdetect.hpp"
@@ -1887,7 +1886,7 @@ static bool ocl_detectMultiScale(InputArray _img, std::vector<Rect> &found_locat
void HOGDescriptor::detectMultiScale(
InputArray _img, std::vector<Rect>& foundLocations, std::vector<double>& foundWeights,
double hitThreshold, Size winStride, Size padding,
double scale0, double finalThreshold, bool useMeanshiftGrouping) const
double scale0, double groupThreshold, bool useMeanshiftGrouping) const
{
CV_INSTRUMENT_REGION();
@@ -1913,7 +1912,7 @@ void HOGDescriptor::detectMultiScale(
CV_OCL_RUN(_img.dims() <= 2 && _img.type() == CV_8UC1 && scale0 > 1 && winStride.width % blockStride.width == 0 &&
winStride.height % blockStride.height == 0 && padding == Size(0,0) && _img.isUMat(),
ocl_detectMultiScale(_img, foundLocations, levelScale, hitThreshold, winStride, finalThreshold, oclSvmDetector,
ocl_detectMultiScale(_img, foundLocations, levelScale, hitThreshold, winStride, groupThreshold, oclSvmDetector,
blockSize, cellSize, nbins, blockStride, winSize, gammaCorrection, L2HysThreshold, (float)getWinSigma(), free_coef, signedGradient));
std::vector<Rect> allCandidates;
@@ -1934,21 +1933,21 @@ void HOGDescriptor::detectMultiScale(
std::copy(tempWeights.begin(), tempWeights.end(), back_inserter(foundWeights));
if ( useMeanshiftGrouping )
groupRectangles_meanshift(foundLocations, foundWeights, foundScales, finalThreshold, winSize);
groupRectangles_meanshift(foundLocations, foundWeights, foundScales, groupThreshold, winSize);
else
groupRectangles(foundLocations, foundWeights, (int)finalThreshold, 0.2);
groupRectangles(foundLocations, foundWeights, (int)groupThreshold, 0.2);
clipObjects(imgSize, foundLocations, 0, &foundWeights);
}
void HOGDescriptor::detectMultiScale(InputArray img, std::vector<Rect>& foundLocations,
double hitThreshold, Size winStride, Size padding,
double scale0, double finalThreshold, bool useMeanshiftGrouping) const
double scale0, double groupThreshold, bool useMeanshiftGrouping) const
{
CV_INSTRUMENT_REGION();
std::vector<double> foundWeights;
detectMultiScale(img, foundLocations, foundWeights, hitThreshold, winStride,
padding, scale0, finalThreshold, useMeanshiftGrouping);
padding, scale0, groupThreshold, useMeanshiftGrouping);
}
std::vector<float> HOGDescriptor::getDefaultPeopleDetector()