Search code examples
pythonopencv

opencv imshow() function has buttons now?


I am using Python 2.7 with OpenCV 3.1.0 to display and interact with images. When I run my script in debug mode in pycharm everything works fine.

However, when I run my script from the terminal the cv.imshow() window has buttons and mouse events which conflict with my pre-programmed ones.

This is the tool-bar I get (which is blank in debug mode):

enter image description here

Does anyone have any ideas on how to remove this? I couldn't find any details in the opencv imshow() documentations


Solution

  • Try to create a named window with the flag cv2.GUI_NORMAL which will remove those buttons and give you an old opencv style window. If you want the toolbar, just use cv2.GUI_EXPANDED flag. This is something to do with Qt support. It is weird that you get different with pycharm

    Something like:

    cv2.namedWindow('input', cv2.GUI_NORMAL)
    cv2.imshow('input', img)