In my case, I don't need to show the preview to the user and would like to capture the image from the service, to achieve this I have used ImageFormat .JPG
to capture the images but output images are really very dark. I have tried this link in StackOverflow but it is not working.
val streamConfigurationMap =
mCameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP) // Available stream configuration.
mPreviewSize = streamConfigurationMap!!.getOutputSizes(ImageFormat.JPEG)[0]
mCameraID = cameraId
mImageReader =
ImageReader.newInstance(mPreviewSize!!.width, mPreviewSize!!.height, ImageFormat.JPEG, 1)
mImageReader!!.setOnImageAvailableListener(onImageAvailable, mBackgroundHandler)
If I use the dummy surface texture view getting below error, after few seconds of app launch
E/BufferQueueProducer: [SurfaceTexture-1-20857-1] cancelBuffer: BufferQueue has been abandoned