Android + OpenCV:使用CameraBridgeViewBase时如何设置相机分辨率 [英] Android + OpenCV: How to set camera resolution when using CameraBridgeViewBase

查看:868
本文介绍了Android + OpenCV:使用CameraBridgeViewBase时如何设置相机分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用OpenCV4Android人脸检测示例.我想知道如何获取相机的分辨率并将其设置为其他值.在此示例中,CameraBridgeViewBase.

我在物体上看到了

private CameraBridgeViewBase   mOpenCvCameraView;

我可以使用

mOpenCvCameraView.setLayoutParams(); 

但是每次我尝试以某种方式使用它时,我做错了,我的程序崩溃了.请帮助我解决这个问题.

解决方案

尝试mOpenCvCameraView.setMaxFrameSize(width, height);

mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view);

之后的OnCreate()中的

我尝试并在2.4.6教程2中获得成功.

顺便说一句,请先检查您的手机摄像头支持的分辨率.

Hello I am using OpenCV4Android face detection sample. I would like to know how can I get my resolution of camera and set it to other value. In this example CameraBridgeViewBase.

I see that on object

private CameraBridgeViewBase   mOpenCvCameraView;

I can use

mOpenCvCameraView.setLayoutParams(); 

but every time I try to use it in some way I'm doing it wrong and my program crashes. Please help me with that problem.

解决方案

try mOpenCvCameraView.setMaxFrameSize(width, height);

in the OnCreate() after mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view);

I try and success in 2.4.6 tutorial 2.

BTW, check your phone camera supporting resolutions first.

这篇关于Android + OpenCV:使用CameraBridgeViewBase时如何设置相机分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆