groupgets / purethermal1-uvc-capture

USB Video Class capture examples for PureThermal 1 / PureThermal 2 FLIR Lepton Dev Kit
130 stars 81 forks source link

Trigger FFC from Python under Windows #54

Open sebi5361 opened 3 years ago

sebi5361 commented 3 years ago

I am using:

After adjusting opencv-capture.py (to make it Python3 compliant) I can run it properly and see a display with the images taken from my Lepton camera. But I need to trigger FFC manually to get an exploitable image.

My understanding is that I need to have libuvc built to do so. Is there an alternative way?

After struggling with the toolchain (I had to install pthreads, etc) I was able to generate uvc.dll. But uvctypes.py fails with:

Traceback (most recent call last): 
  File "C:\Users\krut\Desktop\purethermal1-uvc-capture-master\python\uvctypes.py", line 214, in <module> 
    libuvc.uvc_get_format_descs.restype = POINTER(uvc_format_desc) 
  File "C:\Users\krut\Anaconda3\lib\ctypes\__init__.py", line 386, in __getattr__ 
    func = self.__getitem__(name) 
  File "C:\Users\krut\Anaconda3\lib\ctypes\__init__.py", line 391, in __getitem__ 
    func = self._FuncPtr((name_or_ordinal, self)) 
AttributeError: function 'uvc_get_format_descs' not found

I suspect it is because I kept the fields LIBUSB_INCLUDE_DIR and LIBUSB_LIBRARY_NAMES void in Cmake and that libsub was not included properly while building libuvc (uvc.dll is 11KB only). I am surprised VS2019 didn't complain while building the library though.

So I tried pointing at the proper locations for libusb:

But I get this error message while building libuvc with VS2019:

Severity    Code    Description Project File    Line    Suppression State 
Error   LNK1107 invalid or corrupt file: cannot read at 0x300   uvc C:\Users\krut\Desktop\libusb-1.0.24\VS2019\MS64\dll\libusb-1.0.dll  1

and I don't know how to fix it...

Any help would be appreciated:

OrestisDotplot commented 1 year ago

Hi, I am facing the same problem, were you able to solve this ?

EduardoRonchi commented 1 year ago

Hello.

Any updates on this issue?

OrestisDotplot commented 1 year ago

Hey, I was able to build a windows app which does FFC:

Build the mediafoundation example in the repo: https://github.com/groupgets/purethermal1-uvc-capture To build the above, install Visual Studio with Windows 10 SDK. To build, follow the instructions here: https://github.com/Microsoft/Windows-classic-samples/tree/main/Samples/Win7Samples/multimedia/mediafoundation/MFCaptureToFile

I removed the initial few lines of the code and built an app so that when I launch the app, it calibrates lepton and the closes off.