diff --git a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp index 0a07e32f3c..98c4f0a79e 100644 --- a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp +++ b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp @@ -523,12 +523,12 @@ public: // Param gray is an input 1-channel gray image. // Param integrals is a vector of integrals. Hog-channels will be appended to it. // Param bins is a number of hog-bins - void appendHogBins(const cv::Mat gray, std::vector& integrals, int bins) const; + void appendHogBins(const cv::Mat& gray, std::vector& integrals, int bins) const; // Converts 3-channel BGR input frame in Luv and appends each channel to the integrals. // Param frame is an input 3-channel BGR colored image. // Param integrals is a vector of integrals. Computed from the frame luv-channels will be appended to it. - void appendLuvBins(const cv::Mat frame, std::vector& integrals) const; + void appendLuvBins(const cv::Mat& frame, std::vector& integrals) const; private: int shrinkage; @@ -539,7 +539,7 @@ public: // Param minScale is a maximum scale relative to the original size of the image on which cascade will be applyed. // Param scales is a number of scales from minScale to maxScale. // Param rejfactor is used for NMS. - SCascade(const float minScale = 0.4f, const float maxScale = 5.f, const int scales = 55, const int rejfactor = 1); + SCascade(const double minScale = 0.4, const double maxScale = 5., const int scales = 55, const int rejfactor = 1); virtual ~SCascade(); @@ -564,8 +564,9 @@ private: struct Fields; Fields* fields; - float minScale; - float maxScale; + double minScale; + double maxScale; + int scales; int rejfactor; }; diff --git a/modules/objdetect/src/icf.cpp b/modules/objdetect/src/icf.cpp index 0401a06236..416e5ffff0 100644 --- a/modules/objdetect/src/icf.cpp +++ b/modules/objdetect/src/icf.cpp @@ -44,7 +44,7 @@ cv::SCascade::Channels::Channels(int shr) : shrinkage(shr) {} -void cv::SCascade::Channels::appendHogBins(const cv::Mat gray, std::vector& integrals, int bins) const +void cv::SCascade::Channels::appendHogBins(const cv::Mat& gray, std::vector& integrals, int bins) const { CV_Assert(gray.type() == CV_8UC1); int h = gray.rows; @@ -92,7 +92,7 @@ void cv::SCascade::Channels::appendHogBins(const cv::Mat gray, std::vector& integrals) const +void cv::SCascade::Channels::appendLuvBins(const cv::Mat& frame, std::vector& integrals) const { CV_Assert(frame.type() == CV_8UC3); CV_Assert(!(frame.cols % shrinkage) && !(frame.rows % shrinkage)); diff --git a/modules/objdetect/src/softcascade.cpp b/modules/objdetect/src/softcascade.cpp index 985655a362..134fa9b2ca 100644 --- a/modules/objdetect/src/softcascade.cpp +++ b/modules/objdetect/src/softcascade.cpp @@ -296,10 +296,10 @@ struct cv::SCascade::Fields void calcLevels(const cv::Size& curr, float mins, float maxs, int total) { if (frameSize == curr && maxs == maxScale && mins == minScale && total == scales) return; - CV_Assert(scales > 1); frameSize = curr; maxScale = maxs; minScale = mins; scales = total; + CV_Assert(scales > 1); levels.clear(); float logFactor = (log(maxScale) - log(minScale)) / (scales -1); @@ -415,7 +415,7 @@ struct cv::SCascade::Fields } }; -cv::SCascade::SCascade(const float mins, const float maxs, const int nsc, const int rej) +cv::SCascade::SCascade(const double mins, const double maxs, const int nsc, const int rej) : fields(0), minScale(mins), maxScale(maxs), scales(nsc), rejfactor(rej) {} cv::SCascade::~SCascade() { delete fields;} @@ -462,7 +462,7 @@ void cv::SCascade::detect(cv::InputArray _image, cv::InputArray _rois, std::vect CV_Assert(image.type() == CV_8UC3); Fields& fld = *fields; - fld.calcLevels(image.size(),minScale, maxScale, scales); + fld.calcLevels(image.size(),(float) minScale, (float)maxScale, (float)scales); objects.clear();