Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtain top-down view of image using iPhone accelerometer data

I have developed a simple little iPhone app (for academic purposes) that allows the user to take a picture of an object. At the time the picture is taken, the accelerometer data from the phone is captured as well. The user will be taking a top-down (birds eye view) of the image, meaning the phone should reasonably be at a 90 degree angle to the object. However, the notion that the angle will always be 90 degrees cannot be guaranteed.

Given that I have the accelerometer data (x, y, z values) of when the image is taken, I believe there is a way to construct a transformation matrix to transform the image as if it was taken from a 90 degree angle. However, I'm not exactly sure how to construct this matrix.

As I mentioned, this is for playing around/academic purposes, so once I capture the image and x, y, z data I just send it to one of my computers for further processing. The processing is being performed using Python and OpenCV.

Any help or pointers would be much appreciated.

like image 308
Adrian Rosebrock Avatar asked Oct 21 '22 12:10

Adrian Rosebrock


1 Answers

Your Homework

Read articles

  • http://en.wikipedia.org/wiki/Perspective_control
  • http://en.wikipedia.org/wiki/Projective_transformation AKA Homography
  • http://en.wikipedia.org/wiki/Image_rectification
  • http://en.wikipedia.org/wiki/Epipolar_geometry

These presentations which will give you a feel for the complexity of the maths involved. - http://www.cs.auckland.ac.nz/compsci773s1t/lectures/773-GGpdfs/773GG-FundMatrix-A.pdf - http://www.robots.ox.ac.uk/~vgg/hzbook/hzbook1/HZepipolar.pdf

The Answer?

From related question Skewing an image using Perspective Transforms, use OpenCV function cvWarpPerspective (thanks @jeff7)

http://opencv.willowgarage.com/documentation/geometric_image_transformations.html

You still need to create the matrix, for this you can try cvGetPerspectiveTransform and create the input vertex from the orientation information from the sensor.

Or, if the angle is going to be pretty small, an affine transformation might look good enough (cvWarpAffine with cvGetAffineTransform) http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.html

like image 101
Captain Lepton Avatar answered Oct 24 '22 09:10

Captain Lepton