mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #28217 from satyam102006:feature/dis-coarsest-scale
[video] Add setCoarsestScale to DISOpticalFlow (Fixes #25068) #28217 ### Description This PR addresses issue #25068 regarding the number of scales in `DISOpticalFlow`. Currently, `DISOpticalFlow` automatically computes the `coarsest_scale` based on the image size. While generally effective, this behavior can cause errors in specific use cases (e.g., mechanics/speckle pattern analysis) where high pyramid levels degrade quality. This change introduces a manual override: - Added `setCoarsestScale(int val)` and `getCoarsestScale()` to the public API. - Updated `DISOpticalFlowImpl::calc` and `ocl_calc` to use the user-defined scale if set. - Preserved the existing "automatic" behavior as the default (when set to -1). ### Changes - **`modules/video/include/opencv2/video/tracking.hpp`**: Added virtual method declarations. - **`modules/video/src/dis_flow.cpp`**: Implemented `set/getCoarsestScale` in `DISOpticalFlowImpl` and updated calculation logic. - **`modules/video/test/test_OF_accuracy.cpp`**: Added `DenseOpticalFlow_DIS.ManualCoarsestScale` regression test. Fixes #25068
This commit is contained in:
@@ -678,6 +678,16 @@ public:
|
||||
/** @copybrief getFinestScale @see getFinestScale */
|
||||
CV_WRAP virtual void setFinestScale(int val) = 0;
|
||||
|
||||
/** @brief Sets the coarsest scale
|
||||
@param val Coarsest level of the Gaussian pyramid on which the flow is computed.
|
||||
If set to -1, the auto-computed coarsest scale will be used.
|
||||
*/
|
||||
CV_WRAP virtual void setCoarsestScale(int val) = 0;
|
||||
|
||||
/** @brief Gets the coarsest scale
|
||||
*/
|
||||
CV_WRAP virtual int getCoarsestScale() const = 0;
|
||||
|
||||
/** @brief Size of an image patch for matching (in pixels). Normally, default 8x8 patches work well
|
||||
enough in most cases.
|
||||
@see setPatchSize */
|
||||
|
||||
Reference in New Issue
Block a user