我正在通过edge impulse来实现图像识别 在命令行输入edge-impulse-linux时 提示cannot find webcams但是我的摄像头是能正常拍照的
edge-impulse使用的是opencv调取摄像头,看一下opencv安装好了么?
源码部分
def get_webcams():
port_ids = []
for port in range(5):
print("Looking for a camera in port %s:" %port)
camera = cv2.VideoCapture(port)
if camera.isOpened():
ret = camera.read()[0]
if ret:
backendName =camera.getBackendName()
w = camera.get(3)
h = camera.get(4)
print("Camera %s (%s x %s) found in port %s " %(backendName,h,w, port))
port_ids.append(port)
camera.release()
return port_ids
....
....
with ImageImpulseRunner(modelfile) as runner:
try:
model_info = runner.init()
print('Loaded runner for "' + model_info['project']['owner'] + ' / ' + model_info['project']['name'] + '"')
labels = model_info['model_parameters']['labels']
if len(args)>= 2:
videoCaptureDeviceId = int(args[1])
else:
port_ids = get_webcams()
if len(port_ids) == 0:
raise Exception('Cannot find any webcams')
if len(args)<= 1 and len(port_ids)> 1:
raise Exception("Multiple cameras found. Add the camera port ID as a second argument to use to this script")
videoCaptureDeviceId = int(port_ids[0])
Linux make 时会出现
/usr/bin/ld: cannot find -lxxx
我遇到时 这个XXX(库的名字)已经存在 但不时在lib库下 ,原来在Linux里gcc时是不需要加-lXXX的,会自动编译,加了反倒编译不过,我把makefile里的-lXXX去掉后就通过了。