Use Tkinter to create GUI development tools (34) OpenCV components in Tkinter

OpenCV components can be used in Tkinter.
Among the support modules of HP_tk2, we have this module HP_cv2. Using the HP_cv2 module, you can place OpenCV2 Tkinter components in the Tkinter window to implement OpenCV2 drawing operations.
The demo code is given below.

import  tkinter  as  tk   #导入Tkinter
import HP_cv2 as hcv
import HP_tk2 as htk

root=tk.Tk()
root.title('Tkinter中的OpenCV演示') 
root.geometry('{}x{}+{}+{}'.format(800, 600, 100, 200))
mv=hcv.MV(root,file='.\\temp\\01.mp4',width = 400, height = 600)
mv.pack(fill=tk.BOTH, expand=1)
htk.thread_it(mv.play())

root.mainloop()

The running result is given below:
Insert picture description here
OpneCV2 is used in the program to play an mp4 video.

Guess you like

Origin blog.csdn.net/hepu8/article/details/106323481