Skip to content

Commit

Permalink
Fixed Draw Box property in ObjectDetection Effect
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennoCaldato committed Aug 10, 2021
1 parent 606dded commit 7e419b9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/effects/ObjectDetection.cpp
Expand Up @@ -146,13 +146,22 @@ std::shared_ptr<Frame> ObjectDetection::GetFrame(std::shared_ptr<Frame> frame, i

// DrawRectangleRGBA(cv_image, box, bg_rgba, bg_alpha, 1, true);
// DrawRectangleRGBA(cv_image, box, stroke_rgba, stroke_alpha, stroke_width, false);



cv::Rect2d box(
(int)( (trackedBox.cx-trackedBox.width/2)*fw),
(int)( (trackedBox.cy-trackedBox.height/2)*fh),
(int)( trackedBox.width*fw),
(int)( trackedBox.height*fh)
);

// If the Draw Box property is off, then make the box invisible
if (trackedObject->draw_box.GetValue(frame_number) == 0)
{
bg_alpha = 1.0;
stroke_alpha = 1.0;
}

drawPred(detections.classIds.at(i), detections.confidences.at(i),
box, cv_image, detections.objectIds.at(i), bg_rgba, bg_alpha, 1, true, draw_text);
drawPred(detections.classIds.at(i), detections.confidences.at(i),
Expand All @@ -166,6 +175,7 @@ std::shared_ptr<Frame> ObjectDetection::GetFrame(std::shared_ptr<Frame> frame, i
if (parentTimeline){
// Get the Tracked Object's child clip
Clip* childClip = parentTimeline->GetClip(trackedObject->ChildClipId());

if (childClip){
std::shared_ptr<Frame> f(new Frame(1, frame->GetWidth(), frame->GetHeight(), "#00000000"));
// Get the image of the child clip for this frame
Expand Down

0 comments on commit 7e419b9

Please sign in to comment.