我搜索了过去两天,但我还没有成功。以编程方式查找手机的相机像素
我的情况,我想检查相机的像素分辨率/百万像素。如果相机的Mp超过4,那么我需要重新调整大小并上传。
这里是我的代码:
//to check the resolution
Camera mcamera ;
mcamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
Camera.Parameters param = mcamera.getParameters();
Camera.Size size = param.getPictureSize();
cam_height = size.height ;
cam_width = size.width ;
mcamera.release();
// my functionality
BitmapFactory.Options resample = new BitmapFactory.Options();
if(cam_height > pict_height || cam_width > pict_width)
resample.inSampleSize = 2; // whatever number seems appropriate 2 means 1/2 of the original
else
resample.inSampleSize = 1;
capturedimg = BitmapFactory.decodeFile(fileUri.getPath() , resample);
resized_uri = bitmaptouri(capturedimg);
但这仅返回画面分辨率是一样的手机的屏幕分辨率,但我想移动摄像机的分辨率。
欢迎任何相关的答案,在此先感谢。
检查http://stackoverflow.com/questions/6952469/determining-camera-resolution-ie-megapixels-programatically-in-android – 2013-06-20 04:42:58
我尝试过,我有也发布了代码。它没有工作。 – VIGNESH
你的意思是百万像素。 – Riser