MOTO702上关于拍照Camera参数设置问题【原创】

无限666 2010-10-29 11:55:16
[align=left]
Android的自定义拍照(HTC,MOTO702)
注:Camera本人已经抽象出来(工厂)

/**
* 此类完成的功能:
* <ul>
* <li>拍照并保存相片</li>
* <li>记录拍照方位</li>
* </ul>
* @author 啊新
*
*/
private void goTakeMyPicture(){
try{
if (!isTaken) {
isTaken = true;
try{
mSensorManager.unregisterListener(mSensorListener);
}catch(Exception e){}
//计算方位,度数
fBearing =(float) (fBearing*180/3.14);// 57.32=180 / 3.14
if (fBearing < 0) fBearing +=360;
mCameraOrientation =(int)(mCameraOrientation*180/3.14) + 90;
angle = roundOrientation((int)mCameraOrientation);
try{
moreCamera.getParameters();
moreCamera.setPictureFormat(PixelFormat.JPEG);
if(mobileinfo.equals(SystemSetting.MOBILE_Manufacturer.MOTO)){
MyLog.debug(getClass(), "orientation ok...");
moreCamera.setOrientation();
}
moreCamera.setRotation(angle); //这里进行了图片的旋转
moreCamera.removeGpsData();
moreCamera.setJpegQuality(jpegQuality);
moreCamera.saveParameters();
mCamera.takePicture(null, null, null,Capture.this);//需要花费1秒钟
}catch(Exception e){ }
}
}catch(Exception e){
finish();
}catch(Error e){
finish();
}
}
private int roundOrientation(int orientationInput) {
int orientation = orientationInput;
if (orientation == OrientationEventListener.ORIENTATION_UNKNOWN) {
orientation = 0;
}
orientation = orientation % 360;
int retVal;
if (orientation < 45) {
retVal = 0;
} else if (orientation <135) {//90+45
retVal = 90;
} else if (orientation < 225) {//180+45
retVal = 180;
} else if (orientation < 315) {//270+45
retVal = 270;
} else {
retVal = 0;
}


HTC相机像素最大缩放设置参数为 parameters.getInt("zoom-max");
MOTO相机像素最大缩放设置参数为 parameters.getInt("max-zoom");
----------MOTO真要命啊,好好的一个非得改反,如果不查看系统相机log还真抓狂

这样在MOTO702上就OK了,HTC机型上无需设置moreCamera.getParameters().set("orientation", "portrait")置此参数
类似此问题还有http://code.google.com/p/android/issues/detail?id=1193
[/align]
...全文
235 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
传智二哥 2011-09-20
  • 打赏
  • 举报
回复
我在做相机开发,想设置其焦距
Camera.getParameters().isZoomSupported() -->true
Camera.getParameters().isSmoothZoomSupported() -->false

这种情况下,我怎么才能实现变焦呢??

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧