Hallöchen!

johannes hanika writes:

> the keystone correction formula uses a perspective correction
> approach (i.e. image plane x and y shortening is proportional to
> 1/z in 3d and different for every pixel, much like
> http://en.wikipedia.org/wiki/Texture_mapping#Perspective_correctness). i
> don't see why you would need additional constant scaling?

I did some calculation, but please take them with a grain of salt.
I hope I can get the idea across so that other can check what I did.

I limit my calucations to *vertical* keystone correction only.  I
take a picture of a flat surface (e.g. the front of a building or a
chessboard) at a purely vertical tilt angle.

The origin of my coordinate system is the centre of the image.  The
x axis is horizontal, the y axis vertical.  The vanashing point
(i.e. intersection of the grey guide lines) is at (0, y_VP).
W.l.o.g., y_VP is positive.

Then, I define an "equal-scale line" at y_ES.  This is a horizontal
line where the scale in x and y direction of the picture of the
surface is the same.  For example for a chessboard, the height and
width of the squares would be the same (although the squares are
trapezes of course).  When you correct the keystone effect, objects
at this line must not be stretched.  Above it, objects must be
streched, below it, objects must be shrunken.

Then,

    y_ES = - f/d * tan(1/2 arccot(d/f * y_VP))

f is the focal length, d is the half-height of the sensor.

The idea behind it is that at the equal-scale-line, the incident
angle of the light ray on the sensor is the same as on the surface.
Therefore, I have no magnification effect (angle-wise) there.  Just
like for the case of a non-tilted picture.

This also means that you must know f/d for keystone correction.
One could take it from EXIF data, and if this is not available,
offer one slider.

The current DT implementation also has an equal-scale line.  But I
don't know where it is (maybe it is always at the bottom of the
picture, maybe at the centre), therefore, I cannot give a simple
stretching factor for the current implementation.

Moreover, this needs to be expanded for the mixed
horizontal/vertical case.

I hope this helps.  (And I hope I didn't make a mistake.)

Tschö,
Torsten.

-- 
Torsten Bronger    Jabber ID: [email protected]
                                  or http://bronger-jmp.appspot.com


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Darktable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/darktable-users

Reply via email to