[英]How to set zoom android camera vision.barcode-scanner API
I am making a barcode scanner app using the vision.barcodereader API. 我正在使用vision.barcodereader API制作条形码扫描器应用程序。 I was wondering how to set my cameraSource's zoom programattically, so that the zoom camera zoom starts at a specific zoom ie 25%.
我想知道如何以编程方式设置我的cameraSource的缩放比例,以便缩放相机的缩放比例从特定的缩放比例开始,即25%。 Also, the zoom does not have to be adjustable, so I am only asking how to fix it on a specific zoom.
另外,缩放不必一定是可调的,所以我只问如何将其固定在特定的缩放上。 My target API is 24, with the min API at 21, and the following code has not worked so far.
我的目标API是24,最小API是21,到目前为止,以下代码尚不可用。 If you could possibly answer with a code snippet for zooming the camera as described that would be fantastic.
如果您可以按照说明对相机进行缩放的代码段进行回答,那将是很棒的。 Thanks!
谢谢!
@Override
public void onStart(){
int maxZoom= parameters.getMaxZoom();
parameters.setZoom(maxZoom);
camera.setParameters(parameters);
}
Apparently depends on your API level: 显然取决于您的API级别:
public class Camera.Parameters
extends Object
java.lang.Object
↳ android.hardware.Camera.Parameters
void setZoom(int value) //Sets current zoom value.
Because it was too easy to find in the documentation this way, I guess they had to change it: 因为以这种方式在文档中太容易找到了,所以我想他们必须更改它:
This class was deprecated in API level 21. We recommend using the new android.hardware.camera2 API for new applications. 该类在API级别21中已弃用。我们建议对新应用程序使用新的android.hardware.camera2 API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.