I am trying to run the OpenCV Grabcut Sample on my system:
This is the build information from cv2.getBuildInformation()
:
In the Grabcut Sample script, I need to 'draw a rectangle around the object using the right mouse button.' For some reason, a drop down menu appears when I click the right mouse button (this is me clicking and holding the right mouse button):
This didn't happen before, but since I reformatted my computer and reinstalled OpenCV I get this drop down menu. The imshow
window looks different too. I tried installing lots of video codec packages (from this tutorial), but that didn't help.
This drop down menu interferes with the mouse callback functions. How can I get rid of this drop down menu?
I installed OpenCV with the command pip3 install opencv-contrib-python
. I knew I was missing some packages so I tried to install (but failed - 'couldn't find any package by regex...') these packages from this tutorial:
sudo apt-get install python-devel numpy
sudo apt-get install gcc gcc-c++
sudo apt-get install gtk2-devel
sudo apt-get install ffmpeg-devel
sudo apt-get install gstreamer-plugins-base-devel
In Python, you can pass the cv2.WINDOW_GUI_NORMAL
flag to namedWindow()
to disable the dropdown (flag is supported only if you have Qt backend):
cv2.namedWindow("window_name", cv2.WINDOW_GUI_NORMAL)
And then call
cv2.imshow("window_name", img)
Link to documentation of the namedWindow
function is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With