New to Android and OpenCV. Been trying to to implement code from new book, Mastering OpenCV with Practical Computer Vision Projects. The app basically renders carto
This issue was workarounded in OpenCV some time ago.
Not sure if it is application or OS bug. The problem is that call to Bitmap.createBitmap
detaches SurfaceTexture
object used for visualization.
The workaround was to modify the setupCamera method of the base View
class and change
try {
setPreview();
} catch (IOException e) {
Log.e(TAG, "mCamera.setPreviewDisplay/setPreviewTexture fails: " + e);
}
/* Notify that the preview is about to be started and deliver preview size */
onPreviewStarted(params.getPreviewSize().width, params.getPreviewSize().height);
to
/* Notify that the preview is about to be started and deliver preview size */
onPreviewStarted(params.getPreviewSize().width, params.getPreviewSize().height);
try {
setPreview();
} catch (IOException e) {
Log.e(TAG, "mCamera.setPreviewDisplay/setPreviewTexture fails: " + e);
}
(the order of lines is changed)