OpenFTC / EasyOpenCV

Finally, a straightforward and easy way to use OpenCV on an FTC robot!
213 stars 95 forks source link

How to set camera resolution? #54

Closed baqwas closed 1 year ago

baqwas commented 1 year ago

Hello,

Need help to explicitly declare camera resolution with the current EasyOpenCV (libOpenCvAndroid453.so) library. The error message is: Robot Status: EMERGENCY STOP To attempt recovery, please restart the robot. Error: User code threw an uncaught exception: OpenCvCameraException - Camera does not support requested resolution! Supported resolutions are [1920x1080],[1280x720], [3840x2160],[2592x1944],[2048x1536], [1600x1200],1280x960],[1024x768],[800x600], [640x480],[640x360]

The camera model is MOKOSE that supports up to [3840x2160]. TFOD (Concept and custom TFLite models) OpModes work fine with this camera. Any suggestions on how to work around this issue (or do I have to fall back to the Logitech C920 which works flawlessly).

The C920 generally has a detection issue at the initial step (under varied lighting conditions - so ambient lighting is not the culprit). The first detection - CMY or AprilTag signal sleeve is not always detected right away. Changing the frame view enables the detection and thereafter it is reliably solid. Of course, I'm not seeking help with this separate issue.

Is it possible to explicitly set the camera resolution during OpMode initialization to overcome the resolution error message? Thanks.

Kind regards.

baqwas commented 1 year ago

Changed the following statement to specify supported resolution:

camera.startStreaming(800,600, OpenCvCameraRotation.UPRIGHT);

Everything works! False alarm when I forget to RTM. Thanks for the library though!!!

Kind regards.