## RE: FW: [PanoToolsNG] calibrating a lens/teleconverter combo using PTGui

Expand Messages
• Serge, thank you and thanks also to all the others who have been educating me on this. So ,Serge, this is really helpful, but it does change my understanding
Message 1 of 13 , Jan 1, 2008
• 0 Attachment
Serge, thank you and thanks also to all the others who have been educating
me on this. So ,Serge, this is really helpful, but it does change my
understanding of how this works. Let me try.

Let's say that I have a horizontal line in the image that is significantly
curved due to barrel distortion. I had originally, been designating point
pairs by clicking at opposite ends of the line (for the first pair of a
line), then at various random midpoints for subsequent pairs (thinking that
the algorithm tries to minimize the distance of all points from the line
designated by the first and second CPs).

Now based on what you're saying, it seems that I should do this differently.
Specifically - it seems that I should designate the first point at one end
of the line (say the left) and the second point at a point (probably roughly
midway between the two ends of the image) at which the line is maximally
distorted. That does it for the first pair. For the second pair, I should
designate a point at the opposite far end of the line (the right) and the
second point of the pair near to the second point of the first pair (the
point of maximum distortion). - Is this correct? Wouldn't I then want to
proceed by designating lots of subsegments along the line that I eventually
want rendered straight?

(Strictly speaking, I guess that what I'm calling the point of max
distortion is actually the point of least distortion and the points near the
edge of the image are the points of max distortion. )

Another question - once I correct for barrel distortion, using this method,
the nextproblem that shows up is perspective distortion (even though I've
used a PC lens, there is some perspective distortion due to not having the
sensor plane exactly parallel to the subject). To fix this, I'd like to be
able to designate certain line segs and say "these should all be horizontal"
and other segs and say "these should all be vertical". Is this done using
the horizontal and vertical line types in the dialog box (t1 and t2)? Can I
correct for both barrel distortion and perspective distortion in the same
step or do you recommend doing so iteratively?

Many thanks and Happy New Year!

Y

-----Original Message-----
From: PanoToolsNG@yahoogroups.com [mailto:PanoToolsNG@yahoogroups.com] On
Behalf Of Serge Maandag
Sent: Tuesday, January 01, 2008 12:29 PM
To: PanoToolsNG@yahoogroups.com
Subject: RE: FW: [PanoToolsNG] calibrating a lens/teleconverter combo using
PTGui

> This leads me to the question - are straight line CPs processed in pairs
> (per the CP numbers that show up in the images)? Or - are they processed
in
> sets (with all CPs that have the same line number/name in the 'Type' field
> on the table below the images members of a single set)? Is there a rule of
> thumb regarding where to designate the 2nd CP of each pair (clearly, very
> close causes problems - that's what caused the optimizer to say 'too good
to
> be true').

Line type control points are processed as set. The way they work is as
follows:

You can define a line (within a panotools script) by starting it with t3, t4
or any
t followed by a number > 2. A line consists of 2 or more line segments. A
line
segment is defined by 2 coordinates, start and end of the segment.
The optimizer will try to have all segments line up on one straight line.

The way Joost added line type control points to PTGui might be a bit
confusing.
In most cases you just define 2 segments and want them to line up. In that
case the
logical way would be to click twice in the left pane (and thus define
segment1) and
then click twice in the right pane (defining segment2).

Instead, Joost chose to have the user alternately click the left and right
panes.
You are doing exactly the same thing as above and in the same order, but you
just
keep switching panes. This means you can define more than 2 segments to
define a
line. This can be handy for long overhead wires. Just select the appropriate
line in
the "CP type" dropdown box before clicking left and right.

possible. Be
cautious though: When optimizing with line type control points, the
optimizer aims
to have the segments line up in the output image. Depending on the type of
output
projection, that may be valid or not at all!

With rectilinear (flat) projection, all straight lines in real life are
straight in
the image, so it will be valid. With cylindrical or equirectangular
projection it's
only valid for vertical lines and for the horizon. If the line segments are
close to
each other it may still work or it may help to temporarily switch the output
projection to rectilinear during the optimization.

Serge.
http://360photo. <http://360photo.org/> org/

[Non-text portions of this message have been removed]
• ... Yes, totally. ... No, The three coefficients a, b and that the panotools optimizer uses can only correct barrel and pincushion distortion. The two line
Message 2 of 13 , Jan 1, 2008
• 0 Attachment
> Serge, thank you and thanks also to all the others who have been educating
> Now based on what you're saying, it seems that I should do this differently.
> Specifically - it seems that I should designate the first point at one end
> of the line (say the left) and the second point at a point (probably roughly
> midway between the two ends of the image) at which the line is maximally
> distorted. That does it for the first pair. For the second pair, I should
> designate a point at the opposite far end of the line (the right) and the
> second point of the pair near to the second point of the first pair (the
> point of maximum distortion). - Is this correct?

Yes, totally.

> Wouldn't I then want to
> proceed by designating lots of subsegments along the line that I eventually
> want rendered straight?

No, The three coefficients a, b and that the panotools optimizer uses can only
correct barrel and pincushion distortion. The two line segments are enough info for
the optimizer to do that. Subsegments would only be useful to fix a wobbly line. But
that wouldn't be possible anyway with only a,b and c.

The less segments you define, the less confusing it is to the optimizer. If I have
to correct a barrel shaped box, I define a line (consisting of 2 line segments) on
each side of the box.

> Another question - once I correct for barrel distortion, using this method,
> the nextproblem that shows up is perspective distortion (even though I've
> used a PC lens, there is some perspective distortion due to not having the
> sensor plane exactly parallel to the subject). To fix this, I'd like to be
> able to designate certain line segs and say "these should all be horizontal"
> and other segs and say "these should all be vertical". Is this done using
> the horizontal and vertical line types in the dialog box (t1 and t2)? Can I
> correct for both barrel distortion and perspective distortion in the same
> step or do you recommend doing so iteratively?

Correct and yes, the optimizer can do it in one go. There are occasions where the
optimizer goes haywire, but that rarely happens. If it does, you'll notice. Then you
can always:

- set t1/t2 points
- optimize yaw pitch and roll
- remove the the t1/t2 points and set line type points
- turn off yaw pitch and roll optimization
- optimize a, b and c (or at least b)

Happy newyear to you to!

Serge.
http://360photo.org/
• ... Sorry, this is wrong. The use of three coefficients (a, b and c) was especially necessary to allow the correction of wavy (or wobbly) distortion as well.
Message 3 of 13 , Jan 4, 2008
• 0 Attachment
Serge Maandag-3 wrote:
>
>> Wouldn't I then want to
>> proceed by designating lots of subsegments along the line that I
>> eventually
>> want rendered straight?
>
> No, The three coefficients a, b and that the panotools optimizer uses can
> only
> correct barrel and pincushion distortion. The two line segments are enough
> info for
> the optimizer to do that. Subsegments would only be useful to fix a wobbly
> line. But
> that wouldn't be possible anyway with only a,b and c.
>
> The less segments you define, the less confusing it is to the optimizer.
> If I have
> to correct a barrel shaped box, I define a line (consisting of 2 line
> segments) on
> each side of the box.
>

Sorry, this is wrong. The use of three coefficients (a, b and c) was
especially necessary to allow the correction of wavy (or wobbly) distortion
as well. Wavy distortion is a mixture of barrel and pincushion distortion in
different distances to the image center. For details see
http://wiki.panotools.org/Wavy_distortion

To correct for this kind of distortion you need more than two pairs of
control points on each line and you need lines in different distances from
the center. The optimizer will not be confused at all, since there isn't a
possibility of false local minima.

best regards

-----
Erik Krause
http://www.erik-krause.de
--
View this message in context: http://www.nabble.com/RE%3A-FW%3A-calibrating-a-lens-teleconverter-combo-using--PTGui-tp14569835p14615206.html
Sent from the PanoToolsNG mailing list archive at Nabble.com.
• ... Thanks for the update, Erik. I kind of always pictured pincushion distortion as bulgy in the middle and pointy in the corners, but it occurs to me that
Message 4 of 13 , Jan 4, 2008
• 0 Attachment
> Sorry, this is wrong. The use of three coefficients (a, b and c) was
> especially necessary to allow the correction of wavy (or wobbly) distortion
> as well. Wavy distortion is a mixture of barrel and pincushion distortion in
> different distances to the image center. For details see
> http://wiki.panotools.org/Wavy_distortion

Thanks for the update, Erik.

I kind of always pictured pincushion distortion as bulgy in the middle and pointy in
the corners, but it occurs to me that this is in fact a combination of barrel
distortion and pincushion distortion. More than this can't be correct by the
optimizer, though.

Luckily pincushion distortion is more rare than barrel distorion. Especially on wide
angle lenses.

Serge.
• Folks: I was struggling with using the straight line control points to remove barrel distortion from a single image. I posted some questions to this list and
Message 5 of 13 , Jan 24, 2008
• 0 Attachment
Folks:

I was struggling with using the straight line control points to remove
barrel distortion from a single image. I posted some questions to this list
and got lots of helpful answers. Also - Erik - thanks for updating the
tutorial.

However, i'm still not getting the results that I hoped for. I shot a close
up of a model using the Canon 24 mm tilt/shift lens. I used vertical shift.
I'm trying to correct for barrel distortion.

Please see the following illustration for reference
www.yorambernet.com/Panotools/panotools.jpg. There are three images in the
illustration: on the top left is my uncorrected image. On the top right is
the corrected image and on the bottom, a snapshot of the PTGui 'Control
Points' screen, showing the control points (CPs) that I used. I set CP pairs
on three important lines and grouped them in the CP dialog box as new lines
3, 4 and 5. On the top two images (corrected and uncorrected, I've inserted
four light blue reference lines that are perfectly straight. The lower three
of these correspond to the lines that I am trying to straighten and help to
illustrate the degree to which the straightening worked.

In particular - it appears that the line defined by CP pairs 0, 1 and 2 is
substantially improved. However, the line defined by CP pairs 3, 4, 5, 6, 7
and 8, while improved, is far from perfect. The barrel distortion seems to
be much improved near the middle of the line, but not near the ends. The
ends still curve significantly away from the reference line.

I tried optimizing for 'b' only and I tried optimizing for 'a', 'b' and 'c'.
I tried defining fewer CP pairs along each line and more CP pairs along each
line. I was unable to get results better than those illustrated in the
reference image. That said, I also tried optimizing for vertical shift (VS).
It seems to me that the first time I tried optimizing for VS as well as for
'b', I did get a much better result. Thinking that this might have been the
key, I went back and defined additional CP pairs, hoping to get perfect
results. I again optimized for 'b' and for 'VS'. This time I got 'too good
to be true' from the optimizer and the resulting image was just a black
canvas. I tried again and again to reproduce the promising results that I
thought I had obtained by optimizing for 'VS' as well as for 'b', but every
time, got 'too good to be true'.

So - here are my questions:

1. Am I asking for too much? Is this as good as it gets?
2. Is it possible to optimize for VS (without having recorded how many
mm of shift were actually used)? Could I in fact have got much better
results on one of the optimization runs when I selected 'VS' but for some
reason am simply unable to reproduce it?
3. How do I optimize for VS?
4. How do I get better results?

Many thanks for any assistance/insight!

BTW - on the reference image of the CP dialog box, several CPs overlap. So,
for example, on the right pane, CPs 0 and 1 overlap and therefore, CP 0 on
the right pane is not visible.

Yoram

-----Original Message-----
From: PanoToolsNG@yahoogroups.com [mailto:PanoToolsNG@yahoogroups.com] On
Behalf Of Erik Krause
Sent: Friday, January 04, 2008 4:18 AM
To: PanoToolsNG@yahoogroups.com
Subject: RE: [PanoToolsNG] FW: calibrating a lens/teleconverter combo using
PTGui

Serge Maandag-3 wrote:
>
>> Wouldn't I then want to
>> proceed by designating lots of subsegments along the line that I
>> eventually
>> want rendered straight?
>
> No, The three coefficients a, b and that the panotools optimizer uses can
> only
> correct barrel and pincushion distortion. The two line segments are enough
> info for
> the optimizer to do that. Subsegments would only be useful to fix a wobbly
> line. But
> that wouldn't be possible anyway with only a,b and c.
>
> The less segments you define, the less confusing it is to the optimizer.
> If I have
> to correct a barrel shaped box, I define a line (consisting of 2 line
> segments) on
> each side of the box.
>

Sorry, this is wrong. The use of three coefficients (a, b and c) was
especially necessary to allow the correction of wavy (or wobbly) distortion
as well. Wavy distortion is a mixture of barrel and pincushion distortion in
different distances to the image center. For details see
http://wiki. <http://wiki.panotools.org/Wavy_distortion>
panotools.org/Wavy_distortion

To correct for this kind of distortion you need more than two pairs of
control points on each line and you need lines in different distances from
the center. The optimizer will not be confused at all, since there isn't a
possibility of false local minima.

best regards

-----
Erik Krause
http://www.erik- <http://www.erik-krause.de> krause.de
--
View this message in context: http://www.nabble.
<http://www.nabble.com/RE%3A-FW%3A-calibrating-a-lens-teleconverter-combo-us
ing--PTGui-tp14569835p14615206.html>
com/RE%3A-FW%3A-calibrating-a-lens-teleconverter-combo-using--PTGui-tp145698
35p14615206.html
Sent from the PanoToolsNG mailing list archive at Nabble.com.

[Non-text portions of this message have been removed]
• ... Sorry for taking me so long. I missed your post because of the entirely new subject in an older thread... [...] ... No. ... Check vertical shift on the
Message 6 of 13 , Jan 27, 2008
• 0 Attachment
On Thursday, January 24, 2008 at 17:20, Yoram Bernet wrote:

> However, i'm still not getting the results that I hoped for. I shot a
> close up of a model using the Canon 24 mm tilt/shift lens. I used
> vertical shift. I'm trying to correct for barrel distortion.

Sorry for taking me so long. I missed your post because of the
entirely new subject in an older thread...

[...]
> 1. Am I asking for too much? Is this as good as it gets?

No.

> 2. Is it possible to optimize for VS (without having recorded how many
> mm of shift were actually used)? Could I in fact have got much better
> results on one of the optimization runs when I selected 'VS' but for some
> reason am simply unable to reproduce it?

Check "vertical shift" on the optimizer tab page and optimize again.
Be prepared that your result slips out of center. Hence you might
need to use a larger output field of view. You can adjust this in the
pano editor (ctrl+e). It could well be, that the PTGui optimizer
won't give you good results. If this is the case, use panotools
optimizer.

Using a shift lens is a classical case of center of distortion not
beeing in the image center. However, panotools should handle this
case properly, but if you use shift and lens correction optimization
together, the optimizer might find a false minimum. In this case you
might want to tune your control points and/or use more lines.

Please not, that if you deselect a parameter for optimization, this
won't reset the value. You must set these parameter manually to zero
on lens settings tab.

best regards

Erik Krause
http://www.erik-krause.de
• I received a few emails asking about my home-made camera warmer / jacket for shooting outdoors in winter. My current one was constructed from a fleece hat I
Message 7 of 13 , Jan 27, 2008
• 0 Attachment
shooting outdoors in winter. My current one was constructed from a fleece
hat I purchased at WalMart for \$2.00. Cutting and sewing took about two
hours. I added photos to flickr.com - keyword rickscamerahat .

http://flickr.com/search/?q=rickscamerahat
<http://flickr.com/search/?q=rickscamerahat&w=22793959%40N06>
&w=22793959%40N06

Hope it helps.

Rick Drew

PS - I used it yesterday. In the morning the wind-chill was 3 degrees
Fahrenheit. One battery lasted for 911 photos!

[Non-text portions of this message have been removed]
Your message has been successfully submitted and would be delivered to recipients shortly.