So I have this camera preview set up with Camera, SurfaceView and SurfaceHolder.
I have also an ImageView where I will be putting a modified version of the camera image and I want this to update lets say once every second.
All code is ready and already working when I load images from "res" but I have a really hard time reading the image data from the camera.
I've tried following already:
Creating an
intentforMediaStore.ACTION_IMAGE_CAPTUREand starting anonActivityResultgetting a small thumbnail (enough for me actually) from(Bitmap)data.getExtras().get("data")
The problem is that this opens the camera App and you need to "manually" take a picture.Creating a
Camera.PreviewCallback, taking theYuvImage, and converting it to an image usingYuvImage.compressToJpeg(...).
The problem here is that I can't get it to start no matter when or where i put theCamera.setPreviewCallbackWithBuffer(PreviewCallback).- Try to take the data directly from
PreviewHolderby locking in to the canvas usinglockCanvas()and trying to convert it to a bitmap
Obviously Doesn't work.
Edit: What is the best way to make this work? I mean QR-Code readers must read the image data out of the camera continuously, how do they work?