image
Educational Outreach

Computer Vision

student demonstration

 

Learning Outcomes 

In this lesson you will learn about the python language and OpenCV. You will understand how to create a program that will count the color of M&Ms in a video feed. This will be done by using digital image processing techniques such as color conversion, masking, dilation, and thresholding.

Materials 

How It Works 

In this activity you will learn the basics of contours and placing text on an image. You will also learn to apply thresholding limits to detect specific colors and your results on a test image that has been specifically calibrated for the threshold values. 

Activity 

  1. Set up Google Colaboratory
  2. Import the code to the library
  3. Upload Images to Google Colaboratory
  4. Detect the color green

Assessment

  1. Why are masking and thresholding so important to computer vision?
  2. What does each component of the HSV represent?
  3. How is HSV use to detect colors, such as green?
  4. Could you use other color scales, like RGB, to detect colors? Are there pros and cons?
  5. Were you able to detect green? What parameters did you use? 

Additional Resources

    1. Counting M&Ms Lesson Plan
    2. Counting M&Ms Vocabulary
    3. Counting M&Ms Library Imports
    4. Image Test 1
    5. Image Test 2
    6. Image Test 3