Google Photos vs Stock Gallery – Intent Picker

Solution First, update the photoPickerIntent to use ACTION_GET_CONTENT, and remove the extras related to cropping, since cropping will be handled by another Intent later: Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT); photoPickerIntent.setType(“image/*”); // Do not include the extras related to cropping here; // this Intent is for selecting the image only. startActivityForResult(photoPickerIntent, RESULT_LOAD_IMAGE); Then, onActivityResult() will have … Read more

Prevent flipping of the front facing camera

If you want to use a front-facing camera for barcode scanning you can use TextureView and apply a transformation matrix to it. When the texture is updated you can read the image data and use that. See https://github.com/hadders/camera-reverse Specifically from MainActivity.java mCamera.setDisplayOrientation(90); Matrix matrix = new Matrix(); matrix.setScale(-1, 1); matrix.postTranslate(width, 0); mTextureView.setTransform(matrix);

How to capture raw image from android camera

The android (at least mine) has 2 camera parameters “rawsave-mode” and “rawfname”, with the default rawsave-mode=0. By setting rawsave-mode=1, the camera will save the raw camera image file, along with performing the other camera functions as usual. Camera.Parameters parameters=preview.camera.getParameters(); parameters.set(“rawsave-mode”, “1”); parameters.set(“rawfname”, “/mnt/sdcard/test.raw”); preview.camera.setParameters(parameters); preview.camera.takePicture(shutterCallback, null, jpegCallback); The actual name of the file produced get … Read more

Google Vision API Samples: Get the CameraSource to Focus

I modified the CameraSourcePreview (….) constructor to be as follows: public CameraSourcePreview(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; mStartRequested = false; mSurfaceAvailable = false; mSurfaceView = new SurfaceView(context); mSurfaceView.getHolder().addCallback(new SurfaceCallback()); addView(mSurfaceView); mSurfaceView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { cameraFocus(mCameraSource, Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } }); } private static boolean cameraFocus(@NonNull CameraSource cameraSource, @NonNull … Read more

How to use camera flash/led as torch on a Samsung Galaxy Tab?

You aren’t doing anything wrong. In fact, you are doing everything correct. You are encountering a Device-Specific issue that is very prevalent in the Android world. I have found the following behavioral patterns for FLASH_MODE_TORCH: Works fine in all cases Works fine, but not with autofocus on Doesn’t work at all Frustratingly, getSupportedFlashModes() will return … Read more

iOS: Capture image from front facing camera

How to capture an image using the AVFoundation front-facing camera: Development Caveats: Check your app and image orientation settings carefully AVFoundation and its associated frameworks are nasty behemoths and very difficult to understand/implement. I’ve made my code as lean as possible, but please check out this excellent tutorial for a better explanation (website not available … Read more