Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger FFC from Python under Windows #54

Open
sebi5361 opened this issue Aug 23, 2021 · 3 comments
Open

Trigger FFC from Python under Windows #54

sebi5361 opened this issue Aug 23, 2021 · 3 comments

Comments

@sebi5361
Copy link

sebi5361 commented Aug 23, 2021

I am using:

  • Software: Python 3.8.11
  • OS: Windows 10 Pro, x64, Version 21H1
  • Camera: Flir Lepton 1.6, non-shuttered, slow video 9 Hz
  • USB Adapter: Pure Thermal mini (fw:v1.0.0) [0200]

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:

  • LIBUSB_INCLUDE_DIR = C:/Users/krut/Desktop/libusb-1.0.24/include/libusb-1.0
  • LIBUSB_LIBRARY_NAMES = C:/Users/krut/Desktop/libusb-1.0.24/VS2013/MS64/dll/libusb-1.0.dll

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:

  • What is the easiest way to trigger FFC in Python under Windows 10?
  • What is the best approach to compile libuvc under Windows? Using VS2019 or CygWin?
  • Is it normal that the generated libuvc library is named uvc.dll not libuvc.dll?
  • How to solve the LNK1107 error?
  • Did anyone successfully compile libuvc under Windows?
  • Maybe someone can share its x64 uvc.dll with me so I can try it using uvctypes.py and uvc-deviceinfo.py?
  • There are three versions of libuvc: the original one from libuvc, an advanced one from pupil-labs supposed to work out of the box on Windows, and the one from groupgets. Should I stick to the one from groupgets or the others include the modifications made by groupgets at this time?
@OrestisDotplot
Copy link

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

@EduardoRonchi
Copy link

Hello.

Any updates on this issue?

@OrestisDotplot
Copy link

OrestisDotplot commented Apr 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants