Getting correct aspect ratio with planar tracker corner pin

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

TCP786

  • Posts: 135
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Getting correct aspect ratio with planar tracker corner pin

PostWed Sep 22, 2021 8:43 pm

I must be missing something about corner pinning with the planar tracker, because this seems like an issue that would be both extremely common and long since solved. The question is essentially: assuming the footage you're working with wasn't shot with markers, how can you get the image/footage in your composite to have the correct aspect ratio in "real-world" space?

I'll clarify this some more just in case: Often, the points used for defining the corner pin will be different than where the corners of the composited image will be. This can be for several reasons, but a very common one is because you need to use lines known to be real-world parallel to define the corner pin so that the perspective is correct, and these are often not where the edges of the comped image need to end up. For a simple example, imagine a shot that includes a blank whiteboard (at an angle, but with all corners visible). You can use the corners of the board to easily get the corner pinned image to be at the correct perspective angle; but if your image is, for example, a square and the whiteboard isn't, how do you make the image appear to be a square at an angle if your corner pin doesn't represent a square in the real world?

I think the main problem for me is that corner pin stretches the pinned image to fit within it. On its own, this isn't necessarily the problem, since adding a transform node between the media and the tracker will cause size and position/center adjustments to happen in the perspective defined by the corner pin. But since the corner pin stretches the image to fit, you need to adjust the image's x and y size separately to un-distort the image back to normal, and you can only do this by eyeballing it, which is almost guaranteed to be at least slightly wrong.

What really makes me think I'm missing something is that the existence of the "show grid" feature means that Fusion already knows the aspect ratio of the world-space rectangle defined by the screen-space corner pin. The idea of having to imperfectly eyeball something that I know the software already has the data for really makes me think there's a simple feature I'm not aware of, especially since the need to composite something with the correct aspect ratio into footage that wasn't shot with markers seems like an extremely common task.

Someone please help me out! There's no way this isn't already a solved problem. Thanks!
Offline

Hendrik Proosa

  • Posts: 1944
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: Getting correct aspect ratio with planar tracker corner

PostThu Sep 23, 2021 8:25 am

This is an interesting question. Not sure I can give a meaningful answer, but some thoughts.

The grid you see does not mean that Fusion "knows" the aspect ratio. Grid is most probably overlaid based on aspect ratio of default/project/footage resolution. If the perspective transform of cornerpin is applied, it gets warped to the planar surface that cornerpin describes. But it does not mean that there is some kind of inherent calculation of aspect ratio going on. Cornerpin is based on a 4x4 matrix and identity matrix produces input image. If this input image is a grid with grid size matching pixel dimensions in both x and y direction, whichever way it is projected through this 4x4 matrix, aspect ratio of the grid squares is visually maintained. Now, how do you know how much to scale your custom graphics in x or y direction to get proper aspect ratio? I think answer lies in the relation of your custom graphics and project/footage resolution aspect. For example if project is 16:9 and your piece is 1:1, you need to scale your graphics on x axis by a factor of 9/16, because after cornerpin it gets stretched by factor of 16/9 in x axis (your square is fit into wider rectangle).

I'm not super sure but I don't think the aspect ratio can be derived from the 4x4 matrix itself in any meaningful way, because it is applied to points and point data does not have any aspect whatsoever. To do any aspect calculations you must know the distances between corner points before transformation and this is exactly what formats of your tracked footage and graphics describe.

The practical solution to your problem would be to create a background with same aspect as your tracked footage and merge your custom graphics over it. This way you get a "container" in aspect planartransform expects and still preserve the original aspect ratio of your graphics.
I do stuff.
Offline

TCP786

  • Posts: 135
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Re: Getting correct aspect ratio with planar tracker corner

PostFri Sep 24, 2021 4:10 am

Hey, thanks for your reply. It's clear to me now that I did a pretty bad job of explaining my question, but it does sound like you know some information I'm looking for. I'll need to take a minute to make some images to help me explain it better before it'll be worth me actually replying, but I'll get back to this thread in a day or two. Thanks again.
Online
User avatar

TheBloke

  • Posts: 1448
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Real Name: Tom Jobbins

Re: Getting correct aspect ratio with planar tracker corner

PostFri Sep 24, 2021 6:19 am

You may want to post your follow-up in the Fusion subforum, as there are several Fusion experts who read that forum but never this one.
Resolve Studio 17.4 and Fusion Studio 17.4 on macOS 11.5.2

Hackintosh:: X299, Intel i9-10980XE @ 4.6 Ghz, 128GB RAM, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Audio: Behringer UMC404HD
Blackmagic Speed Editor
Offline

TCP786

  • Posts: 135
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Re: Getting correct aspect ratio with planar tracker corner

PostFri Sep 24, 2021 9:21 am

Thanks. Do you mean Forum>General>Fusion rather than Forum>General>DaVinci Resolve? Or is there a Fusion subforum within General>DaVinci Resolve that I haven't seen yet?
Online
User avatar

TheBloke

  • Posts: 1448
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Real Name: Tom Jobbins

Re: Getting correct aspect ratio with planar tracker corner

PostFri Sep 24, 2021 9:25 am

TCP786 wrote:Thanks. Do you mean Forum>General>Fusion?
This.

There's also the separate We Suck Less forum where even more Fusion experts hang out, many of whom don't check these BMD forums.
Resolve Studio 17.4 and Fusion Studio 17.4 on macOS 11.5.2

Hackintosh:: X299, Intel i9-10980XE @ 4.6 Ghz, 128GB RAM, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Audio: Behringer UMC404HD
Blackmagic Speed Editor

Return to DaVinci Resolve

Who is online

Users browsing this forum: ChrisWarren, Ed Rudolph, Google [Bot], lass5216, Lee Mackreath, Peter Chamberlain, TheBloke and 66 guests