I’m learning opencv for object detection and trying to do all the coding using google colab. And so far it has been working well: I can mount the gdrive and upload file and read the video file just fine.
The selecting ROI by passing video frame into cv2.selectROI() crashed the Colab. The runtime log complained about a plugin xcb not initialising. Further reading reveals the plug in require to be run on local machine, so I wonder if there is a way to run cv2.selectROI or equivalent on colab?
Sorry I’m very new to all these.
IS there any work around to this? for example in this case I want to label a ROI in a video using openCV. Or my option really is start using pycharm?
my bad, when I say pycharm I mean to run python on my local machine, my IDE is pycharm…you are absolutely right though, run it on my local machine would be the easiest fix.
I read around on StackOverflow, and found out the same problem with cv2.imshow(), and there seems to have a workaround using
from google.colab.patches import cv2_imshow
so I wonder if there is a workaround like that for roi selection? I know this is like taking the long road, but for the sake of learning…
If you really don’t want to run python locally and prefer notebook-like GUI, you can read this article about selecting ROI with jupyter (since Google Colab is a hosted Jupyter Lab instance)
Thank you so much man!
This might just be the thing I’m looking for. I’m a dummy so before I never paid attention to the difference between colab/notebook and a local IDE… Great things to learn.