Fix blur not drawing in shape for motion tracker - #1275
Open
doruphin wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the OpenCV motion-tracker filter’s blur rendering so the blur can be applied using the selected overlay shape (not always as a rectangle), addressing shape-specific blur rendering issues (notably for the ellipse).
Changes:
- Refactors blur application to operate on an ROI buffer (
blurredRoi) and then composite back into the frame. - Applies a shape mask for ellipse blur so only pixels inside the ellipse are blurred.
- Adds control flow (
do_blur) to skip blur compositing for blur modes that should not modify the ROI (e.g., opaque fill).
Comment on lines
+471
to
+474
| cv::Mat roi = cvFrame(data->boundingBox); | ||
| cv::Mat blurredRoi; | ||
| roi.copyTo(blurredRoi); | ||
| bool do_blur = true; |
| data->boundingBox.height / 2.0f), | ||
| cv::Size2f(data->boundingBox.width, data->boundingBox.height), | ||
| 0); | ||
| cv::ellipse(mask, bounding, cv::Scalar(255), -1, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was originally brought up in Kdenlive.
Rather than always drawing the blur as a rectangle, it now holds it in a buffer and then applies it in the designated shape. Right now, this only really affects the eclipse shape since it's the only odd shape out.
Example:
