LJMUAstroecology / flirpy

Python library to interact with FLIR camera cores
Other
191 stars 54 forks source link

Image distortions - Dark horizontal lines #102

Closed MDeBSAL closed 1 week ago

MDeBSAL commented 1 month ago

I am using a Raspberry Pi 5 with the latest FlirPy version. I am getting short dark lines in the images which only appear when using the Raspberry Pi. On Windows systems the error does not occur. Any thoughts what could be the issue

Live Temperature Image1

jveitchmichaelis commented 1 month ago

This is probably an issue relating to OpenCV. Flirpy wraps OpenCV's VideoCapture interface to read images and does not implement any drivers itself, so you should be able to reproduce this by writing a simple script to capture a frame from the camera.

Have you tried visualising the video stream with other software? That should also be possible.

I you believe this is a bug, please update your post using the issue template

MDeBSAL commented 1 month ago

As mentioned, when using a Windows system the code works perfectly fine. It just happens when working on a Raspberry Pi.

jveitchmichaelis commented 1 month ago

Windows uses a different capture (typically DirectShow) backend to Linux (e.g. V4L). You can confirm where this issue is introduced by capturing a frame from OpenCV without using Flirpy.

MDeBSAL commented 1 month ago

Thank you for your valuable input. It seems that it is an issue with OpenCV. I have used this script and got the the same result.

import cv2

cap = cv2.VideoCapture(0)

if not cap.isOpened(): print("Error: Could not open camera.") exit()

while True:

ret, frame = cap.read()

if not ret:
    print("Error: Can't receive frame (stream end?). Exiting ...")
    break

cv2.imshow('Live Video Feed', frame)

if cv2.waitKey(1) & 0xFF == ord('q'):
    break

cap.release() cv2.destroyAllWindows()

OpenCVIMage

jveitchmichaelis commented 1 week ago

Great, closing as this is an issue with opencv on RPi.