android: JavaCamera2View use calculateCameraFrameSize() method#14981
Conversation
from CameraBridgeViewBase (common base with JavaCameraView)
|
/cc @floe @DorJoogl |
|
Great effort. However it's missing the aspect ratio check from the old if (width >= calcWidth && height >= calcHeight && Math.abs(aspect - (float) width / height) <= 0.02) {
calcWidth = (int) width;
calcHeight = (int) height;
}
This doesn't fix the broken previews on certain preview sizes I mentioned yet. If developers should override I'm positive however that this change is very necessary and should be merged asap. As a first-time user of OpenCV4Android just a couple months ago I was a bit frustrated to see it not work out of the box. So I'm very glad this issue is getting resolved. |
|
Can't test right now unfortunately, but looks good. Should this also be in 4.1.1? |
|
Purpose of this patch is to reuse existed code from both JavaCameraView/JavaCamera2View and provide the same selection for apps. Next step is to refine frame selection itself:
Suggestions are welcome! (to merge this - 👍 ) |
Just curious. What's unreliable with the current approach? I get the part about reusing old code but what's stopping us from adding the aspect ratio check to |
|
Example:
BTW, device screen size is |
from CameraBridgeViewBase (common base with JavaCameraView)
Both interfaces (JavaCameraView/JavaCamera2View) using the same method and the same approach.
If user want to tune calculation then it should override "View" class and override this method (
calculateCameraFrameSize())resolves #14915