Freenove / Freenove_Robot_Dog_Kit_for_Raspberry_Pi

Apply to FNK0050
Other
134 stars 90 forks source link

cv2 errors when calling client on raspberry pi os #1

Closed bitjockey42 closed 3 years ago

bitjockey42 commented 3 years ago

Hi, I tried running the Client on the raspberry pi driving the robot, but I ran into an issue launching the client:

pi@raspberrypi:~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Client $ sudo python Main.py
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Traceback (most recent call last):
  File "Main.py", line 1072, in <module>
    myshow=MyWindow()
  File "Main.py", line 27, in __init__
    self.client=Client()
  File "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Client/Client.py", line 16, in __init__
    self.face = Face()
  File "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Client/Face.py", line 7, in __init__
    self.recognizer = cv2.face.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.face' has no attribute 'LBPHFaceRecognizer_create'

I changed line 7 to self.recognizer = cv2.face.createLBPHFaceRecognizer() but then ran into this error:

pi@raspberrypi:~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Client $ sudo python Main.py 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Traceback (most recent call last):
  File "Main.py", line 1072, in <module>
    myshow=MyWindow()
  File "Main.py", line 27, in __init__
    self.client=Client()
  File "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Client/Client.py", line 16, in __init__
    self.face = Face()
  File "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Client/Face.py", line 8, in __init__
    self.recognizer.read('Face/face.yml')
AttributeError: 'cv2.face_LBPHFaceRecognizer' object has no attribute 'read'

To fix that I did changed line 8 to: self.recognizer.load('Face/face.yml')

DenzelChen commented 3 years ago

Dear customer, Thank you very much for your feedback. Different version of OpenCv has different functions. We just updated the setup code. And we will test your modification later. If you have any concerns, please feel free to contact us at: support@freenove.com Sincerely, Freenove Support Team