[英]Android Camera2 - CONTROL_AE_REGIONS not working on Samsung devices
使用Android Camera2,我想在計算曝光時使用區域忽略圖像的前25%。 我正在使用這個:
// 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上運行。 但是在Samsung Galaxy Note 5(我猜是在所有Samsung設備上)上,它不起作用,我的區域被忽略了。
我看到了一個問題: Android Camera2 API-設置AE區域不起作用 ,操作人員說他設法使用Samsung SDK使其起作用。 我真的更喜歡避免這種情況。
是否有人設法使AE地區與Samsung設備兼容?
最近,我遇到了同樣的問題,終於找到了對我有幫助的解決方案。
我需要做的就是從活動傳感器矩形的邊緣開始移動1個像素。 在您的示例中,代替此矩形:
Rect newRect = new Rect(mActiveArraySize.left,
(int) (mActiveArraySize.height() * 0.25),
mActiveArraySize.right,
mActiveArraySize.bottom);
我會用這個:
Rect newRect = new Rect(mActiveArraySize.left + 1,
(int)(mActiveArraySize.height() * 0.25),
mActiveArraySize.right + 1,
mActiveArraySize.bottom - 2);
我從底部減去2
,因為活動數組的最底部像素是mActiveArraySize.height() - 1
,我需要再減去一個像素。
似乎許多供應商都沒有很好地實施文檔的這一部分
如果測光區域在捕獲結果元數據中返回的使用的android.scaler.cropRegion之外,則攝像頭設備將忽略裁剪區域之外的部分,僅在結果元數據中輸出交點矩形作為測光區域。 如果該區域完全位於作物區域之外,則它將被忽略並且不會在結果元數據中報告。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.