I'm developing an application which uses a Canon DSLR to sequentially shoot an object from different views. Often the object is too big to fit in frame so I have to make more than one series of photos.

It's really important for the photos to be distorted as little as possible (the photos are then merged into one and result image is used in mathematical algorithm). For that purpose it's really important to know which part of image is least lens-distorted.

I suppose the least lens-distorted rectangular part of a shot is defined by focal length of the lens I'm using, but I'd like to know which part it is exactly, or at least how to calculate that part.

Could anyone help me in clarifying this?


The object always has a shape of cylinder. It is placed between two shafts which rotate the object (rotation is controlled by software). So, the goal is to get an image that represents the surface of this object.

The process is as follows:

  1. I set the number of rotations to be made - call it 'n'. On each iteration the object is rotated by 360/n degrees, and for each iteration camera shot is made.
  2. Once n rotations (and shots) are made, if object doesn't fit in camera frame, carriage, that holds tha camera shifts to the side and repeats this process for the new portion of the object. Otherwise process finishes.

Here's an example of photo for better understanding:

enter image description here

Algorithm takes a part of image, which represents 360/n degree part of object's surface and saves it. After finishing the process, those pieces are merged into one and the result looks something like that:

enter image description here

I hope this clarifies the process a bit more.

  • \$\begingroup\$ Will you be trying to roll your own stitching algorithm and program? Or will you be using readily available libraries and software, such as lensfun and hugin? \$\endgroup\$
    – xiota
    Nov 22, 2019 at 11:23
  • \$\begingroup\$ "the photos are then merged into one" - Which photos? The photos of the object from different views? More detail about the merge is needed. \$\endgroup\$
    – xiota
    Nov 22, 2019 at 11:26
  • \$\begingroup\$ @xiota i edited the post for better clarification \$\endgroup\$
    – George
    Nov 22, 2019 at 12:05
  • \$\begingroup\$ Can you illustrate the "doesn't fit in the frame" situation? Will the object always be the same shape, size, and distance from the camera? \$\endgroup\$
    – mattdm
    Nov 22, 2019 at 13:24
  • \$\begingroup\$ "I suppose the least lens-distorted rectangular part of a shot is defined by focal length of the lens I'm using..." Why do you suppose that? One can have two different lenses of the same focal length and one can (geometrically) distort differently than the other. The same exact lens will give different perspective distortion based on differing distances from the camera to the same object. \$\endgroup\$
    – Michael C
    Nov 22, 2019 at 14:36

3 Answers 3


I suppose the least lens-distorted rectangular part of a shot is defined by the focal length of lens I'm using, but I'd like to know which part it is exactly, or at least how to calculate that part.

I think you really need to start here:

What is the difference between perspective distortion and barrel or pincushion distortion?

... because there are several different types of distortion and you really need to be clear before you can do anything about it.

The basic answer is: perspective distortion entirely depends on the distance you are from the object, and therefore focal length is a factor only so much as it affects your framing. For this, there is no clear line between "close up off-center things look weird" and something which our brain sees as normal.

For distortion that is actually a lens defect (pronounced "design compromise"), there is no general answer because you'll need to characterize each lens (or find an existing "lens profile" which includes this characterization). For zoom lenses, this will likely change as you change focal length, but this is due to the design of each particular lens's zoom mechanism, not inherent to focal length.

Camera lenses sold for photography are generally designed for uses that are more art than science. The design intent is to produce an appealing rendering. Therefore, they are not always ideal when pressed into service as measuring instruments.

Back to the beginning: if you need to move the camera to fit more in the frame, that inherently means you are changing perspective. If your subject is not flat, well, there's nothing to be done about this. If you cut out the parts which are distorted relative to your first shot, you'll cut out the information you gained from moving. Your software can twist things after the fact to align, but can't make up for this.

(The only solution is to take many pictures from slightly differing views, build a 3D model from that, and then render the model rather than working with the raw data from the lens. That's what our brains do, after all.)

  • \$\begingroup\$ Thanks for a detailed answer, i'm sure it does point me in the right direction. I edited my post with a description of the whole process. It should clarify what i'm trying to achieve \$\endgroup\$
    – George
    Nov 22, 2019 at 12:14

It seems that the camera will be in a (fairly) fixed position, while the item you're photographing will always be the surface of a cylinder. The "distortion" in this case is not caused by the lens, but by the shape of the cylinder.

The way scanners handle this problem is to scan a single pixel strip that runs the length of the cylinder. This would require that the motor be capable of rotating the cylinder in increments that match the width of a single pixel. If it is not able to do that, you can use a wider portion of the image.

Then as long as the strips don't overlap, you can just append them to create the final image. For side-to-side camera movements, just repeat the process and append the images appropriately.

If you can control the camera and drum movements so that only a single pixel from each photo is used, you'd be mimicking how a drum scanner works. A single pixel capture from the center of the frame, when using an appropriately aligned lens, would be expected to have the least distortion possible from any particular lens-sensor combination.


It is not clear what you call "lens-distorted". A perfectly accurate rectilinear lens will distort angles and proportions as you move from the center of the image: that's a property of the projection rather than the lens, and obviously there is no way around taking the projection into account for your application.

Modern cameras and lenses communicate the deviations of the lens from this ideal even with interchangeable lenses (but certainly so with cameras having fixed lenses) and the camera compensates for it. To check whether it does, take some photographs using the widest setting of the lens and compare the uncorrected(!) raw image (this may require switching off geometric correction in your raw image processing software) with the JPEG.

More expensive lenses, especially with a moderate zoom range or even a fixed focal length, tend to require very little additional correction but either way you should be able to rely on the results to be rectilinear to a sensible degree (unless you use an intentionally non-rectilinear lens like a fisheye, of course).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.