Rotate camera preview to Portrait Android OpenCV Camera

I had the same problem trying to implement OpenCV. I was able to fix it by making the following changes to the deliverAndDrawFrame method. Rotate the canvas object Canvas canvas = getHolder().lockCanvas(); // Rotate canvas to 90 degrees canvas.rotate(90f, canvas.getWidth()/2, canvas.getHeight()/2); Resize the bitmap to fit entire size of canvas before drawing // Resize Bitmap … Read more

How to get the Correct orientation of the image selected from the Default Image gallery

If the image(photo) was taken by a program made by you, you must set Parameters.setRotation with the correct rotation value. This, depending of camera drive, rotates the image before save or save the rotation value to exif TAG_ORIENTATION. Therefore, if TAG_ORIENTATION is null or zero, the image are in the correct orientation, otherwise you must … Read more

What can I do when the BufferQueue has been abandoned?

What you’re doing is essentially what’s written in the TextureView docs, so it should work. The error message means that the “producer” side of the BufferQueue (the camera) grabbed a buffer, and is now trying to un-grab it (via cancelBuffer()). However, the “consumer” side (the SurfaceTexture) has gone away. Because the “consumer” side owns the … Read more

How to compress image size?

You can create bitmap with captured image as below: Bitmap bitmap = Bitmap.createScaledBitmap(capturedImage, width, height, true); Here you can specify width and height of the bitmap that you want to set to your ImageView. The height and width you can set according to the screen dpi of the device also, by reading the screen dpi … Read more

Apply effect to video frame captured by camera

you can make the parameter of camera, and then apply colorfilter to the parameter to get the different effect, but first you have to check the supported colorfilter for your device, basically it is device dependent. Camera.Parameters p = camera.getParameters(); camera.Parameters parameters = camera.getParameters(); //this will provide the supporting parameter for your device. p.setSceneMode(Camera.Parameters.FLASH_MODE_AUTO); //it … Read more