CameraX ImageAnalysis将TargetResolution设置为小于640x480 [英] CameraX ImageAnalysis set TargetResolution smaller than 640x480

查看:960
本文介绍了CameraX ImageAnalysis将TargetResolution设置为小于640x480的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过将480x360图像提供给CameraX的ImageAnalysis来提高面部检测率.但是,以下代码会产生640x480的图像,从而将检测速度降低到10 fps.如果我提供480x360,则可以将速率提高到20.

I am trying to improve face detection rate by givining a 480x360 image to the ImageAnalysis of CameraX. However the following code produces 640x480 image, which reduces detection to 10 fps. If I give 480x360 I can improve rate to 20.

  1. 如何获得较小的目标分辨率和默认值

  1. How can I get smaller target resolution and the defualt

是否在那里以prweview形式显示我进行图像分析所获得的图像.与预览用例相反.这样一来,人脸检测在预览时就不会有太大的滞后.

Is there away to show the image I got for image anaysis as the prweview. As oppose to previews usecase. This is so that face detection overaly will not have big lag with the preview.

ImageAnalysis imageAnalysis = 建造者 .setTargetResolution(新大小(360,480)) .setTargetRotation(旋转) .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST) .build();

ImageAnalysis imageAnalysis = builder .setTargetResolution(new Size(360, 480)) .setTargetRotation(rotation) .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST) .build();

推荐答案

如何获得较小的目标分辨率和默认值

How can I get smaller target resolution and the defualt

根据 docs 应该为640x480.

The default as per the docs should be 640x480.

关于如何获得较小的目标分辨率,我可以想象三种可能性.

As to how to get smaller target resolutions, there are three possibilities I could imagine.

  1. 您错误地在行下某处引用了imageAnalysis对象,它忽略了您的构建器,并且默认使用的默认分辨率为640x480.
  2. 您的相机不支持Size(360,480)分辨率,支持的最接近的分辨率是640x480.
  3. 您以错误的顺序引用了大小,即大小(360,480)可能会导致选择的分辨率不同于大小(480,360). (您在问题中的两个命令中都引用了它们.)

根据文档

目标分辨率尝试为图像分辨率建立最小范围.实际图像分辨率将是尺寸为且不小于目标分辨率的最接近的可用分辨率,具体取决于Camera的实现.但是,如果不存在等于或大于目标分辨率的分辨率,则会选择小于目标分辨率的最接近的可用分辨率.

The target resolution attempts to establish a minimum bound for the image resolution. The actual image resolution will be the closest available resolution in size that is not smaller than the target resolution, as determined by the Camera implementation. However, if no resolution exists that is equal to or larger than the target resolution, the nearest available resolution smaller than the target resolution will be chosen.

因此,我会尝试一些较小的尺寸,例如大小(200、200),然后查看支持哪些更小的分辨率,然后从那里放大.

So, I'd try a few smaller sizes, e.g. Size(200, 200) and see what smaller resolutions are supported and scale up from there.

有没有一种方法可以将我进行图像分析时得到的图像显示为prweview.与预览用例相反.这样一来,人脸检测在预览时就不会有太大的滞后.

Is there a way to show the image I got for image anaysis as the prweview. As oppose to previews usecase. This is so that face detection overaly will not have big lag with the preview.

我不确定您为什么会认为这样做会更快,因为看起来这将使操作序列化而不是同步进行.

I'm not sure why you assume that would be faster, as it would seem this would serialize the operations rather than doing them synchronously.

如果您需要进一步的帮助,请提供有关创建ImageAnalysis实例的所有代码.

If you want further help on this, please provide all your code surrounding the creation of your ImageAnalysis instance.

这篇关于CameraX ImageAnalysis将TargetResolution设置为小于640x480的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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