Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix opencv_contrib issue #2941 #3606

Open
wants to merge 3 commits into
base: 4.x
Choose a base branch
from

Conversation

Chester-zZz
Copy link
Contributor

fix #2941

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • 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

@asmorkalov asmorkalov self-requested a review December 26, 2023 14:02
@Chester-zZz
Copy link
Contributor Author

anything else i can do to continue the merging process? or i can just wait? @asmorkalov

if (nframes_ == 0) {
constantsHost_.varMin_ = (float)varMin;
} else {
constantsHost_.varMin_ = ::fminf((float)varMin, constantsHost_.varMax_);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still buggy. Bug is in API itself.

Good API should configure min/max at once through single call (using cv::Range).

Or setting min should set the min and adjust the MAX value (instead of min).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Since constantsHost_ will be upload to gpu in initialize, i can just compare them in initialize. and keep the setVarXXX method simple.

float real_varMin = ::fminf(constantsHost_.varMin_, constantsHost_.varMax_);
float real_varMax = ::fmaxf(constantsHost_.varMin_, constantsHost_.varMax_);
constantsHost_.varMin_ = real_varMin;
constantsHost_.varMax_ = real_varMax;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cuda::BackgroundSubtractorMOG2 gives different results after 4.2.0
2 participants