Presentation is loading. Please wait.

Presentation is loading. Please wait.

Processing the image with Python

Similar presentations


Presentation on theme: "Processing the image with Python"— Presentation transcript:

1 Processing the image with Python

2 Basics Python is a programming language
OpenCV is a library used to process the image Tasks Capture images from the webcam Analyze the image to determine color (or other features) Based on the color to control the robotic arm to carry out different operations Example if the object is blue then pick it up and put on the right hand side If the object is red then pick it up and put on the left hand side

3 Python Start a command prompt by “CMD”
Start Python programming environment by “idle”

4 Python program environment

5 Test the program to capture images from Webcam
To capture images from webcam and other image processing functions need to include the opencv Import cv2 Go to the ftp site and download the sample programs Under File -> New File Paste the file Run the program by pressing F5 or under Run -> run module

6 Image format An image is composed with many elements called pixels
An Iphone 7 has 12MP (Mega Pixel) Each pixel uses 3 components to represent the color Using RED, GREEN, BLUE Other format is available HSV H-hue S – saturation V – value

7 HSV vs RGB

8 Communicating with Arduino
The Python program will send signal to Arduino so that the arm will perform the action It is also by serial communication Need to import serial Use the COM with the same number as the Arduino Write – to send Read – to receive

9 Exercise Try to send the character ‘0’ to the arm
In the arm side, open the gripper after receiving the ‘0’ then send back the message “OK”

10 Put things together If input object is Blue then send ‘B’ to arm
If input object is Red then send ‘R’ to arm In the arm side, set the arm to a start position If receive a ‘B’ then pick up the object and turn left (turn right for ‘R’) and put down the object Go back to the starting position and send back “OK” to notebook wait for the next signal


Download ppt "Processing the image with Python"

Similar presentations


Ads by Google