OK, just after I posted this, I happened to look at the OpenCV build.gradle file that had this comment:
// Load OpenCV native library before using:
//
// - avoid using of "OpenCVLoader.initAsync()" approach - it is deprecated
// It may load library with different version (from OpenCV Android Manager, which is installed separatelly on device)
//
// - use "System.loadLibrary("opencv_java4")" or "OpenCVLoader.initDebug()"
So, now, I just have:
static {
System.loadLibrary("opencv_java4");
}
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentFirstBinding.inflate(inflater, container, false);
Log.d(TAG, "OpenCV loaded: "+ OpenCVLoader.initDebug());
if (OpenCVLoader.initDebug()) {
binding.mainCamera.setCameraIndex(CameraBridgeViewBase.CAMERA_ID_BACK);
binding.mainCamera.setCameraPermissionGranted();
binding.mainCamera.enableView();
}
return binding.getRoot();
}
And the preview pane opened ![]()
Only issue I now have is that the preview pane is in landscape mode. Any idea if I can get it to portrait mode?