Author Topic: Running Seek thermal cameras (& others?) on a Raspberry Pi  (Read 14435 times)

0 Members and 2 Guests are viewing this topic.

Offline gtizz2

  • Contributor
  • Posts: 7
  • Country: it
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #25 on: July 28, 2020, 12:20:29 pm »
Quote
It is only the 4 lines you quoted plus the increment.
ok. So, I had modified correctly and attachments files in the previous message are correct. If you need other file let me know.

Quote
Was there supposed to be a hand or other recognizable object in the images for those pixel lists?
a hand.

Quote
Have you made other changes to the py file or the C module?
no, i have no change C module.

An experiment that you can try it's increase millisecond variable in the "label_image.after(...)" (line 976 about), from 1 to 2000 (2 sec) and see the temperature. Compare the temperature of the same object with millisec to 1. You will see that the temperatures are different.
 

Offline IwuzBornanerd

  • Frequent Contributor
  • **
  • Posts: 305
  • Country: us
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #26 on: August 01, 2020, 08:53:51 am »
Okay, I'll try doing this a different way.  I have edited the file myself, but went further & tried to make it so that it will work with all 3 known versions of the non-pro compacts.  I added information to the pixel list files so that I can reconstruct here whatever image there is the same way the program does.  I have tested it so it should not sit there doing nothing, even with your camera.  I have deleted the earlier instructions in order to avoid confusion for future readers.

When you run the calibration it will automatically start using the new correction factors.  This will go away, though, as soon as you switch between internal & external or exit the program, so you will still need to copy the files it creates.

I also "rethunk" the way I derive temperature & implemented that in the program.  You need to understand that Seek does not tell anyone how to determine temperature from the data that comes off the camera, so it may not be possible to get as close to correct as you need for fever detection.  At any rate you will need a calibrated heat (black body) source.  There are other issues also, as mentioned on that virus outbreak thread I linked above.

I am uploading both the program file & the configuration file.  I have changed the names so you won't have to worry about overwriting the original program.  When you run this it will write out a bunch of files on startup.  Please zip those along with your new pixelcal.txt & refframe.txt files AND an image pixel list file and post the .zip here so I can see what all is going on.  After doing that you can edit line 27 of the config file to say "no" to writefiles to keep it from writing all those files every time you run the program.

NOTE:
You will need to edit the config file to have your pixel1atT and ambientT values.  The pixel1atT value is now the warmed-up value NOT the cold-start value!  Use the value that you read off the program when it has stabilized.

My  hope is that this will at least get you a clean image with somewhere-in-the-ballpark temperatures.  The temperatures will be about 20F high when starting the camera "cold" and get closer to correct after 10-20 minutes.

I expect to have to revise the program some more & will delete this version when I post an update.
« Last Edit: August 01, 2020, 09:28:47 am by IwuzBornanerd »
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline gtizz2

  • Contributor
  • Posts: 7
  • Country: it
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #27 on: August 03, 2020, 09:33:58 am »
Hi IwuzBornanerd,
I ran your script but it ends with an error:
Code: [Select]
curvebase =2000  curvemax = 20430  curvetop = 16177  divisor = 2

diffshouldbe =-781

Traceback (most recent call last):
  File "Rpi2SeekA1.py", line 991, in <module>
    show_frame(first=True)
  File "Rpi2SeekA1.py", line 946, in show_frame
    disp_img = get_image()
  File "Rpi2SeekA1.py", line 615, in get_image
    s =  str(ix) +"\t"  +str( (diffcurve[ix][1]<<8) + diffcurve[ix][0]) +"\n"
IndexError: index 16430 is out of bounds for axis 0 with size 16430


In practice, in code line 615 (before the while condition) index variable is 16499 and curvbase  is 16430, so when accessing to curvbase with index, an overlof occurs.
 

Offline IwuzBornanerd

  • Frequent Contributor
  • **
  • Posts: 305
  • Country: us
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #28 on: August 03, 2020, 02:38:47 pm »
The problem is that you have a camera I don't know about.  This is why I need you to post those startup files so that I can see what information is stored on the camera.  This is now the 3rd change in the curve in frame 9 & it goes beyond the 16430 max I was "assuming" from the 2nd revision.  The 2nd rev ends at "curvetop" of 15234, not 16177.  My test condition of delta of 30 might not be good anymore either.  Thanks much for posting that line of program output!

Sadly, though, there is an error in the code regardless, as it looks like the line
            curvebase = curvebase/divisor
needs to be immediately after the "if(curvebase > 3000): divisor = 2" line at line 568
.

Edit: No, that's not quite it either.

 That is one thing I can't test here because I don't have that revision of camera.  Once you do that you will need to change the diffcurve array size to something larger but I can't say how large because I don't have YOUR frame 9!

Going back to bed now.  :)

After breakfast edit:  After looking at it some more, yes the 16430 is a problem (I thought I had dimensioned diffcurve at 17000 as in my other code), but the problem may not be 16499, the real problem is as I stated above because curvetop is an unexpected 16177 & I wonder right now what the real curvemax is.  I need to see frame9.  So if the program did not get frame9 written before it stopped, go ahead & get rid of that "+1" in the line 614 while or change the if writefiles >0 in 611 to >10 so it won't try to write that file.  After all the revisions by Seek this really needs to be done in a way that handles unknown limits & I may not be up to that.
« Last Edit: August 03, 2020, 10:36:06 pm by IwuzBornanerd »
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline IwuzBornanerd

  • Frequent Contributor
  • **
  • Posts: 305
  • Country: us
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #29 on: August 04, 2020, 09:02:55 am »
Further comment to my edits above...
I remember now that I added that "+1" in line 614 because I wasn't getting the last diffcurve value in the file, so I just let it increment another 1 either not thinking clearly or thinking that the array was dimensioned to 17000 as in my C code.  Either way this was a quickie fix & was not the right place to fix it.  I probably do that sort of stuff too much while in troubleshoot mode.  Sorry to subject you to that here.  I probably should not even be trying to write code in my current half-braindead mode anyway.

I came up with the bright idea of reading in a frame9 file instead of processing the frame9 from the camera as a way of enabling me to test different frame9 scenarios and started coding it but it got more & more complicated.  And due to nice weather this week I now need to curtail my computer time until miserably hot weather returns next week, so frame9 will have to wait.

In practice, in code line 615 (before the while condition) index variable is 16499 and curvbase  is 16430, so when accessing to curvbase with index, an overlof occurs.

So if you saw what the problem was why didn't you just increase the array size &  see if it got any farther?  ;D  No use dragging this out over more days.
I am not opposed to exercise, unless it is an exercise in futility.
 

Offline gtizz2

  • Contributor
  • Posts: 7
  • Country: it
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #30 on: September 01, 2020, 12:23:58 pm »
hello IwuzBornanerd,
sorry for the long wait for the answer, but I had other issues to resolve and then I was on holiday :-).
Anyway, I'm trying to fiddle with the code a bit, as soon as possible I'll send the files you requested me some time ago.
However, I wanted to ask you one more thing ...
when the cam is in running, after 10/20 min (often but not always), a strange error comes out:
Code: [Select]
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1550, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 599, in callit
    func(*args)
  File "Rpi2SeekA.py", line 1044, in show_frame
    disp_img = get_image()
  File "Rpi2SeekA.py", line 530, in get_image
    send_msg(0x41, 0x53, 0, 0, '\xC0\x7E\x00\x00')
  File "Rpi2SeekA.py", line 69, in send_msg
   dev.ctrl_transfer(bmRequestType, bRequest, wValue, wIndex, data_or_wLength, timeout)
  File "/home/giu/.local/lib/python2.7/site-packages/usb/core.py", line 1043, in ctrl_transfer
    self.__get_timeout(timeout))
  File "/home/giu/.local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 883, in ctrl_transfer
    timeout))
  File "/home/giu/.local/lib/python2.7/site-packages/usb/backend/libusb1.py", line 595, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
USBError: [Errno 110] Operation timed out

Do you know where it comes from? Greetings.
 

Offline IwuzBornanerd

  • Frequent Contributor
  • **
  • Posts: 305
  • Country: us
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #31 on: September 02, 2020, 01:37:01 am »
Welcome back; I hope it was a  virus-free holiday.

I have not seen that error  with the Python code.  I thought maybe it was from wiggling a loose connector but when I tried that with my loose connector it yielded a "Protocol error". 

I found one place that said it appeared from the pyUSB source code that the default timeout is 1 second when none is specified.  You could try specifying something like 100ms and see if the problem gets worse, but that won't explain why it happens.  I do get USB transfer errors with the FFPro and my SDL2 code, I don't recall for sure if they are timeouts, but I think they are, and I have no idea what causes that either.  It is much worse on a Pi, though. 

Your camera appears to have a newer sensor so maybe other things have changed as well, making this error more likely(??).

Does Python let you process the error and continue?  I haven't had need for that so have not researched it.

I am not opposed to exercise, unless it is an exercise in futility.
 

Offline voltface

  • Newbie
  • Posts: 1
  • Country: gb
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #32 on: July 29, 2022, 07:15:43 am »
Sorry for posting to an old thread, but it does seem more relevant than starting a new one as the thread contains links to relevant code.
I would like to try using lib-seek with Seek Compact (version with USB Micro connector) that I have used on and off with my Android phone, with a Raspberry Pi that I use for IR imaging...I thought it would be interesting to have both set up on the same Pi (although clearly unlikely that the Pi will be able to run both at the same time).
I have installed lib-seek as described in the text, but my problem relates to connection. I somehow need to connect the Seek micro USB to a the USB connector on the Pi. This clearly needs to be OTG (or does it?). I cannot find any commercial connector or cable that is Female USB B Micro to USB A male. Does anyone have any suggestions for either an available one, or how to do a DIY one? The only way I can see to do this at the moment is USB B Micro female to USB C male, then USB C female to USB A male, but this seems like a recipe for failure.

Thanks,
Simon
 

Offline Tamiore

  • Contributor
  • Posts: 14
  • Country: ru
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #33 on: July 29, 2022, 08:54:54 am »
@voltface

I have adapters like that. They definitely exist and are for sale.
For example:
 
The following users thanked this post: voltface

Offline tonykids

  • Regular Contributor
  • *
  • Posts: 79
Re: Running Seek thermal cameras (& others?) on a Raspberry Pi
« Reply #34 on: July 29, 2022, 04:20:40 pm »
I somehow need to connect the Seek micro USB to a the USB connector on the Pi. This clearly needs to be OTG (or does it?). I cannot find any commercial connector or cable that is Female USB B Micro to USB A male. Does anyone have any suggestions for either an available one, or how to do a DIY one?
It's  simple, there is no OTG stuff when connect seek to PC or rasp pi,just connect VCC D+ D- GND pin to pin
 
The following users thanked this post: voltface


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf