Closed tigonza closed 4 years ago
Can you build the latest upstream libuvc (https://github.com/libuvc/libuvc)? If so, this project has a branch master+libuvc-upstream
that should work with it.
I get these errors:
CMake Error at CMakeLists.txt:67 (add_library): Target "uvc" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:67 (add_library): Target "uvc" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:67 (add_library): Target "uvc" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:67 (add_library): Target "uvc" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:84 (add_library): Target "uvc_static" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:84 (add_library): Target "uvc_static" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:84 (add_library): Target "uvc_static" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:84 (add_library): Target "uvc_static" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:67 (add_library): Target "uvc" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:84 (add_library): Target "uvc_static" links to target "LibUSB::LibUSB" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
Is there a way to change the places its looking for the LibUSB? Ive found precompiled libusb-1.0 libraries but I cant seem to force their use.
I have no experience with the Windows build. You should post an issue on that project. Once you manage to get the upstream version working, you can use the code in the master+libuvc-upstream
of this project with it.
I'm not sure this is useful for you, but if you want to avoid libuvc on windows, it's possible with using opencv. You can also get temperature info with this (I just modified opencv-capture.py a bit.);
#!/usr/bin/env python
"""
CV2 video capture example from Pure Thermal 1
"""
try:
import cv2
except ImportError:
print( "ERROR python-opencv must be installed")
exit(1)
import numpy as np
class OpenCvCapture(object):
"""
Encapsulate state for capture from Pure Thermal 1 with OpenCV
"""
def __init__(self):
# capture from the LAST camera in the system
# presumably, if the system has a built-in webcam it will be the first
for i in reversed(range(10)):
print( "Testing for presense of camera #{0}...".format(i))
cv2_cap = cv2.VideoCapture(i)
if cv2_cap.isOpened():
cv2_cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*"Y16 "))
cv2_cap.set(cv2.CAP_PROP_CONVERT_RGB, False)
break
if not cv2_cap.isOpened():
print( "Camera not found!")
exit(1)
self.cv2_cap = cv2_cap
def show_video(self):
"""
Run loop for cv2 capture from lepton
"""
cv2.namedWindow("Lepton Radiometry", cv2.WINDOW_NORMAL)
print( "Running, ESC or Ctrl-c to exit...")
while True:
ret, img = self.cv2_cap.read()
img = img[0:120, :]
if ret == False:
print( "Error reading image")
break
# print(img.shape)
if True:
data = cv2.resize(img, (640, 480))
minVal, maxVal, minLoc, maxLoc = cv2.minMaxLoc(data)
img = raw_to_8bit(data)
display_temperature(img, minVal, minLoc, (255, 0, 0))
display_temperature(img, maxVal, maxLoc, (0, 0, 255))
cv2.imshow('Lepton Radiometry', img)
else:
cv2.imshow("Lepton Radiometry", cv2.resize(img, (640, 480)))
if cv2.waitKey(5) == 27:
break
cv2.destroyAllWindows()
def raw_to_8bit(data):
cv2.normalize(data, data, 0, 65535, cv2.NORM_MINMAX)
np.right_shift(data, 8, data)
return cv2.cvtColor(np.uint8(data), cv2.COLOR_GRAY2RGB)
def display_temperature(img, val_k, loc, color):
# val = ktof(val_k)
val = ktoc(val_k)
# cv2.putText(img,"{0:.1f} degF".format(val), loc, cv2.FONT_HERSHEY_SIMPLEX, 0.75, color, 2)
cv2.putText(img,"{0:.1f} degC".format(val), loc, cv2.FONT_HERSHEY_SIMPLEX, 0.75, color, 2)
x, y = loc
cv2.line(img, (x - 2, y), (x + 2, y), color, 1)
cv2.line(img, (x, y - 2), (x, y + 2), color, 1)
def ktof(val):
return (1.8 * ktoc(val) + 32.0)
def ktoc(val):
return (val - 27315) / 100.0
if __name__ == '__main__':
OpenCvCapture().show_video()
I'm using python3.6.8 opencv-python (3.4.7.28) Lepton3.5 PTmini (with latest firmware from https://github.com/groupgets/purethermal1-firmware)
Is it possible to avoid using libuvc on Windows but to trigger FFC on my Pure Thermal mini? I am using: Python 3.8.11 Windows 10 Pro, Version 21H1 PureThermal (fw:v1.0.0). Hence I am having difficulties building libuvc... After adjusting opencv-capture.py (to make it Python3 compliant mainly) I can run it properly, but I get an error when running uvc-deviceinfo.py involving libuvc (uvc.dll):
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
Is it actually possible, Ive yet to successfully compile the libuvc libraries. Is there documentation on how to actually install the dependencies on windows (libusb, libuvc)?