Skip to content

Fix blur not drawing in shape for motion tracker - #1275

Open
doruphin wants to merge 1 commit into
mltframework:masterfrom
doruphin:tracker_draw_blur_in_shape
Open

Fix blur not drawing in shape for motion tracker#1275
doruphin wants to merge 1 commit into
mltframework:masterfrom
doruphin:tracker_draw_blur_in_shape

Conversation

@doruphin

Copy link
Copy Markdown

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:
Screenshot 2026-07-29 183017

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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);
@ddennedy
ddennedy requested a review from j-b-m July 30, 2026 20:18
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.

2 participants