iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 11
0
自我挑戰組

軟體開發隨筆雜記--試著解決問題系列 第 11

如何做一個簡易的視訊處理工具(2)

  • 分享至 

  • xImage
  •  

https://ithelp.ithome.com.tw/upload/images/20200926/201196086bURC64Ste.png

https://ithelp.ithome.com.tw/upload/images/20200926/20119608d8R7aP9PuY.jpg

def init_FrameViewer(self):
    self.init_FrameViewer_tab = tk.Frame(self.notebook)
    self.init_FrameViewer_tab.pack(side = tk.LEFT, expand=tk.YES, fill=tk.BOTH)
    self.notebook.add(self.init_FrameViewer_tab, text="init_FrameViewer")
    self.FrameSwitch = tk.StringVar()

    fvfram1 = tk.Frame(self.init_FrameViewer_tab )
    fvfram1.grid(row =0, column = 0, sticky = tk.E+tk.W)
    self.fv1 = FV.FrameViewer(fvfram1)
    fvfram1_2 = tk.Frame(self.init_FrameViewer_tab )
    fvfram1_2.grid(row =1, column = 0, sticky = tk.E+tk.W)
    switch1 = tk.Radiobutton(fvfram1_2, 
                             text = "Frame\n Switch 1",
                             font=('Courier', 9),
                             variable = self.FrameSwitch,
                             value = "Frame Switch 1",
                             command = self.frameswitch)
    switch1.pack(side=tk.RIGHT, expand=tk.NO, fill = tk.X)

    fvfram2 = tk.Frame(self.init_FrameViewer_tab )
    fvfram2.grid(row =2, column = 0, sticky = tk.E+tk.W)
    self.fv2 = FV.FrameViewer(fvfram2)
    fvfram2_2 = tk.Frame(self.init_FrameViewer_tab )
    fvfram2_2.grid(row =3, column = 0, sticky = tk.E+tk.W)
    switch2 = tk.Radiobutton(fvfram2_2,
                             text = "Frame\n Switch 2",
                             font=('Courier', 9), 
                             variable = self.FrameSwitch, 
                             value = "Frame Switch 2", 
                             command = self.frameswitch)
    switch2.pack(side=tk.RIGHT, expand=tk.NO, fill = tk.X)

    fvfram3 = tk.Frame(self.init_FrameViewer_tab )
    fvfram3.grid(row =0, column = 1, sticky = tk.E+tk.W)
    self.fv3 = FV.FrameViewer(fvfram3)
    fvfram3_2 = tk.Frame(self.init_FrameViewer_tab )
    fvfram3_2.grid(row =1, column = 1, sticky = tk.E+tk.W)
    switch3 = tk.Radiobutton(fvfram3_2,
                             text = "Frame\n Switch 3",
                             font=('Courier', 9),
                             variable = self.FrameSwitch,
                             value = "Frame Switch 3",
                             command = self.frameswitch)
    switch3.pack(side=tk.RIGHT, expand=tk.NO, fill = tk.X)

    fvfram4 = tk.Frame(self.init_FrameViewer_tab )
    fvfram4.grid(row =2, column = 1, sticky = tk.E+tk.W)
    self.fv4 = FV.FrameViewer(fvfram4)
    fvfram4_2 = tk.Frame(self.init_FrameViewer_tab )
    fvfram4_2.grid(row =3, column = 1, sticky = tk.E+tk.W)
    switch4 = tk.Radiobutton(fvfram4_2,
                             text = "Frame\n Switch 4",
                             font=('Courier', 9),
                             variable = self.FrameSwitch,
                             value = "Frame Switch 4",
                             command = self.frameswitch)
    switch4.pack(side=tk.RIGHT, expand=tk.NO, fill = tk.X)

切換頻道用的switch

def frameswitch(self):
    if self.FrameSwitch.get() =="Frame Switch 1": 
        StreamFile = self.fv1.cap#self.iv1.image_paths[self.iv1.image_idx]
    elif self.FrameSwitch.get() =="Frame Switch 2":
        StreamFile = self.fv2.cap#self.iv2.image_paths[self.iv2.image_idx]
    elif self.FrameSwitch.get() =="Frame Switch 3":
        StreamFile = self.fv3.cap#self.iv3.image_paths[self.iv3.image_idx]
    elif self.FrameSwitch.get() =="Frame Switch 4":
        StreamFile = self.fv4.cap#self.iv4.image_paths[self.iv4.image_idx]

上一篇
如何做一個簡易的視訊處理工具(1)
下一篇
如何做圖片顏色分析
系列文
軟體開發隨筆雜記--試著解決問題33
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言