sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
272 stars 137 forks source link

Unable to add ROIs Ubuntu #362

Open breannashi opened 1 month ago

breannashi commented 1 month ago

When using simba gui to select region of interest it fails to show screenshot from video.

I create a project following this simba walk through The ROI section came up as a white screen Video showing error

I tried to change the opencv as documented here: The instructions did not resolve issue. https://github.com/sgoldenlab/simba/blob/master/docs/FAQ.md "2. When I click on a video to set its parameters (i.e., "pixel per millimeter"), or try to open a video to dray ROI regions I get an OpenCV, I get an error report with something like "cv2.Error. The function is not implemented. Rebuild the library with Windows..." Show solutions!

To fix this, make sure your python environment has the correct version of OpenCV installed. Within your environment, try to type: (1) pip install opencv-python==3.4.5.20 or conda install opencv-python==3.4.5.20.

Then launch SimBA by typing SimBA, and see if that fixes the issue.

(2) Alternatively, if this does not fix it, try typing:

pip uninstall opencv-python followed by either pip install opencv-contrib-python or conda install opencv-contrib-python

Then launch SimBA by typing SimBA, and see if that fixes the issue."

I am unable to add ROI

sronilsson commented 1 month ago

Hi @breannashi - thanks for reporting, super helpful. It's not the OpenCV version: I was able to replicate the issue on my local Ubuntu 22.04.4 LTS with OpenCV 3.4.5.20.

A fix on my end seems to be to introduce a 100ms wait cv2.waitKey(100) each time after displaying/updating the video image. I'm not sure why this would be needed in ubuntu but but not MacOS or Windows though. I will test a little more and push an update to pip and let you know when!

sronilsson commented 1 month ago

@breannashi if you update simba to latest version using pip install simba-uw-tf-dev --upgrade, how does it look?

breannashi commented 1 month ago

Thanks for the quick response! ROI is working now THX!