Author Topic: SeekThermal - How to correct the image received from the sensor?  (Read 29146 times)

0 Members and 1 Guest are viewing this topic.

Offline frenky

  • Supporter
  • ****
  • Posts: 966
  • Country: si
    • Frenki.net
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #100 on: May 26, 2016, 08:49:25 pm »
With 0.5A and 2.4V to peltier module the back of the seek (on the outside) is cooled to 15*C. Room temperature is 25*C.
Average ID1 is 7800 and average ID3 is 7900 which would suggest that shutter temperature is about 22.5*C.
 

Offline IwuzBornanerd

  • Regular Contributor
  • *
  • Posts: 192
  • Country: us
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #101 on: May 26, 2016, 08:59:30 pm »
Oh, you aren't cooling it as cold as I thought you were.  I put mine in the refrigerator one time (near freezing) & as I recall the histogram of the first image I got after removing it from the frige showed a narrow span of values near the 16k end.
« Last Edit: May 26, 2016, 09:01:44 pm by IwuzBornanerd »
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline IwuzBornanerd

  • Regular Contributor
  • *
  • Posts: 192
  • Country: us
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #102 on: August 13, 2016, 01:18:32 am »
Sadly I have not found out how to get rid of the blotchy pattern in the images, but I think I have found a way to make my code useful to other people.  I did that by adding a config file which will allow others to "massage" things a bit without messing with the code itself.  The user interface is in Python with all the intense math in a C module.  The program displays images real  time, saves stills and video and can display up to 5 real-time updating temperature markers (which also show on saved images & video).  It will use either frameID10 or an external file for pixel correction factors and utilizes frameID9 to determine temperature values.

I do my development on a 2.4GHz laptop running Debian Wheezy and the program runs well on that.  The program also runs on my Raspberry Pi 2B (900MHz) with a couple caveats:
  It will display the images at 8-9fps if image scaling is set to 1 or 2
  It will only record video at full frame rate if scaling is set to 1
  For some reason it requires "sudo" on my Pi

This is a disappointment to me because I have mobilized my Pi with a 5" touchscreen & it takes scaling of 3x to fill that screen & be most visible.

At any rate, I can upload it here or if there is enough interest to warrant a new thread like Seekofix & Thermovision have, I can start a new thread & upload the code there.  If there is no interest, I'll just go back in my hole...
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: de
    • Joe-c.de
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #103 on: August 13, 2016, 09:19:50 pm »
The program also runs on my Raspberry Pi 2B (900MHz) with a couple caveats:
  It will display the images at 8-9fps if image scaling is set to 1 or 2
  It will only record video at full frame rate if scaling is set to 1
  For some reason it requires "sudo" on my Pi

At any rate, I can upload it here or if there is enough interest to warrant a new thread like Seekofix & Thermovision have, I can start a new thread & upload the code there.  If there is no interest, I'll just go back in my hole...
I am very interested to get the Seek working on my Raspberry. I tried the Seek with a Tablet  (With Windows 8.1) and the Thermovision, it works...  ^-^
but a Raspberry (and his analog Video output) will allow me to use my internal Car Monitor or some other tiny display.

i would enhance my car with a Seek Night vision, so please share your program.  :popcorn:
FLIR E4 hardware mods 
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Freeware Remote Software for some FLIR Cameras: Ex Tools
 

Offline IwuzBornanerd

  • Regular Contributor
  • *
  • Posts: 192
  • Country: us
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #104 on: August 16, 2016, 06:50:45 am »
Okay, I guess I can't just go back in my hole, then.  I started with cynfab's code I got off of this blog and git-hub, so my "enhanced" version is my contribution to the effort.  I'll upload it here and if there turns out to be a lot of commentary we can put it on it's own thread.

How does that standard disclaimer go?...This software is provided "as-is, no warranty", in hope that others may find it useful...  I am not a trained programmer, so I am sure there are many things not done properly in the minds of those who write code for a living, but it works for me.  Hopefully it works for someone else.  I had never touched python before but I figured it would be easier to take cynfab's code which had all the USB stuff and image display than to figure out how to use libusb (which I had never done) & display the images using gtk (which I have done very little of).  There were many screaming moments, as with  any new programming language, but I still think it was the easier route for me.

I think I have everything covered in the readme file, so here it goes...

[Edit 1-10-2019]
I see that this is still getting an occasional download.  I suggest that you would like revision A better.  I have posted it on a separate thread which also serves as a discussion forum for my code: https://www.eevblog.com/forum/thermal-imaging/running-seek-thermal-cameras-(-others)-on-a-raspberry-pi/msg1941499/#msg1941499
« Last Edit: January 11, 2019, 01:52:29 am by IwuzBornanerd »
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: de
    • Joe-c.de
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #105 on: August 19, 2016, 12:32:43 pm »
Thanks for share.

Well, I have the best image quality while using my own calculated Gain and Offset Map, but only if the camera has passed the warm-up and the map was fresh generated.
If the same Camera was started later (after cool down) the map is unusable.
That is because the Pixels shift gain and offset if the internal camera processing was activated.
I tried to get the internal Sensor map while using the "GET_RDAC_ARRAY" command, which should have the same size as the Frame:
IMAGE_BUFFER_SIZE_IN_WORDS = 32448
RDAC_ARRAY_SIZE_IN_WORDS = 32448
Sadly... there was no success. I want to readout the Map after warm-up and reload after a cold start, but it won't work.
FLIR E4 hardware mods 
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Freeware Remote Software for some FLIR Cameras: Ex Tools
 

Offline IwuzBornanerd

  • Regular Contributor
  • *
  • Posts: 192
  • Country: us
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #106 on: August 19, 2016, 06:52:44 pm »
Thanks for share.

Well, I have the best image quality while using my own calculated Gain and Offset Map, but only if the camera has passed the warm-up and the map was fresh generated.
If the same Camera was started later (after cool down) the map is unusable.
That is because the Pixels shift gain and offset if the internal camera processing was activated.

Yes the "user generated" correction factors will yield the best image only when the camera is at the temperature it was at when the factors were generated.  And, of course, it needs to be stable there when the correction factors are generated.  I believe that is the case with the ones stored in the camera also, which makes me wonder if they were generated with the camera at 15*C as that would explain why frenky gets good images there.

Quote
I tried to get the internal Sensor map while using the "GET_RDAC_ARRAY" command, which should have the same size as the Frame:
IMAGE_BUFFER_SIZE_IN_WORDS = 32448
RDAC_ARRAY_SIZE_IN_WORDS = 32448
Sadly... there was no success. I want to readout the Map after warm-up and reload after a cold start, but it won't work.

I don't have sufficient documentation to know what  "GET_RDAC_ARRAY" does, but it and  "GET_VDAC_ARRAY" sound interesting.  My code strips off the 2 end columns before generating the external correction factor file and when reading correction factors from a file on disk my code expects that the 2 end columns have been stripped off so if you are expecting RDAC_ARRAY_SIZE_IN_WORDS = 32448 and treat it as a 208x156 array it will be a huge mess.  When using the frameID10 correction factors, my code strips off the 2 end columns before applying them.

Does this sound like it addresses what you are seeing?
What is the VDAC array?  Is that the bias settings used for reading each pixel, by chance?  IF so, it would be something that changes at each frameID1.  That could be a big help...
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: de
    • Joe-c.de
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #107 on: August 19, 2016, 09:36:11 pm »
Does this sound like it addresses what you are seeing?
No, for my images i don't use this line. i tried a little bit with it but get not really better results.
But additional, i work only with Raw Frames, the Camera delivers only Frame ID 3 and no shutter rises.
If the Temperature of the Core is stable, the Quality is quite use full.
What is the VDAC array?  Is that the bias settings used for reading each pixel, by chance?  IF so, it would be something that changes at each frameID1.  That could be a big help...
I think yes... and it clearly change at the startup and only after some Frame ID 1 Images.
i can remember , that the Seek still has changes if the Device was cool down and reinitialize only in raw mode.

I can confirm, that the Frame ID1 change some pixel, and after my reference Map and a uniform image, the Pixels appear darker as the surrounding Pixels if i Spot on a warmer surface. So Frame ID 1 not only change an offset, it change the Gain of the Pixel too.

And for those who have a FLIR E4 (or other with remote access), with the Ex-Tools it is possible to Change the Values of the Digital filters and disable them. its quite interesting how the "unfiltered" Image looks, its a low difference to the Seek image.
if i had more time i make some comparison images. :-/O
FLIR E4 hardware mods 
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Freeware Remote Software for some FLIR Cameras: Ex Tools
 

Offline IwuzBornanerd

  • Regular Contributor
  • *
  • Posts: 192
  • Country: us
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #108 on: August 20, 2016, 07:12:45 am »
I think I was (and may still be) confused.  When you said "thanks for the share" I thought the following stuff was referring to running my code on your Rpi (or other machine) and it was confusing that you referred to offsets, which my code does not currently use, so I though maybe you had modified my code to use some of your own tactics (which is fine).

But now I think you were talking entirely about using your own code.  Is that true?  And then the main point was that you cannot save correction factors and use them later successfully?  Since you are not using frame ID 1, I can see that being a problem.  My camera has many pixels that are very near the threshold of switching the bias when the ambient temperature is near 80 degrees Fahrenheit.  I picked 3 of them and ran a test file listing their values after every frame ID 1 and they toggled back & forth every frame ID 1 at that temperature and as the temperature warmed or cooled on either side of the magic point they stopped toggling.

Something you might try is when the camera is warmed up & stable save a frame ID 3 with the camera aimed at a uniform temperature surface and load that when you start the program.  Once the camera is stable, compare the saved frame ID 3 with a fresh one of the same (or close) temperature surface.  Calculate the differences between the pixel values of those 2 frames.  The pixels where the difference is around 2000-3500 are the ones where the bias has changed.  You might be able to use that information to adjust your map.  Having said that, I tried something like that and couldn't see any improvement, but I was using it to correct gain where I already was using frame ID 1 and it might not have been enough pixels to really notice.

Oh, and I take it you have not been able to actually access the VDAC or RDAC arrays?   Darn, I would have asked how.  I tried editing some of my cynfab code to request that and got nothing but "broken pipe" errors, or maybe "invalid parameter"...I don't know what the thing requires.
« Last Edit: August 20, 2016, 07:18:56 am by IwuzBornanerd »
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: de
    • Joe-c.de
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #109 on: September 15, 2016, 08:04:23 am »
Sorry for late answer...

I don’t had the time to play with the Raspi and the code you shared.
First I will have a good and stable core, than I will port it to the Raspi using your code base.

To the "switching" after a FrameID1, yes, this will be a problem, but only in "Normal" mode.
If I use the "Raw" mode, no shutter rises, no Frame ID1 is send and no Pixel would be shifted.

The idea to use a stored frame to calculate a actual offset is not bad, I tried before but it works only until the Sensor has reached the "Pixel Shift Temperature".
I use a Cold ID3 and a WarmID3 Frame to calculate a Gain and a Offset Map. If I connect the seek later and load the maps there is some offset... than NUC (Shutterles Frame offset) and the Image looks better. But some Seconds later (20-280), some Pixel starts shifting.

To the VADC and RDAC arrays... I tried the commands (somebody extracted from java) but get no response or a stuck device (needs USB reconnection).

Joe-c
FLIR E4 hardware mods 
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Freeware Remote Software for some FLIR Cameras: Ex Tools
 

Offline IwuzBornanerd

  • Regular Contributor
  • *
  • Posts: 192
  • Country: us
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #110 on: September 17, 2016, 12:39:37 am »
I found the old post from @blackboxdisease with the command info. https://www.eevblog.com/forum/thermal-imaging/yet-another-cheap-thermal-imager-incoming/1110/?wap2 and I see that it says VDAC_ARRAY_SIZE_IN_WORDS = 156.  This makes me think it cannot be values for pixel bias because I don't see entire lines of pixels changing value between the 6000 range & the 8000 range.  I only see isolated pixels change that much; although there are hundreds that have changed they are not grouped together.

Regarding the shutter, something I have observed is that once the camera is warmed up it takes a shutter frame every 60 image frames, but I have not captured data to see if if it ever reduces that number if the camera temperature changes such as it would during outdoor use.  It might be more responsive in such situations if the decision to grab a shutter frame was based on the change in the value of pixel 1.  It looks like if pixel 1 varies more than 2 or 3 a new shutter frame is needed to get clean images.  I also saw TOGGLE_SHUTTER_SIZE_IN_BYTES = 4.  Curious...Why 4 bytes??  Open/closed and a dwell time maybe????

Maybe nobody has had time to play with my code.  I see there have been dozens of downloads but no comments or complaints.  maybe I should be happy about that.  I'm curious whether others have been able to get reasonable temperature readings with it & how the images compare with other code.  With my camera the images appear to be comparable to those from Seek's app., which I admit is nothing fantastic...
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline joe-c

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: de
    • Joe-c.de
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #111 on: September 17, 2016, 10:00:58 pm »
well, I not tried much with the VADC, more with the RDAC:
RDAC_ARRAY_SIZE_IN_WORDS                 = 32448
my hope was to read that automatically generated setup if the seek move on from warm-up.
than store that setup and load it next time, the rest of shift will be done with the normal nuc.

and yes, 4 bytes for a TOGGLE_SHUTTER_SIZE sounds curios, but a Chip_ID with 12 bytes containing 50% 0 values is also curios.

if the RADC Map way will not work I have another idea... maybe we could wait until the seek is done with the wamup and prohibit additional a using of the Normal mode, but for this we need a hardware change, because the shutter is off at next startup.
And then just change the init to a way without the normal mode, just re Raw mode. If the RADC setting was saved in the camera, it maybe hold this state. i guess the RDAC changes only around the FrameID1 time.
FLIR E4 hardware mods 
Freeware Thermal Analysis Software: ThermoVision_Joe-C
Freeware Remote Software for some FLIR Cameras: Ex Tools
 

Offline kiranjayaraj

  • Newbie
  • Posts: 3
  • Country: nl
Re: SeekThermal - How to correct the image received from the sensor?
« Reply #112 on: September 29, 2018, 04:36:09 pm »
Hi Sebastian,
I see that the post is old and I just wanted to say that I am doing something very similar to yours.
Using a Raspberry Pii and Seek to get into plant temp measurements. Are you still working on this by anychance?
Thanks in advance for your response.
Kiran
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf