Ask Your Question
1

iPad Camera input is rotated 180 degrees.

asked Mar 9 '13

kaipyroami gravatar image

I am having trouble with the input from my camera being rotated 180 degrees. In other words, the image is upside down when my cvPoints and text are correct. But when the image is right side up the X and Y locations are referenced off of the bottom right corner instead of the top left. And text is upside down.

Aside from "AVCaptureVideoOrientation" which rotates everything together is there any way to rotate the camera input relative to OpenCV?

Preview: (hide)

3 answers

Sort by » oldest newest most voted
0

answered Apr 16 '13

AlexanderShishkov gravatar image

Maybe you should set correct default rotation:

self.photoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationLandscapeRight;
Preview: (hide)
1

answered Mar 12 '13

updated Mar 27 '13

Is it possible that you are mixing up coördinate systems and in that case messing up the way you are visualizing the input?

OpenCV coordinate system

Example of OpenCV coördinate system

General coordinate system

image description

Also a common made mistake is switching the cols and row parameter when defining width and height of an image. It is confusing I know. Maybe worth investigating this?

On the other hand, the suggestion of flipping will work, but is just going around the actual problem.

EDIT : looking through the internet, I have found the following image, which suggests the IPAD coordinate system:

IPAD Coordinate System

If considering this coordinate system, considered to the actual OpenCV coordinate system, I guess it is normal that you have a 180 degree shift, since the y - axis is inverted. So take this into consideration and flip your image pixels along the horizontal axis to get good references.

Preview: (hide)

Comments

If you take the first image you posted and rotate it 180 degrees that is what I am getting. 0,0 should be in the top left but is in fact in the bottom right.

kaipyroami gravatar imagekaipyroami (Mar 27 '13)edit

Check if your webcam drivers have updates?

StevenPuttemans gravatar imageStevenPuttemans (Mar 27 '13)edit

I am using iOS (iPad) I am at the current version.

kaipyroami gravatar imagekaipyroami (Mar 27 '13)edit

Look at my edit. Have found an example of a project where they used transformations to go to the correct coordinate system for the world. So apply a transformation in order to get correct results :)

StevenPuttemans gravatar imageStevenPuttemans (Mar 27 '13)edit
1

answered Mar 12 '13

flip image function can be a quick trick in your case, but maybe you should investigate more to find a more perennial solution...

Preview: (hide)

Comments

That is a good idea, I am just trying to limit adding any more extra processing if I can help it. I was thinking that the camera input might be easier to correct than flipping the mat.

kaipyroami gravatar imagekaipyroami (Mar 27 '13)edit

Question Tools

Stats

Asked: Mar 9 '13

Seen: 5,313 times

Last updated: Apr 16 '13