我知道之前已经问过这个问题,但是,我找不到任何有效的解决方案.
在Nexus 6前置摄像头始终显示在我的应用程序倒置.一些解决方案是使用" setDisplayOrientation",它会在屏幕上翻转相机.但是,我们使用frames收到的视频对视频进行编码onPreviewFrame.
按照Android SDK Documentation,setDisplayOrientation实际上并没有改变byte[]在onPreviewFrame.
这不会影响onPreviewFrame(byte [],Camera),JPEG图片或录制视频中传递的字节数组的顺序.在预览期间不允许调用此方法.
如果无法获得Nexus 6前置摄像头onPreviewFrame框架correct orientation,那么fastest翻转每个框架的方式是什么,而不会出现fps下降.
谢谢!
我能够通过使用 open cv 翻转帧来解决这个问题并保持较高的 fps。
yuvimage = opencv_core.IplImage.create(frame.getWith / 2, frame.getHeight / 2 * 3 / 2, IPL_DEPTH_8U, 1);
yuvimage.getByteBuffer().clear();
yuvimage.getByteBuffer().put(halveYUV420(frame.getData(), frame.getWidth(), frame.getHeight()));
rgbimage = opencv_core.IplImage.create(frame.getWidth / 2, frame.getHeight / 2, IPL_DEPTH_8U, 3);
rgbimage.getByteBuffer().clear();
opencv_imgproc.cvCvtColor(yuvimage, rgbimage, opencv_imgproc.CV_YUV2BGR_NV21);
opencv_core.cvFlip(rgbimage, rgbimage, 0);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2252 次 |
| 最近记录: |