Re: algorithm for Keystoning/perspective rectification / camera tilt removal

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: algorithm for Keystoning/perspective rectification / camera tilt removal

Ed Elston
I have recently done work in this area and found a few interesting
facts that you might be interested in.  This only works in an
undistorted image so calibration gives you the info you need.  See
Figure 11-1 on page 372 or the book Learning OpenCV.

1) If you have lines in your image that are horizontal then the
vanishing point is where they intersect.  They don't have to be
horizontal but on the same plane works too as in my case I knew the
angle of the lines relative to horizontal.

2) To find the angle between the camera and the plane defined by
these lines is simple and efficient.  The angle's tangent is the
number of pixels from the image principal point Cy to the
intersection Py divided by the focal length Fy:

radians = arctan((Py - Cy)/Fy) : watch out for the signs


--- In [hidden email], "stfnroeder" <stfnroeder@...> wrote:
> Hi,
> I came across a lot of documentation on this keystoning effect and
> have learnt to use cvFindHomography and cvWarpperspective
> But still i am unable to find a suitable algorithm to warp images
> compensate for camera tilt.
> I came across some vanishing line technique in a paper to solve
> camera tilt. But due to my limited knowledge i could not implement
> code.
> Could some one direct me regarding how to warp images to
> for camera tilt/ perspective rectification /key stoning effect.
> I have accurate calibration parameters.
> Is it easy with OpenCv, I find this function important as for real
> time object detection, the camera might not be always be parallel
> the object plane. But I could not find out why it is not

> as finished function.
> Thanks in advance!
> --- In [hidden email], "stfnroeder" <stfnroeder@> wrote:
> >
> > Hello All,
> >
> > I have a project in which I pick an 3D object on a conveyor with
> > articulated arm. The arm is 3 axis properitary made and have
> > high accuracy.
> >
> > I use blobs library to get the midpoint of the objects on the
> > conveyor, but when I convert the pixel coordinates to world the
> > results are not accurate enough for a good pick.
> >
> > I have calibrated the camera and the calibration results are
> > good and accurate.
> > I directly convert the midpoint pixels to world using

> > results. (x=PX)
> >
> > But I realise from other messages that my camera is not exactly
> > perpendicular to the belt and therefore I have to eliminate
> > perspective effects of the camera.
> >
> > I am wondering how to proceed, but I could see I have to do the
> > following.
> >
> > 1) eliminate perspective effects in the image, calculate

> > usin cvFindHomography and use cvWarpPerspective.
> >
> > 2) use calibration results on the warped mage
> >
> >
> > I am not sucessful on the fist step, I could not eliminat the
> > perspective effect. Could some one guide me.
> >
> > thanks in advance
> > steffen
> >