Myzhar / Lepton3_BBB

A grabber for BeagleBone Blue to acquire thermal images from Lepton3 sensor
GNU Lesser General Public License v3.0
13 stars 4 forks source link

Not for pull, just for show #2

Open jadonk opened 6 years ago

jadonk commented 6 years ago

I connected up an LCD per https://gist.github.com/jadonk/0e4a190fc01dc5723d1f183737af1d83 and tested if I could get a good IR image.

The CPU utilization hovers around 13% and the image comes out inconsistently. It runs smooth for some time, then hangs.

I'm going to look a bit more at the grabber library, but I'd ideally like to move it to the kernel space.

Myzhar commented 6 years ago

I went deep into the datasheet and I think that the better way to work is to try to receive segment by segment (1 segment = 60 paskets) and to create the frame when you have the 4 consecutive segment composing it. Look at the branch "test_from_qt" (the name is not significative). I also included SPI and I2C calling to the class that performs communication to have a more readable code. I'm going to test this approach in the next 5-6 hours

Myzhar commented 6 years ago

@jadonk the problem about image that hangs is due to loss in sync. If you read the engineering datasheet you will find that when the host lose sync the sensor must be reset. The document is this: http://www.flir.com/uploadedFiles/OEM/Products/LWIR-Cameras/Lepton/Lepton-3-Engineering-Datasheet.pdf read carefully from page 35 to page 46... it's really important according to me.

If you are going to write a kernel module I think that using an interrupt to get GPIO3 pulses can help syncing a lot more. Lepton3 sends a sync pulse on GPIO3 when a new segment is available, you must enable this feature using the right CCI command on I2C.

jadonk commented 6 years ago

@Myzhar Why did you comment out the frame grabbing in the OpenCV demo? How do you get frames with this update?

As you probably saw, I found it much easier just to work with the raw data than to try to manipulate through OpenCV.

Myzhar commented 6 years ago

I'm going to write the code for this part. "OpenCV" is only a way to manipulate the data... today I will transform RAW data to "image data".

In the last week I concentrated the work on trying to retrieve the four segments that make a full image frame without losing the synchronization. The "capture" code that I used before in the "devel" branch was getting the data in a not correct way and this caused a lot of de-sync. Following strictly the time-rules on the datasheet I finally reached a good synchronization and I can get each frame at full FPS.

Myzhar commented 6 years ago

@jadonk the opencv_demo is working. As you can see the Lepton Library emits a 16bit buffer, in the mainloop I normalize/rescale it and then I convert to 8 bit before saving.

Now I can test the SDK capabilities, the "radiometry" over all.