OpenCV vertical screen problem --- why does setDisplayOrientation(90) not take effect?

OpenCV vertical screen problem

Why does camera.setDisplayOrientation(90) not take effect?

I believe that many colleagues who study OpenCV have tried the vertical screen problem, tried many solutions, including software rotation and stretching images, etc., and the efficiency is also high or low-but no matter which solution has performance loss, it cannot reach the system camera. A smooth feeling. Among all possible solutions, camera.setDisplayOrientation(90) is the most likely to not lose any performance, but calling this method in the code does not take effect.

After testing, the author found that: camera.setDisplayOrientation(90) in my customized camera can rotate the image to the vertical screen, so the problem lies in OpenCV.

After further studying the code, we found that in customizing the camera, a SurfaceView is applied, and then its member SurfaceHolder mSurfaceHolder is handed over to the camera to complete the display. At this time, it is effective to call setDisplayOrientation; and when we process data in real time, what we get is also a horizontal screen .
In OpenCV, its image is actually the horizontal screen data converted and processed by itself, and then stretched and displayed on the screen.

Conclusion: Based on the current structure of OpenCV4Android, it is completely wrong to try to achieve real-time rotation through setDisplayOrientation.

Supongo que te gusta

Origin blog.csdn.net/fulszcd/article/details/55094528
Recomendado
Clasificación