groupgets / purethermal1-uvc-capture

USB Video Class capture examples for PureThermal 1 / PureThermal 2 FLIR Lepton Dev Kit
124 stars 81 forks source link

Camera Frequently Needs to be Remounted #35

Open ozangungor12 opened 3 years ago

ozangungor12 commented 3 years ago

Hi,

We are using the thermal camera in a project and we have the problem that in around every half an hour, the camera crashes and it is not listed under /dev/video anymore, so we have to manually de-plug and plug the camera to the USB port again and again. We have multiple cameras in the system and the problem only occurs with the thermal one.

Would anyone have any suggestions or ideas why this could be happening and how it could be prevented? Thanks in advance.

newts commented 3 years ago

Following to see what comes of this. I am using it for a covid screening kiosk and the device seems to come and go for me although I don't see it re-enumerate in the logs. https://youtu.be/Hu1_Qx9c56U

vqvinh243 commented 3 years ago

I don't know if this can help you. It's much easier to work with OpenCV and you'll never worry about crashes. My environments: Lepton 3.5 Python 3.6 OpenCV 4.4.0 Ubuntu 18.04

cap = cv2.VideoCapture("/dev/video0")
cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter.fourcc('Y','1','6',' '))
cap.set(cv2.CAP_PROP_CONVERT_RGB, 0)
while True:
    ret, data = cap.read()
    if ret:
        data = data[:120, :] # 122x160 => 120x160 discard 2 last row
        data = cv2.resize(data[:,:], (640, 480))
        minVal, maxVal, minLoc, maxLoc = cv2.minMaxLoc(data)
        img = raw_to_8bit(data)
        display_temperature(img, minVal, minLoc, (255, 0, 0))
        display_temperature(img, maxVal, maxLoc, (0, 0, 255))
        cv2.imshow('Lepton Radiometry', img)
        key = cv2.waitKey(1)
        if key == 27:
            break

cap.release()

Hope this helps!