I am currently developing an application which use Camera2. I display the preview on a TextureView which is scaled and translated (I only need to display a part of the image). My problem is that I need to analyze the entire image.
What I have in my CameraDevice.StateCallback :
@Override
public void onOpened(CameraDevice camera) {
mCameraDevice = camera;
SurfaceTexture texture = mTextureView.getSurfaceTexture();
texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
Surface surface = new Surface(texture);
try {
mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
} catch (CameraAccessException e){
e.printStackTrace();
}
try {
mCameraDevice.createCaptureSession(Arrays.asList(surface), mPreviewStateCallback, null);
mPreviewBuilder.addTarget(surfaceFull);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
and in my SurfaceTextureListener :
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
my_analyze(mTextureView.getBitmap());
}
});
thread.start();
}
And the bitmap is only what I see in the TextureView (which is logical) but I want the entire image.
Is it possible ?
Thanks, NiCLO