How to create CATransform3D from homography matrix? [closed]

asked 2019-04-19 06:17:08 -0500

VTPete gravatar image

My app has a tilted camera setup that is looking at a reference sheet with a known image in it. I've properly created a homography that perfectly captures the relationship between the source (flat) image and the reference camera view.

What I want to do next is to take the homography matrix and apply it to my live camera view so that the live view is warped to simulate a straight-on, non-tilted setup.

In other words, I want to take the homography matrix and create an Apple iOS CATransform3D from it to apply to the view's CALayer transform property. I can find no reference to anyone who has successfully done this, although there are a few posts guessing at it.

One option is to build up the CATransform3D from scratch by applying horizontal and vertical transforms, rotation, and perspective tilt and skew. (.M34) But, I don't know how to extract these from the homography and the opencv matrix functions are way over my head to ever figure it out.

Using the homography matrix, I could literally apply it to one frame at a time to the input of the camera, but it would likely be slower than simply changing the CALayer's transform property once.

By the way, the camera does not move after the homography is created.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2019-04-19 14:42:17.455602

Comments

Berak, can you explain how this is off-topic or not relevant? I'm not sure why you closed this question. Is it not a fair question?

VTPete gravatar imageVTPete ( 2019-04-20 10:43:17 -0500 )edit