Having issues with manual camera/sensor control (AE + AWB off) with CameraX via the Camera2Interop.
I'm attempting to ensure my test device is capiable of manual control of SENSOR_SENSITIVITY. For when AE is set to off the image is way too dark, and when SENSOR_SENSITIVITY is at maximum it's better but still too dark and with noise. That is, without boosted SENSOR_SENSITIVITY I can only get an image by pointing directly at light bulb, so I'm assuming that when I boost SENSOR_SENSITIVITY there is no analog boost, and it's only digitally boosting the signal which gives it noise at maximum.
In attempting to find examples of testing my device's SENSOR_SENSITIVITY range I found this code:
// Returns true if the device supports the required hardware level, or better.
boolean isHardwareLevelSupported(CameraCharacteristics c, int requiredLevel) {
final int[] sortedHwLevels = {
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL,
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_3
};
int deviceLevel = c.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
Toast.makeText(this, deviceLevel, Toast.LENGTH_LONG).show();
if (requiredLevel == deviceLevel) {
return true;
}
for (int sortedlevel : sortedHwLevels) {
if (sortedlevel == requiredLevel) {
return true;
} else if (sortedlevel == deviceLevel) {
return false;
}
}
return false; // Should never reach here
}
However, I'm having issues calling it. How do I declare CameraCharacteristics in the context of CameraX and for the purpose of this code? This was my attempt based on example code:
CameraManager manager = (CameraManager) this.getSystemService(Context.CAMERA_SERVICE);
//String mCameraId = manager.getCameraIdList();
CameraCharacteristics c = manager.getCameraCharacteristics(mCameraId);
isHardwareLevelSupported(c,3);
The example code brought me to the issue of declaring and initializing mCameraId.
This was another attempt at checking:
Range<Integer> range = mCameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE);
int max = range.getUpper();
int min = range.getLower();
I'm probably missing something simple. Most examples I find have been in the context of Camera2 or in Koltin which I was having issues translating to Java.