I have a problem with cameraview opencv on android, on android device type samsung camera view doesn't fit there is a black cut like picture 1 while on android device type xiaomi and realme it's safe like picture 2. I took the middle resolution from supportPreviewSize and set the maxFrameSize to a ratio of 1:1, how can the camera view size be compatible with all current android devices? is this purely because my code is still wrong or is it the camera settings of the android device itself?
setResolution() :
mCamera = android.hardware.Camera.open();Camera.Parameters params = mCamera.getParameters();
List<Camera.Size> listSizes = params.getSupportedPreviewSizes();
List<Camera.Size> listCapture = params.getSupportedPictureSizes();
int midResolution = listSizes.size() / 2;
cameraSize = listSizes.get(midResolution);
params.setPictureSize(cameraSize.width, cameraSize.height);
params.setVideoStabilization(true);
params.setPreviewSize(cameraSize.width, cameraSize.height);
mCamera.setParameters(params);
mCamera.startPreview();
setMaxFrameSize :
jCameraView.setResolution();
Camera.Size sizeMaxFrame = jCameraView.getSizeCamera();
jCameraView.setMaxFrameSize(sizeMaxFrame.height, sizeMaxFrame.height);
I set the maxFrameSize value to the same value using the height value from the setResolution() method
Sorry if my language or question is not easy to understand