private void capture() {
// Set rotation.
mParameters.setRotation(mLastOrientation);
....................
.....................
mCameraDevice.setParameters(mParameters);
mCameraDevice.takePicture(mShutterCallback, mRawPictureCallback, mPostViewPictureCallback, new JpegPictureCallback(loc));
}
private final class JpegPictureCallback implements PictureCallback {
public void onPictureTaken(final byte[] jpegData, final android.hardware.Camera camera) {
//jpegData为JPEG数据,是由HAL层根据应用传输的各种参数(即Camera.Parameters的实例)以及JPEG压缩算法生成的。
mImageCapture.storeImage(jpegData, camera, mLocation);
}
}
public static int getExifOrientation(String filepath) {
int degree = 0;
ExifInterface exif = null;
try {
exif = new ExifInterface(filepath);
} catch (IOException ex) {
Log.e(TAG, "cannot read exif", ex);
}
if (exif != null) {
int orientation = exif.getAttributeInt(
ExifInterface.TAG_ORIENTATION, -1);
if (orientation != -1) {
// We only recognize a subset of orientation tag values.
switch(orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
}
}
}
return degree;
}
else if(orientation == 0 && EXIF_ORIENTATION != 0) {
switch (EXIF_ORIENTATION) {
case 90:
orientation = ExifInterface.ORIENTATION_ROTATE_90;
degree = 90;
break;
case 180:
orientation = ExifInterface.ORIENTATION_ROTATE_180;
degree = 180;
break;
case 270:
orientation = ExifInterface.ORIENTATION_ROTATE_270;
degree = 270;
break;
}
exif.setAttribute(ExifInterface.TAG_ORIENTATION, Integer.toString(orientation));
try {
exif.saveAttributes();
} catch (IOException e) {
Log.e(TAG, "cannot save exif", e);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有