diff --git a/modules/objdetect/include/opencv2/objdetect.hpp b/modules/objdetect/include/opencv2/objdetect.hpp index 7c7f7d90d3..031f1fbf99 100644 --- a/modules/objdetect/include/opencv2/objdetect.hpp +++ b/modules/objdetect/include/opencv2/objdetect.hpp @@ -376,7 +376,7 @@ public: }; enum { DEFAULT_NLEVELS = 64 //!< Default nlevels value. }; - /**@brief Creates the HOG descriptor and detector with default params. + /**@brief Creates the HOG descriptor and detector with default parameters. aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9, 1 ) */ @@ -412,6 +412,8 @@ public: {} /** @overload + + Creates the HOG descriptor and detector and loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file. @param filename the file name containing HOGDescriptor properties and coefficients of the trained classifier */ CV_WRAP HOGDescriptor(const String& filename) @@ -450,24 +452,24 @@ public: */ CV_WRAP virtual void setSVMDetector(InputArray _svmdetector); - /** @brief Reads HOGDescriptor parameters from a file node. + /** @brief Reads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file node. @param fn File node */ virtual bool read(FileNode& fn); - /** @brief Stores HOGDescriptor parameters in a file storage. + /** @brief Stores HOGDescriptor parameters and coefficients for the linear SVM classifier in a file storage. @param fs File storage @param objname Object name */ virtual void write(FileStorage& fs, const String& objname) const; - /** @brief loads coefficients for the linear SVM classifier from a file + /** @brief loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file @param filename Name of the file to read. @param objname The optional name of the node to read (if empty, the first top-level node will be used). */ CV_WRAP virtual bool load(const String& filename, const String& objname = String()); - /** @brief saves coefficients for the linear SVM classifier to a file + /** @brief saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file @param filename File name @param objname Object name */ @@ -535,13 +537,14 @@ public: @param winStride Window stride. It must be a multiple of block stride. @param padding Padding @param scale Coefficient of the detection window increase. - @param finalThreshold Final threshold + @param groupThreshold Coefficient to regulate the similarity threshold. When detected, some objects can be covered + by many rectangles. 0 means not to perform grouping. @param useMeanshiftGrouping indicates grouping algorithm */ CV_WRAP virtual void detectMultiScale(InputArray img, CV_OUT std::vector& foundLocations, CV_OUT std::vector& foundWeights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), double scale = 1.05, - double finalThreshold = 2.0,bool useMeanshiftGrouping = false) const; + double groupThreshold = 2.0, bool useMeanshiftGrouping = false) const; /** @brief Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. @@ -553,13 +556,14 @@ public: @param winStride Window stride. It must be a multiple of block stride. @param padding Padding @param scale Coefficient of the detection window increase. - @param finalThreshold Final threshold + @param groupThreshold Coefficient to regulate the similarity threshold. When detected, some objects can be covered + by many rectangles. 0 means not to perform grouping. @param useMeanshiftGrouping indicates grouping algorithm */ virtual void detectMultiScale(InputArray img, CV_OUT std::vector& foundLocations, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), double scale = 1.05, - double finalThreshold = 2.0, bool useMeanshiftGrouping = false) const; + double groupThreshold = 2.0, bool useMeanshiftGrouping = false) const; /** @brief Computes gradients and quantized gradient orientations. @param img Matrix contains the image to be computed diff --git a/modules/objdetect/src/hog.cpp b/modules/objdetect/src/hog.cpp index 1ff2191dd0..aa468acfee 100644 --- a/modules/objdetect/src/hog.cpp +++ b/modules/objdetect/src/hog.cpp @@ -1884,7 +1884,7 @@ static bool ocl_detectMultiScale(InputArray _img, std::vector &found_locat void HOGDescriptor::detectMultiScale( InputArray _img, std::vector& foundLocations, std::vector& foundWeights, double hitThreshold, Size winStride, Size padding, - double scale0, double finalThreshold, bool useMeanshiftGrouping) const + double scale0, double groupThreshold, bool useMeanshiftGrouping) const { CV_INSTRUMENT_REGION(); @@ -1910,7 +1910,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 allCandidates; @@ -1931,21 +1931,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& 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 foundWeights; detectMultiScale(img, foundLocations, foundWeights, hitThreshold, winStride, - padding, scale0, finalThreshold, useMeanshiftGrouping); + padding, scale0, groupThreshold, useMeanshiftGrouping); } template struct RTTIImpl