ROBINTsrl / LeptonVid

Lepton 3 SPI / GPIO streaming console application
BSD 2-Clause "Simplified" License
6 stars 2 forks source link

Raspi 3 B+ and Vsync pin #2

Closed TinManAkshay closed 4 years ago

TinManAkshay commented 4 years ago

Hi,

So far, i am able to receive the thermal output of the Lepton w/o enabling the vsync signal and i am facing few synchronization loss in the frames just like everybody does at the beginning. Can anyone help me here like what and where i2c commands and need to be set to enable the vsync pin and resolve sync issues?

Thanks, Akshay

weirdgyn commented 4 years ago

This doesn't sound like an issue... anyway the line options to specify the pin to connect to GPIO3 pin on LETPON (and therefore gather the VSYNC signal) is -w (followed by a number in WiringPi enumeration standard). The sequence of commands to enable VSYNC output from the camera module are here trough this line . There you can find references to I2C messages needed to enable such feature. Please note that I2C functions need I2C bus support to be enabled and you also need Lepton SDK.

TinManAkshay commented 4 years ago

Actually I am using pylepton libraries (https://github.com/groupgets/pylepton) to get the thermal output. I saw the i2c commands in the code you mentioned but you have any idea about how to enable the VSYNC pin with .py libraries? I know commands could be totally different for that but any clue would be helpful

Thanks

weirdgyn commented 4 years ago

You should take a look here:

https://lepton.flir.com/wp-content/uploads/2019/02/flir-lepton-software-interface-description-document-303.pdf

pag. 118

Il giorno gio 16 lug 2020 alle ore 19:23 TinManAkshay < notifications@github.com> ha scritto:

Actually I am using pylepton libraries ( https://github.com/groupgets/pylepton) to get the thermal output. I saw the i2c commands in the code you mentioned but you have any idea about how to enable the VSYNC pin with .py libraries? I know commands could be totally different for that but any clue would be helpful

Thanks

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/weirdgyn/LeptonVid/issues/2#issuecomment-659555785, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOP54VWFNURXQBFQOVRHI3R34ZQZANCNFSM4O3BIL6Q .

--

bye by(t)e[s]... WeirdGyn!

TinManAkshay commented 4 years ago

I have looked into the document and i have looked into your code as well. I understood how are your enabling the VSYNC pin.

FYI: I have Lepton radiometric 2.5 and Lepton breakout board v2.0 connected with Pi 3 B+

What are you suggesting is to make Python wrapper for FLIR Lepton SDK and then use them in main .py code. Also, in that case, I do not have to make any changes in pylepton library right? I just have to write some functions and commands (just like you have written in your code) in main .py code.

OR

If not Python wrapper, how would you suggest? Writing my own .py libraries and codes (as written in the Lepton SDK folder) to support I2C to enable the VSYNC or they are not necessary?

Looking forward to your further suggestions in my case

Thanks

weirdgyn commented 4 years ago

I'm not an expert in Python and I don't know PyLepton .. From what I remember of the Lepton protocol there are no changes in how the frame is transmitted with or without GPIO vsync signal. The signal could just help you to avoid software synchronization that IMHO is an extremely error prone strategy. That said if you find the python code that 'synch' with the frame beginning you could probably isolate the code you have to start when the vsync interrupt is triggered (of course I'm supposing you can handle the signal through interrupt). I cannot be more specific, I hope this helps.

Il giorno gio 16 lug 2020 alle ore 22:51 TinManAkshay < notifications@github.com> ha scritto:

I have looked into the document and i have looked into your code as well. I understood how are your enabling the VSYNC pin.

FYI: I have Lepton radiometric 2.5 and Lepton breakout board v2.0 connected with Pi 3 B+

What are you suggesting is to make Python wrapper for FLIR Lepton SDK and then use them in main .py code. Also, in that case, I do not have to make any changes in pylepton library right? I just have to write some functions and commands (just like you have written in your code) in main .py code.

OR

If not Python wrapper, how would you suggest? Writing my own .py libraries and codes (as written in the Lepton SDK folder) to support I2C to enable the VSYNC or they are not necessary?

Looking forward to your further suggestions in my case

Thanks

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/weirdgyn/LeptonVid/issues/2#issuecomment-659665497, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOP54VJMHUW75WU4ASSBR3R35R5HANCNFSM4O3BIL6Q .

--

bye by(t)e[s]... WeirdGyn!

TinManAkshay commented 4 years ago

Yeah i get your point. All i know is that w/o VSYNC pin, we face a synchronized issue with the frame rate, as in, there is synchronization loss in the frames. But if we enable VSYNC pin with I2c interface, we resolve the issue. In other words, there won't be any stuttering in the thermal output. Isn't it? Am i correct right?

weirdgyn commented 4 years ago

The effectiveness of the vsync based solution should be higher than a pure software one on a Raspberry like board host. Of course this depends on how 'good' is the code that captures the frame after the vsync event and some other factor. As a matter of fact unless I tried the vsync solution I never had a chance to see a smooth streaming. Anyway besides this you should check that your hardware solution is working fine. In my experience the 90% of the malfunctions and loss of frames are given from a bad placement of the camera inside the board socket. This seems to happen more frequently on I/F board v1.4 than on newer v2.0 probably because of a better socket. If you keep having loss of sync besides the code solution you are going to use, check the camera module to be firmly pressed inside the socket.

Il giorno gio 16 lug 2020 alle ore 23:26 TinManAkshay < notifications@github.com> ha scritto:

Yeah i get your point. All i know is that w/o VSYNC pin, we face a synchronized issue with the frame rate, as in, there is synchronization loss in the frames. But if we enable VSYNC pin with I2c interface, we resolve the issue. In other words, there won't be any stuttering in the thermal output. Isn't it? Am i correct right?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/weirdgyn/LeptonVid/issues/2#issuecomment-659683042, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOP54SBTKAOXH32DKSJQPLR35WA5ANCNFSM4O3BIL6Q .

--

bye by(t)e[s]... WeirdGyn!

TinManAkshay commented 4 years ago

Camera is perfectly pressed inside the socket in the board v2.0. I am getting the proper temperature pixels values but what i am facing is little sync loss as well as thermal video looks little choppy too.

weirdgyn commented 4 years ago

I don't know what you mean with choppy.. in my experience using vsync the chance of loss is pretty lower. The smoothness of video is somewhat limited given the refresh rate of such devices.

BTW: Take a look at the new official guide here:

https://lepton.flir.com/getting-started/raspberry-pi-lepton/

This defines a device that cleans up the camera access.

Best regards, Mike

Il giorno ven 17 lug 2020 alle ore 22:27 TinManAkshay < notifications@github.com> ha scritto:

Camera is perfectly pressed inside the socket in the board v2.0. I am getting the proper temperature pixels values but what i am facing is little sync loss as well as thermal video looks little choppy too.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/weirdgyn/LeptonVid/issues/2#issuecomment-660322853, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOP54QZT2CS6CSCOM2Q723R4CX47ANCNFSM4O3BIL6Q .

--

bye by(t)e[s]... WeirdGyn!

TinManAkshay commented 4 years ago

Hi,

I have already seen that document. That choppy video is coming out no more. Speaking of vsync signal, there is no way it can be enabled without I2C interface? Can't it be enabled using RasPi.GPIO libraries? Like enabling BCM 25 (GPIO ) high in the Raspberry.

-Akshay

weirdgyn commented 4 years ago

For what I read about Lepton the only way to enable Vsync is trough I2C bus.

Il giorno lun 20 lug 2020 alle ore 20:48 TinManAkshay < notifications@github.com> ha scritto:

Hi,

I have already seen that document. That choppy video is coming out no more. Speaking of vsync signal, there is no way it can be enabled without I2C interface? Can't it be enabled using RasPi.GPIO libraries? Like enabling BCM 25 (GPIO ) high in the Raspberry.

-Akshay

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/weirdgyn/LeptonVid/issues/2#issuecomment-661268480, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOP54UB7WEAXIE4A45ELHDR4SGOBANCNFSM4O3BIL6Q .

--

bye by(t)e[s]... WeirdGyn!

TinManAkshay commented 4 years ago

Yeah.

I am trying to read the 16 bit status register via I2C interface. I am familiar with the python libraries which read from any register. Since status register for Lepton is located at 0x0002, how can i read it? Shall I read from 0x00 first and then 0x02 and then append the read data together?