List of usage examples for android.hardware.camera2 CaptureResult JPEG_ORIENTATION
Key JPEG_ORIENTATION
To view the source code for android.hardware.camera2 CaptureResult JPEG_ORIENTATION.
Click Source Link
The orientation for a JPEG image.
The clockwise rotation angle in degrees, relative to the orientation to the camera, that the JPEG picture needs to be rotated by, to be viewed upright.
Camera devices may either encode this value into the JPEG EXIF header, or rotate the image data to match this orientation.
From source file:freed.cam.apis.camera2.modules.PictureModuleApi2.java
@NonNull private void process_rawSensor(ImageHolder image, File file) { Log.d(TAG, "Create DNG"); DngCreator dngCreator = new DngCreator(cameraHolder.characteristics, image.getCaptureResult()); //Orientation 90 is not a valid EXIF orientation value, fuck off that is valid! try {//from w w w .j a v a 2s .co m dngCreator.setOrientation(image.captureResult.get(CaptureResult.JPEG_ORIENTATION)); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } if (appSettingsManager.getApiString(AppSettingsManager.SETTING_LOCATION).equals(KEYS.ON)) dngCreator .setLocation(cameraUiWrapper.getActivityInterface().getLocationHandler().getCurrentLocation()); try { if (!appSettingsManager.GetWriteExternal()) dngCreator.writeImage(new FileOutputStream(file), image.getImage()); else { DocumentFile df = cameraUiWrapper.getActivityInterface().getFreeDcamDocumentFolder(); DocumentFile wr = df.createFile("image/*", file.getName()); dngCreator.writeImage( cameraUiWrapper.getContext().getContentResolver().openOutputStream(wr.getUri()), image.getImage()); } cameraUiWrapper.getActivityInterface().ScanFile(file); } catch (IOException ex) { ex.printStackTrace(); } image.getImage().close(); image = null; }
From source file:freed.cam.apis.camera2.modules.PictureModuleApi2.java
@NonNull private void process_rawWithDngConverter(ImageHolder image, int rawFormat, File file) { Log.d(TAG, "Create DNG VIA RAw2DNG"); ByteBuffer buffer = image.getImage().getPlanes()[0].getBuffer(); byte[] bytes = new byte[buffer.remaining()]; buffer.get(bytes);/*from w w w . j ava 2 s . c o m*/ float fnum, focal = 0; fnum = image.getCaptureResult().get(CaptureResult.LENS_APERTURE); focal = image.getCaptureResult().get(CaptureResult.LENS_FOCAL_LENGTH); Log.d("Freedcam RawCM2", String.valueOf(bytes.length)); int mISO = image.getCaptureResult().get(CaptureResult.SENSOR_SENSITIVITY).intValue(); double mExposuretime = image.getCaptureResult().get(CaptureResult.SENSOR_EXPOSURE_TIME).doubleValue(); // int mFlash = image.getCaptureResult().get(CaptureResult.FLASH_STATE).intValue(); // double exposurecompensation= image.getCaptureResult().get(CaptureResult.CONTROL_AE_EXPOSURE_COMPENSATION).doubleValue(); final DngProfile prof = getDngProfile(rawFormat, image); saveRawToDng(file, bytes, fnum, focal, (float) mExposuretime, mISO, image.captureResult.get(CaptureResult.JPEG_ORIENTATION), null, prof); image.getImage().close(); bytes = null; buffer = null; image = null; }