Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lepton Camera video Output Error #52

Open
Smartgalpj opened this issue Jul 12, 2021 · 0 comments
Open

Lepton Camera video Output Error #52

Smartgalpj opened this issue Jul 12, 2021 · 0 comments

Comments

@Smartgalpj
Copy link

Hi, URGENT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I am using python code to record the video from Lepton Camera. In Lepton User App, video is good, while using python code, video is having flairs. I am sending you the code. Video output of this code is also attached in here. Please help me. It is very urgent.

Script below:

from import_clr import *
from moviepy.editor import VideoFileClip, concatenate_videoclips

import threading

clr.AddReference("ManagedIR16Filters")
clr.AddReference("TIFFfile")
clr.AddReference("LeptonUVC")
from flirpy.camera.lepton import Lepton
from Lepton import CCI
from IR16Filters import IR16Capture, NewIR16FrameEvent, NewBytesFrameEvent
from System.Drawing import ImageConverter
from System import Array, Byte
import matplotlib
from matplotlib import pyplot as plt
from matplotlib import cm
import numpy
import time
from PIL import Image
import matplotlib
#!/usr/bin/env python

"""
CV2 video capture example from Pure Thermal 1
"""

try:
import cv2
except ImportError:
print ("ERROR python-opencv must be installed")
exit(1)

class OpenCvCapture(object):
"""
Encapsulate state for capture from Pure Thermal 1 with OpenCV
"""

def __init__(self, camid):
    # capture from the LAST camera in the system
    # presumably, if the system has a built-in webcam it will be the first
    #for i in reversed(range(1)):
    self.camid = camid
    print ("Testing for presense of camera #{0}...".format(camid))
    
def show_video(self):
    cv2_cap = cv2.VideoCapture(0)
    fourcc = cv2.VideoWriter_fourcc(*"DIVX")
    out = cv2.VideoWriter('output_' + '_' + str(0) + '.avi', fourcc, 9.0, (int(160), int(120)))
    if cv2_cap.isOpened():
        cv2.namedWindow("lepton", cv2.WINDOW_NORMAL)
        print ("Running, ESC or Ctrl-c to exit...")
        print('open')
        ret, img = cv2_cap.read()
    else:
        print ("Camera not found!")
        exit(1)
         
    while ret:
        out.write(img)
        if ret == False:
            print ("Error reading image")
            break

        cv2.imshow("lepton", img)
        if cv2.waitKey(5) == 27:
            break
    cv2_cap.release()        
    out.release()
    cv2.destroyAllWindows()

if name == 'main':
OpenCvCapture(0).show_video()

output__0.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant