According to my researchings, Lepton Sensor s AGC mode is disabled by default. There are 4 modes and I want to try each option. I found this code and I dont know what should I do right now. How should I suppose to change the variable in this code I changed this header and loaded.Now OpenMV Lepton vision kinda broken
Edit: Should I change LEP_AGC_ENABLE = 1 and delete LEP_AGC_DISABLE to enable AGC?
typedef enum LEP_AGC_ENABLE_TAG
LEP_AGC_DISABLE = 0,
LEP_AGC_ENABLE_MAKE_32_BIT_ENUM = 0x7FFFFFFF
/* AGC Policy Enum
typedef enum LEP_AGC_POLICY_TAG
LEP_AGC_LINEAR = 0,
LEP_AGC_POLICY_MAKE_32_BIT_ENUM = 0x7FFFFFFF
yes I upgraded myself but im literally stuck now
Hi, editing enums directly in a C header is not how one changes behavior… please reload the default firmware.
As for disabling AGC. We have an Ioctl in the sensor module that’s documented for doing this…
but you were said that FFC shutter mode can be changeable in firmware. And I thought that i can enable the AGC in firmware.
I couldnt activate the AGC in the script. And i thought that i can do in firmware. Probably i am totally wrong isnt it?
If you know the solution could you please advice me?
I sent you the command to execute in the other post. You didn’t have to change any firmware. You just needed to craft a byte array to give to the function call.
What exactly are you trying to do? You’re asking questions about modifying low level behavior versus just asking how to actually make application X happen.
Sorry I just have to complete my project for my school and I have not much time. I may be stressful in the forums. I really appreciative for your help. @kwagyeman @iabdalkader
But what did you need help with?
I need to detect alive creatures in the thermal image as fast as possible. But I have some issues about that:
Some thermal images are not enough good because of the cold and hot objects temperature difference. This issue can be resolve with activating AGC. So Im trying to activate AGC.
When the code executed, the lepton camera starting and this Lepton is activating the FFC mode immediately and according to this, the FFC mode is delaying to start to recordi g about 2.5 seconds. So I have to disable the FFC. Yes this can be cause some issues after 15 seconds. But i will record 100 frames at most. I dont think there will be a problem but if this will be a problem, I can enable the FFC shutter at the end of the code.
Okay, I don’t have a fix for turning FFC off. If you want to do that you need to use a better sensor. The FLIR camera isn’t really something that works without FFC. I’d use an Melexis sensor. However, the resolution will be just 32x24.
As for turning AGC off: sensor — camera sensor — MicroPython 1.15 documentation
AGC is on by default on the FLIR. You have to disable this explicitly in our code via an IOCTL to get actual temperature readings.
Thanks I searched the docs of
ioctl() but I couldn’t find any function or command about turn on/off AGC.
Maybe I couldnt see the command or there is a different way to disable or enable the AGC which is like
Do you know the actual codeline about that?
dear friend … unfortunately flir sensor must start with ffc cause is the way it calibrate itself. The idea to turn on ffc after 15 sec will not help cause the sensor will be out of calibration…
Lets tell that you will do this… why dont you worry about the ffc after the 15 sec from power up?
@oramafanis Thanks for your reply. The reason that I do not worry about the FFC after 15 secs is that I should not lose the image in the very beginning of my record, however I may lose the one at the end. I mean, the first capture is the capture that I mainly want to have but after 15 secs, my system will go to sleep mode and there will be no problem if I lose 2.5 secs at the end.
Hi @kwagyeman @oramafanis @iabdalkader ,
I did something like this and I think that maybe will this format i think.
data1 = struct.pack(">HH", 0,1)
sensor.ioctl(sensor.IOCTL_LEPTON_SET_ATTRIBUTE, 0x0100, data1)
According to this struct:
I think I set the values of
LEP_AGC_ENABLE = 1 LEP_AGC_DISABLE = 0
Result image is kinda broken where is the problem?
Set measurement mode literal does this for you. It turns AGC off when you call it.
Just use the ioctl set attribute to turn off the FFC process.
Yes I know this and I wrote a code block and it doesnt work. Also I do know that I can turn off the FFC with ioctl but i dont know exactly how.(Set attribute what, set variables what etc )
so as i understand you first have a proximity sensor that wakes up camera. then camera must see some temp so to decide that there is an animal. and then it sleeps again waiting the next trigger.
What you dont understand is that the image will never be the same with the sensor uncalibrated. you cant rely on this image unfortunately…
A solution maybe is a sensor that you manually calibrated with a plate. I think that lepton 2 series doesn’t have auto calibrate fuction … have a look at them…
@oramafanis You understood it end-to-end correctly. Thanks a lot for your reply. I’d love to ask one more further question to make everything clear for myself.
My system will remain its position for a long time which means the temperature of the environment will not be changing. As far as I know, FFC/Shutter mode exists to calibrate the temperature and the objects’ temperature around the environment. Since the temperatures of every object remains same, I believe I will not need a shutter for every wake-up, will I?
Thanks in advance.
Yes, so, I previously gave you a link to the command you’ll need to execute to turn FFC off. I don’t know the argument necessary however as I don’t think the sensor will continue to work if you do this and this I have never tried. But, you can try and maybe you might get a result you will like.
If you look through the API there’s no straight forward disable FFC option though…
Alright @kwagyeman I ll keep trying this. However, since this is enabling/disabling AGC topic, I wonder how to enable/disable AGC like I wodered in FFC topic.
I ve done like that as I said before: Lepton 3.5 Activating AGC - #14 by BehicMV
However this code broke my image. So, anyone have an idea of code line?
Here are my codes and the results with cold water and hot water tests:
Measurement mode and unpack struct:
Only unpack the struct
Only the Measurement mode:
What should I do @kwagyeman @iabdalkader @oramafanis?