Interpolate the bouding-boxes properties
| 176 | |
| 177 | // Interpolate the bouding-boxes properties |
| 178 | BBox TrackedObjectBBox::InterpolateBoxes(double t1, double t2, BBox left, BBox right, double target) |
| 179 | { |
| 180 | // Interpolate the x-coordinate of the center point |
| 181 | Point cx_left(t1, left.cx, openshot::InterpolationType::LINEAR); |
| 182 | Point cx_right(t2, right.cx, openshot::InterpolationType::LINEAR); |
| 183 | Point cx = InterpolateBetween(cx_left, cx_right, target, 0.01); |
| 184 | |
| 185 | // Interpolate de y-coordinate of the center point |
| 186 | Point cy_left(t1, left.cy, openshot::InterpolationType::LINEAR); |
| 187 | Point cy_right(t2, right.cy, openshot::InterpolationType::LINEAR); |
| 188 | Point cy = InterpolateBetween(cy_left, cy_right, target, 0.01); |
| 189 | |
| 190 | // Interpolate the width |
| 191 | Point width_left(t1, left.width, openshot::InterpolationType::LINEAR); |
| 192 | Point width_right(t2, right.width, openshot::InterpolationType::LINEAR); |
| 193 | Point width = InterpolateBetween(width_left, width_right, target, 0.01); |
| 194 | |
| 195 | // Interpolate the height |
| 196 | Point height_left(t1, left.height, openshot::InterpolationType::LINEAR); |
| 197 | Point height_right(t2, right.height, openshot::InterpolationType::LINEAR); |
| 198 | Point height = InterpolateBetween(height_left, height_right, target, 0.01); |
| 199 | |
| 200 | // Interpolate the rotation angle |
| 201 | Point angle_left(t1, left.angle, openshot::InterpolationType::LINEAR); |
| 202 | Point angle_right(t1, right.angle, openshot::InterpolationType::LINEAR); |
| 203 | Point angle = InterpolateBetween(angle_left, angle_right, target, 0.01); |
| 204 | |
| 205 | // Create a bounding box with the interpolated points |
| 206 | BBox interpolatedBox(cx.co.Y, cy.co.Y, width.co.Y, height.co.Y, angle.co.Y); |
| 207 | |
| 208 | return interpolatedBox; |
| 209 | } |
| 210 | |
| 211 | // Update object's BaseFps |
| 212 | void TrackedObjectBBox::SetBaseFPS(Fraction fps){ |
nothing calls this directly
no test coverage detected