OpenThermal / libseek-thermal

SEEK thermal compact camera driver supporting the thermal Compact, thermal CompactXR and and thermal CompactPRO
MIT License
286 stars 99 forks source link

CompactPRO with USB-C connector produces a strange pattern #71

Closed samontab closed 1 year ago

samontab commented 2 years ago

Hi,

Thanks for this excellent library.

I was testing this lib with a CompactPRO camera with a USB-C connector.

Everything seems to work fine, the USB code is the same as the CompactPRO with a micro USB connector(0011), but there's a constant pattern of wrongly read pixels in the bottom left part of the frame as you can see here:

USBC CompactPro

The image itself is correctly sized at 240x320, and most of the frame is correctly read with a fast frame rate, but there seems to be something wrong in the actual values of the pixels in the lower left side for some reason. The camera works perfectly fine on the official app on the phone by the way.

Any ideas on how I can solve this would be great, thanks!

MalteBrunn commented 2 years ago

Hi, I have the same/similar issue with a regular Compact (non Pro, Micro-USB, pID 0010). I'd be happy to provide additional data to fix this.

Commit: c9e09dc Linux Mint (Ubuntu 20.04), Kernel 5.13.0-41 libopencv-dev 4.2.0 libusb-1.0-0-dev 1.0.23 cmake 3.16.3 gcc 9.4.0

Bostwickenator commented 2 years ago

I believe this is the dead pixel replacement. It's decided that all those pixels need to be replaced. Someone else previously had this issue see #64. Can you try the fix noted there. If that fixes it I'll add instructions in the readme and a compilation flag.

On Wed, Jun 8, 2022, 2:26 PM Malte Brunn @.***> wrote:

Hi, I have the same/similar issue with a regular Compact (non Pro, Micro-USB, pID 0010). I'd be happy to provide additional data to fix this.

— Reply to this email directly, view it on GitHub https://github.com/OpenThermal/libseek-thermal/issues/71#issuecomment-1150310071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOHDE6BYJ42762GDQOUDDVODXV7ANCNFSM5VLLGZMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

samontab commented 2 years ago

I tried the fix, and it works.

comparison

As reported in #64 now there are some white pixels, but those could probably be removed either by the dead pixel thresholding, flat field calibration, or simply by masking them out.

Thanks!

MalteBrunn commented 2 years ago

Awesome! This helped a lot. I first tried replacing the function body of apply_dead_pixels_filter as described in #64. That gave me an image with some dead pixels obviously.

Afterwards, I changed the threshold in create_dead_pixel_list (https://github.com/OpenThermal/libseek-thermal/blob/c9e09dcde572194c6186f6b896bbcb2c8e29b42b/src/SeekCam.cpp#L240) to const double threshold = hist_max_value.y - (max_value - hist_max_value.y*0.9); and together with the original apply_dead_pixels_filter function this works perfectly now. Thanks!