Jetson TX1使用usb camera采集图像 (2)

该方法只启动usb摄像头

import cv2
import numpy
import matplotlib.pyplot as plot

class Camera:
    cap = cv2.VideoCapture(0)

    @staticmethod
    def getCamera():
        ret, frame = Camera.cap.read()
        return ret, frame

    @staticmethod
    def getCap():
        return Camera.cap


def main():
    camera = Camera()
    while(1):
        ret, frame = camera.getCamera()

        cv2.imshow("capture", frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    camera.cap.release()
    # cv2.destroyAllWindows()

if __name__ == '__main__':
    main()

 

上一篇:浅析网站开发中的 meta 标签的作用


下一篇:Jetson TX2 安装JetPack3.3教程