Android Camera2 - CONTROL_AE_REGIONS无法在三星设备上工作
使用Android Camera2时,我想在计算曝光时使用区域忽略图像的前25%。我正在使用这个:Android Camera2 - CONTROL_AE_REGIONS无法在三星设备上工作
// Compute the metering rectangle to ignore the top 25% of the picture:
Rect newRect = new Rect(mActiveArraySize.left, (int) (mActiveArraySize.height() * 0.25), mActiveArraySize.right, mActiveArraySize.bottom);
MeteringRectangle meteringRectangle = new MeteringRectangle(newRect, 1);
MeteringRectangle[] meteringRectangleArr = { meteringRectangle };
// Set the metering rectangle:
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_REGIONS, meteringRectangleArr);
// Set the request:
try { mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), null, mBackgroundHandler); }
catch (CameraAccessException e) { e.printStackTrace(); }
它在使用我的Nexus 5X。但是在三星Galaxy Note 5上(我想所有的三星设备)都不起作用,我的区域被忽略了。
我看到了这样一个问题:Android Camera2 API - Set AE-regions not working,这位同事说他设法通过使用三星SDK来实现它。我真的希望避免这种情况。
有人设法让AE区域与三星设备一起工作吗?
最近我有同样的问题,并最终找到了一个解决方案,帮助我。
我所需要做的就是从活动传感器矩形的边缘步进1个像素。在你的榜样,而不是这个矩形:由于有源阵列的botommost像素mActiveArraySize.height() - 1
Rect newRect = new Rect(mActiveArraySize.left + 1,
(int)(mActiveArraySize.height() * 0.25),
mActiveArraySize.right + 1,
mActiveArraySize.bottom - 2);
我减去2
从底部的,我需要减去:
Rect newRect = new Rect(mActiveArraySize.left,
(int) (mActiveArraySize.height() * 0.25),
mActiveArraySize.right,
mActiveArraySize.bottom);
我会用这多一个像素。
似乎很多厂商已经执行不力的documentation
这部分当测量区域外使用android.scaler.cropRegion在捕捉结果返回的元数据,相机设备将忽略外的部分裁剪区域并仅输出交集矩形作为结果元数据中的测量区域。如果该区域完全位于裁剪区域之外,它将被忽略,并且不会在结果元数据中报告。
非常感谢,我会尽力并接受你的答案,如果它适合我!您可能节省了我数周的时间来实施三星的SDK ... –
我有同样的问题。顺便说一句,你是否设置了CONTROL_AE_PRECAPTURE_TRIGGER,CONTROL_AE_MODE,CONTROL_AE_LOCK参数中的任何一个? – Mikhail