I need to create a GUI (create a Button to select an image from directory or list the image from a particular directory and select one image for conversion)with python cv2.Because i can't install pyqt or tkinter like modules. I have cv2 , numpy and other basic modules.How can i do this without installing any other modules ? (my device have space limitation ).
1 Answer
It looks like you can pass key inputs to opencv but not easily, as well as log slider events with generic functions. It doesn't look like there is a native file interface even in the latest version (https://docs.opencv.org/3.4.1/d7/dfc/group__highgui.html)
What about creating a command line GUI? You can use autocomplete in raw input as in this question and then pass the input to imread and then imshow the file.
4 Comments
Aju S
Actually i'm trying to create an application so i need gui (the application need a key and if i press the key then it open a directory which contain images ,after selecting the image just press another key 'ok' and the image will display and the converted rgb values where shown in background.So i didn't need terminal gui.Is it possible with cv2 module alone in python ?
Aju S
Is it possible to create this application with an image of a switch ?
Mike from PSG
I posted an answer then deleted as it involved tkinter. If you can use it, I'll repost the sample program that showed integrating OpenCV with a GUI.
Ed Smith
I'm no expert in OpenCV but it looks like there is no native solution to select files in the OpenCV High-level GUI. If you could use tkinter, the solution is simple (see stackoverflow.com/questions/9319317/…) or use MikeyB's solution.