0
내 앱에서 Android 휴대 전화의 해상도를 파악하려고합니다. 내가 카메라의 해상도 찾기 프로그래밍 방식으로
public float getBackCameraResolutionInMp() {
try {
int noOfCameras = Camera.getNumberOfCameras();
float maxResolution = -1;
long pixelCount = -1;
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
Camera.getCameraInfo(BACK_CAMERA_ID, cameraInfo);
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
try {
releaseCameraAndPreview();
if (camera == null) {
camera = Camera.open(BACK_CAMERA_ID);
}
Camera.Parameters cameraParams = camera.getParameters();
for (int j = 0; j < cameraParams.getSupportedPictureSizes().size(); j++) {
long pixelCountTemp = cameraParams.getSupportedPictureSizes().get(j).width * cameraParams.getSupportedPictureSizes().get(j).height; // Just changed i to j in this loop
if (pixelCountTemp > pixelCount) {
pixelCount = pixelCountTemp;
maxResolution = ((float) pixelCountTemp)/(1024000.0f);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return maxResolution;
} catch (Exception e) {
logException(e, "CameraInfoFragment_getBackCameraResolutionInMp()");
return -1;
}
}
을 사용하고 있었다 그러나 그렇지 않은 나에게 정확한을 대략 해상도를 반환
. 해상도가 16MP 인 것처럼 15.55MP를 반환합니다. 카메라의 정확한 해상도를 푸는 방법을 알려주십시오.
[카메라의 실제 카메라 최대 메가 픽셀을 얻는 방법] (https://stackoverflow.com/questions/25590721/how-to-get-real-camera-max-megapixels-of-a-)의 가능한 복제본 장치) –