更新时间:2023-02-02 14:59:53
好的,我发现这是一个解决方案:
Ok, I found this as a solution:
首先我进入 OpenCV 库 - 2.4.5
然后在 mCamera.startPreview();
之前的 initializeCamera()
函数中,我添加了这两个函数:
and then in initializeCamera()
function before mCamera.startPreview();
I added these 2 function:
setDisplayOrientation(mCamera, 90);
mCamera.setPreviewDisplay(getHolder());
第一个函数是这样实现的:
and the first function implemented like this:
protected void setDisplayOrientation(Camera camera, int angle){
Method downPolymorphic;
try
{
downPolymorphic = camera.getClass().getMethod("setDisplayOrientation", new Class[] { int.class });
if (downPolymorphic != null)
downPolymorphic.invoke(camera, new Object[] { angle });
}
catch (Exception e1)
{
e1.printStackTrace();
}
}
我只是提醒我使用 OpenCV.
I just reminding that I work with OpenCV.
希望这对某人有所帮助.
Hope this help someone.