Software to check or adjust AGC mode and Radiometry

907 views
Skip to first unread message

LaBird

unread,
Jul 22, 2015, 2:18:52 AM7/22/15
to Flir Lepton
I am new in using the Lepton thermal camera on Raspberry Pi. I find that contrast of the pictures captured seem to be auto adjusted. For example, if a hot object exists, the surrounding items become darker in the thermal image. I would like the same intensity to be shown on different images with same temperature. I read the data sheet and know that the AGC mode may be the main cause of the issue, and the data sheet also said the AGC mode is disabled by default. The radiometry may also be a possible reason. However, I cannot find a way to use software to check the current AGC and radiometry modes, or to enable/disable them. 

Is it possible to do so, and if so, what is the command, or where can I download the software? Thanks!

Jimmy T

unread,
Jul 23, 2015, 12:49:47 AM7/23/15
to Flir Lepton, labir...@gmail.com
I believe the code rescales the min to max values of each frame to the spread of the color map to keep the dynamic range of the image optimized for viewing.

You could modify LeptonThread not to do that, but your images might not look very good depending on the temp average and differential of what you're viewing.

LaBird

unread,
Jul 23, 2015, 12:29:06 PM7/23/15
to Flir Lepton, labir...@gmail.com
Thank you Jimmy for the answer, I did not notice the code has rescaled the intensity of the image pixels.

On the other hand, I still would like to know how to check and set the AGC and radiometry modes in software. For AGC, I followed the Lepton SDK code, and tried to use the LEP_GetAgcEnableState() function like this:

    LEP_OpenPort(1, LEP_CCI_TWI, 400, &_port);             
    LEP_RESULT lep_res;                                    
    LEP_AGC_ENABLE_E_PTR lep_ptr;                          
    lep_ptr = (LEP_AGC_ENABLE_E_PTR)malloc(sizeof(int));   
    lep_res = LEP_GetAgcEnableState(&_port, lep_ptr);      


However it did not work, and I got an error LEP_ERROR_I2C_FAIL. The problem is when the function LEP_GetAgcEnableState() calls this line in the function DEV_I2C_MasterReadData() in raspi_I2C.c:

    int writeValue = write(leptonDevice, txdata, bytesToWrite);    

It failed with an errno EBADF. And I further checked, and found that LEP_OpenPort(1, LEP_CCI_TWI, 400, &_port); has failed too with the errno ENETRESET, hence making the _port.portID being 0. What was wrong? Is that I should provide another port nnumber apart from 1 in LEP_OpenPort()?


LaBird

unread,
Jul 24, 2015, 12:14:51 PM7/24/15
to Flir Lepton, labir...@gmail.com
It turned out that the I2C module was not loaded. I followed this URL https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c and did both parts (raspi-config and the manual install part) to solve the problem. Now the AGC mode can then be checked, set and unset.
Reply all
Reply to author
Forward
0 new messages