Help with camera distortion correction.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with camera distortion correction.
I would not use the floor, since there is perspective distortion, since the floor is not perpendicular to the camera look direction. I would recommend that you paste a printed grid on the wall and photograph that face-on filling the frame for best calibration. Or buy a pegboard and use the holes for the grid. Put the pegboard directly on the wall and photograph that straight-on (no tilt) filling the frame.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Help with camera distortion correction.
Photographing an interior wall, flat-on to that wall, in a rectangular room, is easy:
1. Put camera on a tripod, pointing towards the wall.
2. Measure the height of the centre-line of the lens above the floor.
3. Measure the horizontal distance from the centre-line of the lens to the wall on the left (or right).
4. Walk to the other end of the room, where the camera is pointing.
5. Put a mark on the wall at the same height, and same distance from the wall on the left (or right).
6. Adjust the camera angles to put the mark in the centre of the viewfinder.
1. Put camera on a tripod, pointing towards the wall.
2. Measure the height of the centre-line of the lens above the floor.
3. Measure the horizontal distance from the centre-line of the lens to the wall on the left (or right).
4. Walk to the other end of the room, where the camera is pointing.
5. Put a mark on the wall at the same height, and same distance from the wall on the left (or right).
6. Adjust the camera angles to put the mark in the centre of the viewfinder.
Is your corrected image from Hugin or IM? If IM, what was the command?DanielB wrote:For the correction I used A, B and C in Hugin, but not D. Do you think that using D could improve the correction?
snibgo's IM pages: im.snibgo.com
Re: Help with camera distortion correction.
Hi, snibgo.
This is the procedure I have been always using.
A side question: when loading the image in Hugin, it asks for focal length but I'm not sure what value should be used here or if this value influences the result of the transformation. I have examined the EXIF metadata of the photo (taken using uvccapture 0.5-3+b1 on Debian GNU/Linux), but I did not find anything there regarding the focal length.
Thanks for your reply and your time.
Kind regards,
Daniel
Thank you for diagramming of these steps. Sorry, but I'm not sure I understand what you mentioned in paragraphs 3 and 5. When you say "measure the horizontal distance from the centre-line of the lens to the wall on the left (or right)", do you mean to measuring the horizontal distance between the vertical axis passing through the lens and the wall on the left (or right) of the camera, then carry that distance at the same height of the horizontal axis of the camera on the wall to which the camera is pointed, and then to position the camera so that "cross" stays in the center of the viewfilder? If I understood correctly, then I would have to make sure that distance is measured with an instrument which ensure horizontality and perpendicularity with respect to the side wall.snibgo wrote:Photographing an interior wall, flat-on to that wall, in a rectangular room, is easy:
1. Put camera on a tripod, pointing towards the wall.
2. Measure the height of the centre-line of the lens above the floor.
3. Measure the horizontal distance from the centre-line of the lens to the wall on the left (or right).
4. Walk to the other end of the room, where the camera is pointing.
5. Put a mark on the wall at the same height, and same distance from the wall on the left (or right).
6. Adjust the camera angles to put the mark in the centre of the viewfinder.
I calculated the values of "a", "b" and "c" using Hugin. The values obtained were: a = -0.026, b = 0.02, and c = 0.001 Then I used the following syntax with ImageMagic:snibgo wrote:Is your corrected image from Hugin or IM? If IM, what was the command?DanielB wrote:For the correction I used A, B and C in Hugin, but not D. Do you think that using D could improve the correction?
Code: Select all
$ convert 20160523_131515-rotated -distort barrel.jpg "-0.026 0.02 0.001" 20160523_131515-rotated-processed.jpg
A side question: when loading the image in Hugin, it asks for focal length but I'm not sure what value should be used here or if this value influences the result of the transformation. I have examined the EXIF metadata of the photo (taken using uvccapture 0.5-3+b1 on Debian GNU/Linux), but I did not find anything there regarding the focal length.
Thanks for your reply and your time.
Kind regards,
Daniel
Re: Help with camera distortion correction.
Hi, Fred.
Thanks for your reply.
Kind regards,
Daniel
As the lines appear curved on the floor, I thought it might also be a distortion of the camera.fmw42 wrote:I would not use the floor, since there is perspective distortion, since the floor is not perpendicular to the camera look direction.
I'll see if I can do something like that. Thank you for the recommendations.fmw42 wrote: I would recommend that you paste a printed grid on the wall and photograph that face-on filling the frame for best calibration. Or buy a pegboard and use the holes for the grid. Put the pegboard directly on the wall and photograph that straight-on (no tilt) filling the frame.
Thanks for your reply.
Kind regards,
Daniel
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Help with camera distortion correction.
Yes. No fancy tools are needed, just a tape measure or even just a piece of string.DanielB wrote:... do you mean ...
That would give the most accurate results. If you have such an instrument, you can also check that the walls really are vertical, the floor and ceiling are horizontal, the edges between them are straight, and so on.DanielB wrote:...an instrument which ensure horizontality and perpendicularity with respect to the side wall.
This also assumes that the central axis of the lens passes through the centre of the imaging sensor. These are the X,Y coordinates in "-distort barrel".
From memory, if you don't tell Hugin the focal length (or what it would be if your camera was 35mm), it will be calculated. See the Hugin docs.
snibgo's IM pages: im.snibgo.com