if i run this code in VsCode with python it works just fine but if i run it with MicroPython i get the error ImportError: no module named 'cv2'
#from machine import ADC,PWM,Pin
import cv2
import mediapipe as mp
LandMarks = mp.solutions.drawing_utils
HandsModule = mp.solutions.hands
cam = cv2.VideoCapture(0)
forcc = cv2.VideoWriter_fourcc('m','p','4','v')
with HandsModule.Hands(static_image_mode = False,min_detection_confidence=0.7,min_tracking_confidence= 0.7,max_num_hands=2) as hands:
while True:
ret,frame = cam.read()
frame1 = cv2.resize(frame,(640,480))
results = hands.process(cv2.cvtColor(frame1,cv2.COLOR_BGR2RGB))
if results.multi_hand_landmarks != None:
for handlandmarks in results.multi_hand_landmarks:
LandMarks.draw_landmarks(frame1,handlandmarks,HandsModule.HAND_CONNECTIONS)
cv2.imshow('img',frame1)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
note: i just commented import machine because python doesn't recognize it as MicroPython