I meet a problem that I can not get image from the USB camera when I use the threading method in Nano.
Here is my code using python:
import threading
import cv2
class T1(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
t1()
class T2(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
t2()
def t1():
print('t1')
def t2():
print('t2')
thread1 = T1()
thread2 = T2()
thread1.start()
thread2.start()
cap = cv2.VideoCapture(0)
while(1):
ret, frame = cap.read()
print('3')
It could not print 3 in Nano but it can print 3 in common PC platform.
What should I do ?