Welcome to Raspbot V2 repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
3.Voice control color recognition
Voice control color recognition
Voice control color recognitionExperimental ObjectiveExperimental Procedure and ResultsMain source code analysis
Experimental Objective
Understand and learn basic semantics to enable the robot to recognize the color selected in the box.
Experimental Procedure and Results
- First, enter the following command in the terminal:
cd /home/pi/project_demo/10.Basic_voice_control/3.Speech_color_identify/python3 voice_Ctrl_color_identify.py- After entering this interface, wake up the robot using the wake-up phrase: Hi, Yahboom in English.

- After successfully waking up, the robot responds: "Hi, I'm here" in English.
- Use the mouse to select the color area to be recognized, then control the robot using fixed commands to recognize the corresponding color.

After selecting, the box will disappear. This is normal.

Fixed statement table
| Wake-up phrase (international users) | Operation phenomenon | Answers by Car (English version) |
|---|---|---|
| What color is this? | The car will identify the color area selected and answer the corresponding color. If it is red | This is red |
| What color is this? | The car will identify the selected color area and answer the corresponding color. If it is blue | This is blue |
| What color is this? | The car will identify the color area selected and answer the corresponding color. If it is green | This is green |
| What color is this? | The car will identify the color area selected and answer the corresponding color. If it is yellow | This is yellow |
Main source code analysis
xcolor_identify = Color_identify()capture = cv.VideoCapture(0)cv_edition = cv.__version__if cv_edition[0]=='3': capture.set(cv.CAP_PROP_FOURCC, cv.VideoWriter_fourcc(*'XVID'))else: capture.set(cv.CAP_PROP_FOURCC, cv.VideoWriter.fourcc('M', 'J', 'P', 'G'))capture.set(cv.CAP_PROP_FRAME_WIDTH, 640)capture.set(cv.CAP_PROP_FRAME_HEIGHT, 480)cv.namedWindow("frame",cv.WINDOW_AUTOSIZE)imshow_num = 0#Start the speech recognition threadaction_thread = threading.Thread(target=start_action)action_thread.daemon = True action_thread.start()while capture.isOpened(): start = time.time() ret, frame = capture.read() #cv.imshow("frame", frame) action = cv.waitKey(10) & 0xFF rgb_img = color_identify.process(frame) imshow_num +=1 if imshow_num%2==0: cv.imshow("frame", rgb_img) imshow_num = 0 if action == ord('q') or action == 113: breakstart_action: The color of the mouse selection based on fixed semantic recognition Color_identify: The color of the selected area