Camera Orientation in Android App

asked 2013-05-23 03:14:46 -0500

sp_mic88 gravatar image

Good morning to all. I have created an Android app that opens a video stream, extending the class JavaCameraView. The application should capture frames to process them. I have used, to realize this app, the tutorials contained in the OpenCV4Android package (version 2.4.5). I use Eclipse Juno, and my phone is a samsung s4, and surfing the web I realize that my problem is very common on many devices, including galaxy s,s2,s3,s4. My problem is that my camera, when is opened, in portrait mode results rotated of 90 degrees. It seems to be always in landscape orientation. I have read somewhere that it is possible to flip camera on the fly, but I have not understood how. Could someone help me?

edit retag flag offensive close merge delete

Comments

hi, i don't really have an answer to your question, but i was wondering how did you get opencv working on ur s4 ?, on mine even the tutorial projects that came with opencv end up crashing, i installed using the import all projects as android, and add c++ other toolchains thing, and installed opencvmanager on the phone, but after 1 sec of opening any opencv app the phone restarts.

heneedhelp gravatar imageheneedhelp ( 2013-05-31 17:57:03 -0500 )edit

Did you find an answer?

powder366 gravatar imagepowder366 ( 2013-08-22 15:06:33 -0500 )edit

Yes, I've used the flip method, in this way: if (rot == 270) { // Rotate clockwise 270 degrees Core.flip(mat.t(), mat, 0); } else if (rot == 180) { // Rotate clockwise 180 degrees Core.flip(mat, mat, -1); } else if (rot == 90) { // Rotate clockwise 90 degrees Core.flip(mat.t(), mat, 1); } See here for more details: http://www.technolabsz.com/2012/08/how-to-flip-image-in-opencv.html

sp_mic88 gravatar imagesp_mic88 ( 2013-09-11 01:20:59 -0500 )edit