Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture of pixel temperature with Lepton 3.5 camera #44

Open
GillesBra opened this issue Sep 7, 2021 · 1 comment
Open

Capture of pixel temperature with Lepton 3.5 camera #44

GillesBra opened this issue Sep 7, 2021 · 1 comment

Comments

@GillesBra
Copy link

Hi Tomasz,
Thank you very much for your answer concerning the script you have developped for temperature capture with Lepton 3.5.

Not being experienced in software development, I send you below a few questions:

  • How is captured the 16 bits flow of the Lepton camera ? Does the Python script command the camera (in line 47 to 67 or 218) ? Or do we have to send separate commands through the CCI channel ?

  • Which data contains the libuvc and how is it fed ?

  • Which command stops the flow ?

  • Have you an example of the temperature array (both link in your mail points to the script)

  • Which configuration is needed to run the script ? Is Lepton 3.5 with PureThermal2 connected via USB to a PC with windows 10 acceptable ?

  • Which software do we have to load (Python, openCV...) ?

Sorry to take your time by basic questions, but this could help the project a lot.

@tomasz-lewicki
Copy link
Owner

Hi @GillesBra !

Glad you answer your questions:

  1. The Lepton Camera with Purethermal board act together as a USB UVC device. So going line-by-line:
  • start_pt2() in Line 47 is responsible for finding and opening the device,
  • uvc_get_stream_ctrl_format_size() in line 67 sets capture parameters such as frame dimensions, format, frame interval, etc. So the Y16/ 16-bit grayscale format is set here.
  • py_frame_callback() in line 78 is the function that is called every time a new frame arrives, and puts the frames in a Queue. The Queue is there mostly to avoid waiting in the consumer thread (could be up to 1/(8.7Hz)=115ms
  • Line 218 is where we pop the ready frames from a Queue, and convert them to Celsius via ktoc()
while True:
    data = q.get(True, 500)
    print(ktoc(data))
  1. Here it is (an aarch64 binary): https://github.com/tomek-l/ai-thermometer/blob/master/ir/libuvc_wrapper/libuvc.so

Here are instructions to build your own:

git clone https://github.com/groupgets/libuvc
cd libuvc
mkdir build
cd build
cmake ..
make
cp libuvc.so ~/ai-thermometer/ir/libuvc_wrapper
  1. self._exit_handler() does the cleanup here
libuvc.uvc_stop_streaming(self._devh)
libuvc.uvc_unref_device(self._dev)
libuvc.uvc_exit(self._ctx)
  1. I don't have an output of a full array. The closest thing would be in this notebook
array([[32.56, 32.32, 32.36, ..., 31.93, 31.47, 31.77],
       [32.52, 32.06, 32.  , ..., 31.77, 31.47, 31.81],
       [32.38, 32.36, 32.24, ..., 31.57, 31.53, 31.77],
       ...,
       [31.77, 31.75, 32.32, ..., 31.11, 31.15, 30.81],
       [31.75, 31.57, 32.12, ..., 31.03, 30.71, 30.89],
       [31.77, 31.59, 31.77, ..., 31.11, 30.71, 30.73]])
  1. Please read README.md. This is the list of supported parts:
# Part link Price (USD)
1 Jetson Nano Dev Kit link 99
3 FLIR Lepton 3.5 IR Camera link 199
4 GroupGets Purethermal2 Module link 99
2 Raspberry Pi Camera Module V2.1 link 25
5 Noctua cooling fan link 14
6 3D printed enclosure 3D model -
total 436
  1. The project depends on:
  • numpy (pip3 install numpy)
  • opencv (build instructions in README.md)
  • pytorch (build instructions in README.md)

That being said, I should add a proper requirements.txt to this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants