Jump to content
Hash, Inc. Forums

Is there anyway to match the camera perspective to a photo?


rijklau

Recommended Posts

Hi all,

I need to model an item with just a photo, and one measurement of a side of the item. I thought I could set up an choreography  with the camera matching the perspective of the photo, then model the item there. But after an hour trying to set the camera, still no go.

Anyone have done this before, or has this been discussed before?

Cheers,

Rijk

Link to comment
Share on other sites

The picture was form a customer, so I don't have the camera.

The small picture attached is the original.

The one with white background is adjusted for use as camera roto.

The only dimension known is the long side of the base, which is 254 mm.

Also is a screen capture form A:M. The highlighted object is built as 25.4 cm square in A:M. So I thought if I can match the side and perspective to the photo, I can model the item inside choreography. So far using hot keys to manipulate the camera in camera view is total miss and no hit.

The item is simple but the task is hard.😄 Any help is welcome.

20200421101052.png

20200421101052.jpg

Dim.jpg

snap.jpg

Link to comment
Share on other sites

  • Hash Fellow

Here's what I have so far...

This is three sides of a square and one vertical edge aligned (almost) with the rotoscope image. To simplify  it I rotated the first rotoscope to get one edge of the shape horizontal.

 

Unfortunately this view point does not correctly find a height above the ground plane for the camera. Knowing only one dimension of the shape is a serious limitation.

Is there a reason they can not take measurements?

Are you expected to duplicate the ABSOLUTELY EXACT shape of the object?

Link to comment
Share on other sites

Scanned_25630423_0827-1.png

this is my way,
1. Use the Shear Tool and Perspective Tool in GIMP (or Photoshop) to adjust (projection) the Perspective view to Elevation view.
2. Export the modified image into a Rotoscope in the Model window in A: M and then create the model as normal.
3. You know the base dimension, scale Rotoscope to get the correct dimension.
4. Estimate the depth and height of model by adjusting the proportion in choreography.

(please excuse me for grammar, I wrote in Thai and then "google translate")

20200421101052.png

Model.zip

Model.zip

  • Like 1
Link to comment
Share on other sites

First of all, thank you everyone for responding. For everybody's information, the easiest way to solve the problem was to ask the client for the remaining measurements, and I did, and got it. Why I don't want to do that in the first place was that the "asking" process needs to go down a chain of people and would pass along a message of "are you serious, so little information and you want us to make a product? Are you a idiot?"😁 to the client. And even thought I got the measurements, the client gave me the wrong incline angle of the top piece. And it is also likely that the measurements were what the client hopes for and not what were in the photo.

So the initial question is now just a brain exercise. If you guys have time to spare (like stuck in lock down), please keep ideas coming.

I though this problem was common in people working in SFX or post production having the need, like to match a product  rendering into a real background photo. I know even architects used to match building renderings into real on site photos. But in these cases, at least they know the exact dimension of the building, and the site.

Rhino has a function that if you have the exact dimension of an object in a photo, and you have an 3D object built to that exact dimension, it can match the camera view to the photo by inputting six pairs of corresponding points. This has no use with the current problem, but just for interest, can current A:M version do something similar?

Quote

Here are the three vanishing points. How can we use this to ascertain the camera location? Can we?

robcat2075:

I googled "how to calculate length from a perspective" and get these promising but "over my head" results. In short, my maths sucks:
how to calculate length from a perspective - https://www.math.utah.edu/~treiberg/Perspect/Perspect.htm

Perspective Calculator - Divide drawing into equal regions - https://www.theproblemsite.com/educational-resources/perspective/horizontal

Perspective length tool - ImageMeter - photo measure - https://imagemeter.com/

The last is actually an Apps that can do the measurement if you have just a single measurement. Free to evaluate in your phone.

Wonder why these search results did not came up the date I posted my question...

More appropriate to answer your question, (googled "how to calculate lens focal length from photos") :

How can I calculate focal length from a photograph? - https://photo.stackexchange.com/questions/21616/how-can-i-calculate-focal-length-from-a-photograph

Link to comment
Share on other sites

44 minutes ago, Bobby said:

Scanned_25630423_0827-1.png

this is my way,
1. Use the Shear Tool and Perspective Tool in GIMP (or Photoshop) to adjust (projection) the Perspective view to Elevation view.
2. Export the modified image into a Rotoscope in the Model window in A: M and then create the model as normal.
3. You know the base dimension, scale Rotoscope to get the correct dimension.
4. Estimate the depth and height of model by adjusting the proportion in choreography.

(please excuse me for grammar, I wrote in Thai and then "google translate")

20200421101052.png

Model.zip 7.57 MB · 0 downloads

Model.zip 2.99 MB · 0 downloads

Hi Bobby, 

I'm not sure if using the Shear or Perspective tool can create an orthographic projection with the correct measurements. It might work if I have all the dimensions and distort a face to get the relative position of the inside details, but probably cannot get an exact dimension of the other sides... 

Link to comment
Share on other sites

10 minutes ago, robcat2075 said:

@rijklauCheck out the models bobby attached, they look like plausible solutions.

I've checked. Thanks @Bobby for that.

But still, the depth of the item is a visual guess. And the model did not match the perspective in the camera view. If this is for SFX, the resulted composite will look off.

Looks like now I'm going for 2 things, 

1. Make the item as in the photo,

2. Match it to the view in the photo.

😅

Link to comment
Share on other sites

First, I think you would have to match the camera angle.  Assuming that the wall is at a 90 degree angle from the floor and that the base of the object is square (or at least rectangular), you could set up a choreography with a wall, floor and 254mm square object and try to match the angles in the photo.  You might be able to get close that way, then build out your object.

Hope that helps.

Link to comment
Share on other sites

  • Hash Fellow

Note that even slight distortion by the original camera lens may make it impossible for any of these digital reconstruction techniques to yield an exact replica of the original shape.

It is odd that they want you to produce an exact copy of the shape but are not able to give exact measurements.

Link to comment
Share on other sites

6 hours ago, robcat2075 said:

Note that even slight distortion by the original camera lens may make it impossible for any of these digital reconstruction techniques to yield an exact replica of the original shape.

It is odd that they want you to produce an exact copy of the shape but are not able to give exact measurements.

They might just randomly snap the photo from shop display and said, I want it to have a 25.4 cm base. Or even worse, they just copy it from a magazine.

Link to comment
Share on other sites

40 minutes ago, robcat2075 said:

You can use the 1, 2 or 3 keys to constrain CP moves to the X Y or Z axis

Still, you need to move the "face", i.e. 4 points at a time in order for the movement to be perpendicular to the opposite side, so as to maintain the faces to be parallel to each other. And you have to make sure the sides are aligned to the axis. Then we get back to the original problem of aligning the axis to the camera view.

Link to comment
Share on other sites

  • Hash Fellow

What if the "vertical" side is not actually vertical? :o

We've been presuming it is vertical, but we don't have any proof it is vertical.

What if it is leaning in slightly over the base? That might explain why my alignment attempt produces an impossible camera elevation.

What if the base is not rectangular? What if it is slightly trapezoidal?

Link to comment
Share on other sites

57 minutes ago, robcat2075 said:

What if the "vertical" side is not actually vertical? :o

We've been presuming it is vertical, but we don't have any proof it is vertical.

What if it is leaning in slightly over the base? That might explain why my alignment attempt produces an impossible camera elevation.

What if the base is not rectangular? What if it is slightly trapezoidal?

😅

If those are the cases, there is no way that we can align the camera. And we cannot even get the product done without knowing the angles of the actual faces.

Link to comment
Share on other sites

  • Hash Fellow

This angle that I've put the blue markers on appears as nearly 90° in the image plane.

If that is a 90° angle on the real object the camera would have to be close to directly over that corner for it not to be flattened by perspective into a wider angle.  But obviously the camera is not close to directly over that corner.   :dontknow:

 

image.png

Link to comment
Share on other sites

3 hours ago, robcat2075 said:

This angle that I've put the blue markers on appears as nearly 90° in the image plane.

If that is a 90° angle on the real object the camera would have to be close to directly over that corner for it not to be flattened by perspective into a wider angle.  But obviously the camera is not close to directly over that corner.   :dontknow:

 

image.png

For objects like that in the photo, which is an acrylic display stand, the base should be a rectangle with four 90 degrees angles. And so is the first vertical piece, should be 90 degrees upwards from the ground. But the bending of the vertical part usually is done by hand, so it might not be perfect.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...