PYNQ2中USB Webcam

1、網絡攝像頭

  該攝像頭爲很久以前用來視頻的攝像頭,直接插在USB接口上,免驅。

2、打開主頁

http://192.168.2.99:9090/notebooks/common/usb_webcam.ipynb

然後在common中選擇usb webcam工程,此時照片爲默認的照片。

3、運行

運行後的結果如下圖所示,照片變成攝像頭拍攝的照片。

4、代碼分析

from PIL import Image as PIL_Image

orig_img_path = '/home/xilinx/jupyter_notebooks/common/data/webcam.jpg'

!fswebcam  --no-banner --save {orig_img_path} -d /dev/video0 2> /dev/null

img = PIL_Image.open(orig_img_path)

img

用fswebcam打開攝像頭,並拍照片

bw_img = img.convert("L")

bw_img

convert的使用

rot_img = img.rotate(45)

rot_img

旋轉45度

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章