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

Effect parenting #649

Merged
merged 99 commits into from
Jun 1, 2021
Merged

Effect parenting #649

merged 99 commits into from
Jun 1, 2021

Conversation

BrennoCaldato
Copy link
Collaborator

@BrennoCaldato BrennoCaldato commented Mar 23, 2021

This PR adds in functionalities for using the new OpenCV-related effects. The main functionalities are:

  • Added transform handlers for the Tracker and Object Detection effects. The user can now modify and correct the tracked objects.
  • Fixed Tracker initial bounding box selection window
  • Allow the user to animate Clips or Images with the tracked objects. The clip will be transformed to follow the tracked object
  • Allow parenting clips. The transformations applied to a clip can be replicated to other clips.
  • Effects can be parented and replicated to other clips.
  • Improved usability of Tracker effect

A TrackedObjectBase class was created to handle custom objects and interact with them. TrackedObjectBBox allows storing and manipulating the bounding box information of a tracked object. The base class can be further extended to other objects such as facial tracking, body joints, etc.

Related to OpenShot/openshot-qt#4058

Tracker and ObjectDetection transform handlers:
image

Clip attached to a tracked object
image

Effect parenting
image

Object Detection with transform handlers
image

The keyframe collections would better integrate with effects that uses bounding boxes, skeletons and facial points.
(still needs some fine-tuning)
It's now possible to adjust the tracked bounding box from the preview window. Some work is needed to make it generic to the ObjectDetection effect and future effects
-Moved the methods that handles protobuf data from Tracker to KeyframeBBox
-Displacement and scale keyframes are now properties of KeyframeBBox
-Changed interface that updates the KeyframeBBox properties.
Changed the bounding-box struct point convention to (cx, cy, width, height, angle).
The GetFrame member function from Tracker class now uses the cv::RotatedRect object to represent the bounding-box and draw it on screen.
The JSON and Protobuf communication between the backend and frontend still uses the (x1,y1)(x2,y2) point convention, the backend performs the adequate transformations.
- Added KeyframeBase class
- Adjusted the inheritance of KeyframeBase to KeyframeBBox and Keyframe
- Added feature to attach clip to bounding box
- Added support to select tracked object with a dropdown list and removed keyframebbox downcasting
Modified Clip.cpp PropertiesJSON function and applied minor fixes to Keyframe_Tests
The Clip's Keyframes are no longer modified when it's attached to an object, and the bounding-box properties are requested by the Timeline's frame, not the Clip's frame.
Added new base class TrackedObjectBase, changed class KeyframeBBox to TrackedObjectBBox and changes it's inheritance from KeyframeBase to TrackedObjectBase.
Fixed bug that caused the clip to not attach correctly if the tracked object's parent clip wasn't in the position 0 of the timeline.
Fixed bug that caused the wrong scale adjustment when an emoji or picture was attached to a tracked object.
Fixed bug that caused the tracked object bounding box to be incorrectly updated when the user interacted with it's transform handler.
Fixed bug that made Openshot crash if two or more Tracker effects were added to the same video.
Fixed bug that made the clips to be incorrectly attached to tracked objects in the exported video.
Added "has_tracked_object" property on EffectBase so that the AddEffect function checks for this property instead of the Tracker effect name - this way it's possible to support other effects that have tracked objects but different names.
This feature let's the user attach a clip to an object detected by the Object Detection effect, in the same way it is done with the Tracker Effect.
Added support to show transform handlers for the bounding-boxes (Tracked Objects) detected by the Object Detection effect and update their Keyframes.
Only show the tracked object's icon (on the mini-GUI to attach a clip to it) and transform handler if the object appears on the screen (i.e. it has data for the requested frame)
@github-actions
Copy link

github-actions bot commented May 4, 2021

Merge conflicts have been detected on this PR, please resolve.

@github-actions github-actions bot added the conflicts A PR with unresolved merge conflicts label May 4, 2021
// Make sure the trackedData is empty
trackedDataById.clear();
// Draw the child clip image inside the bounding-box
painter.drawImage(boxRect, *childClipImage, QRectF(0, 0, frameImage.size().width(), frameImage.size().height()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
painter.drawImage(boxRect, *childClipImage, QRectF(0, 0, frameImage.size().width(), frameImage.size().height()));
painter.drawImage(boxRect, *childClipImage, QRectF(frameImage.rect()));

(Though, if you're drawing the entire image, I don't think this is necessary. If I'm not mistaken, QImage's drawImage() defaults to drawing the entire source image in the area specified, scaled accordingly. So that would make this equivalent):

painter.drawImage(boxRect, *childClipImage);

@github-actions github-actions bot removed the conflicts A PR with unresolved merge conflicts label May 6, 2021
@github-actions github-actions bot added the conflicts A PR with unresolved merge conflicts label May 20, 2021
@github-actions
Copy link

Merge conflicts have been detected on this PR, please resolve.

@github-actions github-actions bot removed the conflicts A PR with unresolved merge conflicts label May 30, 2021
@BrennoCaldato
Copy link
Collaborator Author

@jonoomph following our last call I am merging this branch with develop. It's a big one. Fingers crossed

@BrennoCaldato BrennoCaldato merged commit eb4e1a0 into develop Jun 1, 2021
@jonoomph jonoomph deleted the effect-parenting branch August 24, 2021 03:47
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.

3 participants