久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

任何用于顯示來自相機的實時圖像的快速 Python

Any quick Python GUI to display live images from Camera(任何用于顯示來自相機的實時圖像的快速 Python GUI)
本文介紹了任何用于顯示來自相機的實時圖像的快速 Python GUI的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試顯示來自 1394 相機的實時圖像.目前,我的代碼能夠從相機循環獲取圖像,并且我正在尋找任何可以動態更新的快速 GUI(作為單獨的線程).我可以在 PyQt 中做到這一點,也許使用 QThreads 但有什么建議或更快的方法嗎?這是我的代碼

I am trying to display live images from my 1394 camera. Currently my code is able to obtain images in a loop from the camera and I was looking for any quick GUI that will update dynamically (as a separate thread). I can do this in PyQt maybe using QThreads but is there any recommendation or faster way of doing this?? Here's my code

#循環從相機捕捉幀

for frame in range(1,500):

print 'frame:',frame

TIME.sleep(1) #capture frame every second

image_binary    = pycam.cam.RetrieveBuffer()

#convert to PIL Image

pilimg = PIL.Image.frombuffer("L",(cimg.GetCols(),cimg.GetRows()),image_binary,'raw', "RGBA", 0, 1)
    # At this point I want to send my image data to a GUI window and display it

謝謝.

推薦答案

這是 wxPython 代碼...

import wx
from PIL import Image

SIZE = (640, 480)

def get_image():
    # Put your code here to return a PIL image from the camera.
    return Image.new('L', SIZE)

def pil_to_wx(image):
    width, height = image.size
    buffer = image.convert('RGB').tostring()
    bitmap = wx.BitmapFromBuffer(width, height, buffer)
    return bitmap

class Panel(wx.Panel):
    def __init__(self, parent):
        super(Panel, self).__init__(parent, -1)
        self.SetSize(SIZE)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.Bind(wx.EVT_PAINT, self.on_paint)
        self.update()
    def update(self):
        self.Refresh()
        self.Update()
        wx.CallLater(15, self.update)
    def create_bitmap(self):
        image = get_image()
        bitmap = pil_to_wx(image)
        return bitmap
    def on_paint(self, event):
        bitmap = self.create_bitmap()
        dc = wx.AutoBufferedPaintDC(self)
        dc.DrawBitmap(bitmap, 0, 0)

class Frame(wx.Frame):
    def __init__(self):
        style = wx.DEFAULT_FRAME_STYLE & ~wx.RESIZE_BORDER & ~wx.MAXIMIZE_BOX
        super(Frame, self).__init__(None, -1, 'Camera Viewer', style=style)
        panel = Panel(self)
        self.Fit()

def main():
    app = wx.PySimpleApp()
    frame = Frame()
    frame.Center()
    frame.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()

這篇關于任何用于顯示來自相機的實時圖像的快速 Python GUI的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How should I verify a log message when testing Python code under nose?(在鼻子下測試 Python 代碼時,我應該如何驗證日志消息?)
Patch __call__ of a function(修補函數的 __call__)
How to call self in a mock method of an object in Python?(如何在 Python 中對象的模擬方法中調用 self?)
Mocking only a single method on an object(僅模擬對象上的單個方法)
Mocking a subprocess call in Python(在 Python 中模擬子進程調用)
Checking call order across multiple mocks(檢查多個模擬的調用順序)
主站蜘蛛池模板: 免费一区二区三区 | 久久激情视频 | 久久午夜影院 | 中文字幕在线一区 | 国产精品天堂 | 国产欧美综合一区二区三区 | 亚洲免费精品视频 | 国产伦精品一区二区三区视频我 | 欧美日韩免费一区二区三区 | 亚洲精品免费在线 | 天堂久久久久 | 99精品久久久久久中文字幕 | 天天射天天操天天干 | www.jiujiu| 亚洲精品免费观看 | 欧美国产日韩在线 | 香蕉久久a毛片 | 国产日韩精品一区二区 | 日本伊人久久 | 国产小视频网站 | 精品网站999www | 国产一级网站 | 91插插插插插 | 中文在线免费观看 | 成人一级视频 | 欧美一级片免费 | 免费成人在线观看视频 | 男人天堂网av | 日本一级淫片 | 久久久久久97 | 日本少妇一区二区 | 日本成片网| 在线观看国产免费视频 | 欧美色偷偷 | 青草视频在线观看免费 | 免费在线观看毛片 | 欧美性猛交xx | 日韩av在线网站 | 日韩在线免费观看视频 | 亚洲高清免费 | 日韩中文字幕精品 |