I am using OpenCV 2.2 on the iPhone to detect faces. I\'m using the IOS 4\'s AVCaptureSession to get access to the camera stream, as seen in the code that follows.
Maybe easier to just set the video orientation the way you want:
connection.videoOrientation = AVCaptureVideoOrientationPortrait
This way you don't need to do that rotation gimmick at all