Ask Your Question

Revision history [back]

OpenCV Android - Elaborate Camera in Portrait Mode

I have just start with OpenCv and i use the sdk for android without c++ header right now.

I have imported the example found into sdk folder to my android studio, i have follow some tips found online t make it's work. Right now they work and i have tried it, but all that example have an issue. They show the camera preview, or better the frame elaborate from camera then show over display, flipped 90 degree to the right and they are mirrored too.

This is strange for me and i can't to make it work correctly, have read a lot of tips online, it's a very common issue.

I have tried to setDisplayOrientatio(90) into JavaCameraView class, but it's work only to show the camera preview, if i try to write on canvas surface it's locked and make error so i can't elaborate the frame anymore.

I have tried to modify the onCameraFrame into my main class but if i try to rotate with core.flip the camera frame by frame i going into a stretched image or in a black screen. Finally this method make the response of camera very slow because the elaboration frame by frame.

Anyone have this issue? How could resolve it? There are a method in opencv to have the right orientation of camera?

Thanks