I am Calculating the camera Megapixel
by using the maximum resolution of camera picture is always NOT giving the correct result.
i.e Micromax Bolt A35 device specification shows 2MP(Mega Pixel) but it gives 2592 x 1936 resolution picture. ((2592x1936)/102400)= approximate 5MP.
eg: My Mobile Phone model is Samsung galaxy star pro GT-S7262. and this mobile specification details shows Samsung website/user manual/purchased box having printed only 2MP, but when i am getting max resolution of this mobile is 2048x1536. so it gives approximately 3.072MP by following the below code. so finally i said that below procedure is Not always gives correct result. please help me to find out correct megapixes in android mobile.
private int getCameraMinPixels(Camera.Parameters parameters) {
float cameraMegaPixel = 0;
if(parameters!=null)
{
Camera.Size size =parameters.getPictureSize();
cameraMegaPixel = (float) (size.height * size.width) / 1024000f;
}
return (int) cameraMegaPixel;
}
Please help me to find camera megapixel.
and i use getall supported picture sizes is
private List<Camera.Size> getSortedCameraSupportedPictureSizes(Camera.Parameters parameters)
{
List<Camera.Size> supportedPreviewSizes = new ArrayList<Camera.Size>(
parameters.getSupportedPictureSizes());
Collections.sort(supportedPreviewSizes, new Comparator<Camera.Size>() {
@Override
public int compare(Camera.Size a, Camera.Size b) {
int aPixels = a.height * a.width;
int bPixels = b.height * b.width;
if (bPixels < aPixels) {
return -1;
}
if (bPixels > aPixels) {
return 1;
}
return 0;
}
});
return supportedPreviewSizes;
}