Python Forum

Full Version: openCV + GUI
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am completely new to Python.
Here is the task:
I need openCV window with video stream; on right click in window area I need a small GUI panel to pop-up with few simple controls; this panel must not block video stream and controls should communicate in real time with openCV window (f.e. scroller adjusting video brightness). When 'OK' button clicked on GUI panel, it should disappear and only openCV window stays.
I am using Tkinter and Python 2.7 on Windows 7
I tried the approach of showing video in tkinter window, controls in toplevel window and use 'after' function, but it is not acceptable - performance dropped and communication between two windows got really messy.
So it must be pure openCV window for image and tkinter GUI for controls.
I tried to do it in threads, but also failed because tkinter is not thread-safe and must run in the main thread only, while for my task the main app is openCV and GUI is called only for a short time.
I am planning to use multiprocessing - run openCV and tkinter in different processes, main tkinter window hidden and waiting for event raised by main process (openCV), when called, pass controls data to openCV through the pipe. Will this approach work, or are there any better (and not overcomplicated) options?
I use python because I am planning to make this application run on Raspberry as well; my plan B if python approach fails, would be to make it in C++.
Quote:I am using Tkinter and Python 2.7 on Windows 7

Why not the latest (3.6.3) version of python. It runs just fine on windows 7.
The deadline of support for python 2.7 is fast approaching.
Because I am conservative an only use newest versions when the the task cannot be implemented with the old one. Are you saying my problem is specific to Python 2.7 and can be resolved with Python 3? Please explain how.
Quote:Are you saying my problem is specific to Python 2.7 and can be resolved with Python 3? Please explain how.
Not at all, just advising that you should be thinking toward using the latest version.
It is reasonable to assume that at some point you will not be able to use the packages you'd like to use.
By all means, if it suits your purpose stay with the old version.