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

Improved Tracker & Object Detector Effects (Faster Drawing, Corner Radius, New Style) #950

Merged
merged 15 commits into from
Mar 26, 2024

Conversation

jonoomph
Copy link
Member

@jonoomph jonoomph commented Feb 23, 2024

Related to this PR: OpenShot/openshot-qt#5430

Improvements:

  • Added "Parent" badge to any clip with a parent set (on timeline for clarity)

  • Fixed class_filter in property window to allow for:

    • empty (to reset the filter)
    • commas between classes work better (i.e. "truck, person")
    • allow spaces on either side of the class names (i.e. " truck , person ")
    • Ignore case of class names entered by user
  • Background Corner Radius: allow up to 150

  • Updated Object Detector to output "class_name: object id" as the format (instead of confidence decimal) - easier to identify and select object in properties.

  • Removed "Child Clip ID" from Tracker and Object Detector Effect. "Parent" is now the only supported method of attaching clips to tracked objects.

  • Made certain properties read-only (X1, X2, Y1, Y2, etc...)

  • Fixed invalid background_alpha and stroke_alpha properties (reversed range... it was backwards)

  • Added new Display All Boxes property, which affects all Object Detector tracked boxes with a single property

  • Lots of refactoring and simplifying (i've removed 2 times as much code as I've added in this PR)

  • Refactored clip caching:

    • Prevent black backgrounds (however, when using "Parent" to a tracked object, the timeline Track order does matter. Example, if you want something on top of the tracked object, it must be on a layer above the tracked object. If you have a clip below a tracked object, it will be drawn under it (and might be hidden).
    • Simplified some caching code (much easier to follow)
    • Clips still cache their Frame object, but no longer cache them flattened with the previous timeline layers

Refactor Object Detector with QPainter (support for corner radius, faster drawing performance)
OpenShot-Object-Detector-Radius

Refactor Tracker with QPainter (support for corner radius, faster drawing performance)
OpenShot-Tracker-Radius

- Draw Tracker boxes using QPainter and support corner radius (and faster drawing performance by drawing directly on the frame)
- Draw child clips with correct aspect ratio
- Adding "Yes/No" options for "Visible" and "Draw Box" Tracked Object Box keyframes
- default to invisible background
- default to 12 corner radius
- default to 50% stroke alpha
- Draw bounding boxes using QPainter and support corner radius (and faster drawing performance by drawing directly on the frame)
- Draw child clips with correct aspect ratio
- Adding "Yes/No" option for "Draw Text"
- default to fully opaque stroke
Copy link

codecov bot commented Feb 23, 2024

Codecov Report

Attention: Patch coverage is 33.76623% with 153 lines in your changes are missing coverage. Please review.

Project coverage is 54.26%. Comparing base (284904d) to head (5a0a6a6).

Files Patch % Lines
src/effects/ObjectDetection.cpp 0.00% 89 Missing ⚠️
src/effects/Tracker.cpp 0.00% 29 Missing ⚠️
src/Clip.cpp 73.25% 23 Missing ⚠️
src/TrackedObjectBBox.cpp 30.76% 9 Missing ⚠️
src/KeyFrame.cpp 66.66% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #950      +/-   ##
===========================================
+ Coverage    53.93%   54.26%   +0.32%     
===========================================
  Files          182      182              
  Lines        16649    16505     -144     
===========================================
- Hits          8980     8956      -24     
+ Misses        7669     7549     -120     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…evious layers, replace std::shared_ptr<openshot::Frame> with QSize for a few arguments to make it much more clear what is happening.
…a circle in my testing). Also, ignoring case of class_filter on Object Detection effect.
…d of the confidence score. This is way more useful, so you can find the object in the properties menu. Also, output the visible class names as well, so the property editor can display them in a context menu.
…o tracker or object detection effects: Use clip->Parent to attach clips to tracked objects now.
…ent clip can be scaled and moved without breaking the tracking. Also refactoring out unneeded complex code left over.
… late-bound check, to ensure we have attached the clip on first call.
…n is of varying aspect ratios (since the parent clip and tracked object can change over time). Clips which are parented to tracked objects now respect the scale_type (i.e. best fit, stretch, etc...).
… difficult to turn off each individual box. Made "visible" property read-only on Tracker & Object Detector effects. Improve Keyframe::SetJsonValue method to accept an object or a float.
@jonoomph jonoomph merged commit a9e34a9 into develop Mar 26, 2024
12 of 13 checks passed
@jonoomph jonoomph deleted the invalid-tracker-region branch March 26, 2024 18:49
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.

None yet

1 participant