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

任何用于顯示來自相機(jī)的實(shí)時(shí)圖像的快速 Python

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

問題描述

我正在嘗試顯示來自 1394 相機(jī)的實(shí)時(shí)圖像.目前,我的代碼能夠從相機(jī)循環(huán)獲取圖像,并且我正在尋找任何可以動(dòng)態(tài)更新的快速 GUI(作為單獨(dú)的線程).我可以在 PyQt 中做到這一點(diǎn),也許使用 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

#循環(huán)從相機(jī)捕捉幀

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()

這篇關(guān)于任何用于顯示來自相機(jī)的實(shí)時(shí)圖像的快速 Python GUI的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

How should I verify a log message when testing Python code under nose?(在鼻子下測試 Python 代碼時(shí),我應(yīng)該如何驗(yàn)證日志消息?)
Patch __call__ of a function(修補(bǔ)函數(shù)的 __call__)
How to call self in a mock method of an object in Python?(如何在 Python 中對(duì)象的模擬方法中調(diào)用 self?)
Mocking only a single method on an object(僅模擬對(duì)象上的單個(gè)方法)
Mocking a subprocess call in Python(在 Python 中模擬子進(jìn)程調(diào)用)
Checking call order across multiple mocks(檢查多個(gè)模擬的調(diào)用順序)
主站蜘蛛池模板: 免费观看一级特黄欧美大片 | h在线免费观看 | 久久久九九 | 国产午夜精品久久久 | 91亚洲国产成人久久精品网站 | 亚洲成人精品一区 | 日韩欧美一区二区三区 | 日韩超碰| 91久久久久久久久 | 国产精品色 | 国产精品久久久久久久粉嫩 | 精品视频在线一区 | 精品国产免费一区二区三区五区 | 日本在线一区二区三区 | 成人亚洲视频 | 日韩成人久久 | 午夜欧美a级理论片915影院 | 在线国产小视频 | 久久99蜜桃综合影院免费观看 | 天天久久 | 午夜久久久久久久久久一区二区 | 国产在线一区二区三区 | 国产在线拍偷自揄拍视频 | 亚洲乱码国产乱码精品精的特点 | 日韩亚洲视频 | 天堂网中文字幕在线观看 | 亚洲三区在线观看 | 男人天堂网址 | 一级黄色录像毛片 | 最新av在线网址 | 动漫www.被爆羞羞av44 | 久久久久久国产精品免费免费狐狸 | 成人高清在线视频 | 欧美多人在线 | 中文字幕日韩一区 | 99久久婷婷 | 久久久91| 国产一级视频免费播放 | 精品国产乱码久久久久久88av | 日韩欧美三级电影 | 国产成人高清视频 |