mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #26836 from chacha21:thresholding_compute_threshold_only
Add cv::THRESH_DRYRUN flag to get adaptive threshold values without thresholding #26836 A first proposal for #26777 Adds a `cv::THRESH_DRYRUN` flag to let cv::threshold() compute the threshold (useful for OTSU/TRIANGLE), but without actually running the thresholding. This flags is a proposal instead of a new function cv::computeThreshold() - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [X] The PR is proposed to the proper branch - [X] There is a reference to the original bug report and related work - [X] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -329,7 +329,8 @@ enum ThresholdTypes {
|
||||
THRESH_TOZERO_INV = 4, //!< \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f]
|
||||
THRESH_MASK = 7,
|
||||
THRESH_OTSU = 8, //!< flag, use Otsu algorithm to choose the optimal threshold value
|
||||
THRESH_TRIANGLE = 16 //!< flag, use Triangle algorithm to choose the optimal threshold value
|
||||
THRESH_TRIANGLE = 16, //!< flag, use Triangle algorithm to choose the optimal threshold value
|
||||
THRESH_DRYRUN = 128 //!< flag, compute threshold only (useful for OTSU/TRIANGLE) but does not actually run thresholding
|
||||
};
|
||||
|
||||
//! adaptive threshold algorithm
|
||||
|
||||
@@ -610,9 +610,11 @@ enum
|
||||
CV_THRESH_MASK =7,
|
||||
CV_THRESH_OTSU =8, /**< use Otsu algorithm to choose the optimal threshold value;
|
||||
combine the flag with one of the above CV_THRESH_* values */
|
||||
CV_THRESH_TRIANGLE =16 /**< use Triangle algorithm to choose the optimal threshold value;
|
||||
CV_THRESH_TRIANGLE =16, /**< use Triangle algorithm to choose the optimal threshold value;
|
||||
combine the flag with one of the above CV_THRESH_* values, but not
|
||||
with CV_THRESH_OTSU */
|
||||
CV_THRESH_DRYRUN =128 /**< compute threshold only (useful for OTSU/TRIANGLE) but does not
|
||||
actually run thresholding */
|
||||
};
|
||||
|
||||
/** Adaptive threshold methods */
|
||||
|
||||
Reference in New Issue
Block a user