FLIR/PySpin eventually only delivers part of the video frame

680 views Asked by At

I made a frame in the GUI from the real-time video.

When I turn on the computer and run the program, the entire video appears on the screen. But after a while, when I run the program, only a part of the video appears on the screen.

The error codes does not happen.. So I don't know what the problem is.

Like this. enter image description here

I'm using FLIR camera (Spinnaker SDK), Python 3.8 and Visual Studio Code (FLIR camera is being used by plugging a cable that looks like a wired Internet line into the computer body. )

The code I wrote:

    def __init__(self, video_source=0):
        # open the video source 
         self.cap=EasyPySpin.VideoCapture(video_source)  
         if not self.cap.isOpened():
             raise ValueError("ERROR", video_source)
                    

    def getFrame(self):
        if self.cap.isOpened ():
            isTrue, frame_original = self.cap.read()  
            global frame
            
            if isTrue: 
                frame = cv2.resize(frame_original, dsize=(0,0), fx=0.26, fy=0.26, interpolation=cv2.INTER_AREA)
                # if isTure is true then current frame converted to RGB
                return (isTrue, cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
            else:     
                return(isTrue, None) 
           
        else: 
            return (None)              
    
    def __del__(self):  
        if self.cap.isOpened():
            self.cap.release()

Is there anything to refer to? If you know the solution, please help me.

0

There are 0 answers