Perspective transformation without camera intrinsic/extrinsic matrix?

asked 2017-04-14 00:44:20 -0600

Luis Oscar gravatar image

updated 2017-04-17 19:16:54 -0600

I'm a bit confused in whether something can be accomplished or not.

Supposing I have 2 identical delimiting shapes:

Rectangle, 5 units height, 50 units width.

Which I position on a uniform plane parallel to each other so that they form a rectangle between them. Can I obtain the perspective transformation needed to go from what a video camera sees (perspective view) to a 2D representation of it?

Based on this link: (http://docs.opencv.org/3.0-beta/doc/p...)

image description

I need to specify 4 points for the input, and another 4 points for the output.

The input 4 points are known, since I can detect the top left/right corners of my top marker, and the bottom left/right corners of my bottom marker.

The problem lies in the 4 points required for the output. I know what the width of the final image should be (which is equal to my marker width) but i don't know what the height should be (as the markers CAN be positioned with a variable distance between each other).

Is there a way to calculate this distance somehow? (I somehow believe there must be an alternative to using the intrinsic/extrinsic matrices since I know before hand the dimensions of both of my markers.)

image description

Just to be clear:

  • Both of the markers are exactly the same. (although the arrows point to the middle)
  • Distance between them is VARIABLE, but they will always appear parallel to each other forming a VARIABLE height rectangle, with a static width (the marker's width)
edit retag flag offensive close merge delete

Comments

unclear question. maybe addiing an image would help ?

berak gravatar imageberak ( 2017-04-14 00:52:48 -0600 )edit

Would love to, but I don't have enough karma for it, actually, i'll just upload it somewhere else and paste the URL. Even though i can't show normal links either, lol.

Luis Oscar gravatar imageLuis Oscar ( 2017-04-14 00:53:16 -0600 )edit

i added some. (sorry, should have done so before)

berak gravatar imageberak ( 2017-04-14 00:54:33 -0600 )edit
1

@berak thanks alot. I added an image and some clarification points below.

Luis Oscar gravatar imageLuis Oscar ( 2017-04-14 00:59:29 -0600 )edit

"but i don't know what the height should be" -- do you want to preserve the aspect ratio of your rectangle ?

(then the height could be inferred from the target width)

berak gravatar imageberak ( 2017-04-14 01:17:46 -0600 )edit

@berak Yeah, but the distance between both markers (which defines the height of the yellow area) is also unknown. As sometimes the markers might appear further away from each other. (The goal of this is to create a variable-height area for processing stuff inside it.) Or do you mean the rectangle as in the black markers?

Luis Oscar gravatar imageLuis Oscar ( 2017-04-14 01:32:19 -0600 )edit

btw, no, you do not need to calibrate your camera or use intrinsic calibration information (camera matrix, distortion coeffs) for this task.

berak gravatar imageberak ( 2017-04-14 02:01:22 -0600 )edit

Aaaaaa, would you be some kind as to give me some pointers on how to achieve it?

Luis Oscar gravatar imageLuis Oscar ( 2017-04-14 03:21:41 -0600 )edit

What I would do is infer the largest dimension in either X or Y between the corner points. Than transform to a largest x largest dimension. This because simply said, a sudoku is always squared, an inherent property of it.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-04-14 04:20:09 -0600 )edit

Sorry, I think i wasn't clear enough. The sudoku image is just an example of the perspective transform to show how it requires 4 points. The actual image I want to transform has only a known width but the height is completely variable (it could be smaller or bigger than the width depending on how far from each other the top and bottom markers are placed).

Luis Oscar gravatar imageLuis Oscar ( 2017-04-16 22:32:52 -0600 )edit