Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Computer Vision Basics cheat sheet - grade 9-12

Click image to open full size

Computer vision is how a robot uses cameras and algorithms to interpret images and make decisions. This cheat sheet covers the basic ideas students need to understand how robots detect lines, objects, colors, shapes, and motion. It is useful for robotics teams, coding projects, and classroom work with cameras or vision sensors.

The goal is to connect image data to real robot actions like steering, grabbing, sorting, or avoiding obstacles.

The core concepts include pixels, resolution, color models, filtering, thresholding, edge detection, and object tracking. A camera image can be treated as a grid of numbers, where each pixel stores brightness or color values. Vision algorithms often improve the image first, then extract important features such as corners, edges, blobs, or contours.

Robot programs use these measurements to estimate position, distance, direction, or object identity.

Key Facts

  • An image is a grid of pixels, and image size is width x height, such as 640 x 480 pixels.
  • In an RGB image, each pixel usually stores three color values: red, green, and blue, often from 0 to 255.
  • Grayscale brightness can be estimated with gray = 0.299R + 0.587G + 0.114B because human vision is most sensitive to green.
  • Thresholding converts an image to binary using the rule: if pixel value >= threshold, set it to 1, otherwise set it to 0.
  • A simple camera pinhole model uses image size relation: image height / object height = focal length / object distance.
  • Distance to an object can be estimated with distance = real object width x focal length / object width in pixels.
  • Edge detection finds places where brightness changes quickly, which often mark object boundaries or lane lines.
  • A robot vision pipeline usually follows: capture image, preprocess, segment, find features, classify or measure, then control the robot.

Vocabulary

Pixel
A pixel is the smallest picture element in a digital image and stores brightness or color information.
Resolution
Resolution is the number of pixels in an image, usually written as width x height.
Color Space
A color space is a way to represent colors numerically, such as RGB, HSV, or grayscale.
Thresholding
Thresholding is a method that separates pixels into groups by comparing their values to a chosen cutoff.
Contour
A contour is a curve or boundary that outlines a connected shape in an image.
Camera Calibration
Camera calibration is the process of finding camera properties so image measurements can better match real-world measurements.

Common Mistakes to Avoid

  • Confusing image coordinates with graph coordinates is wrong because image y-values usually increase downward from the top-left corner, not upward from the bottom-left.
  • Using RGB for every color detection task can be unreliable because lighting changes often affect red, green, and blue values strongly.
  • Choosing one threshold value without testing is a mistake because shadows, glare, and camera exposure can change pixel brightness.
  • Assuming a larger object in the image always means the object is larger is wrong because nearby objects also appear larger.
  • Skipping camera calibration can cause inaccurate distance or angle estimates because lens distortion and focal length affect image measurements.

Practice Questions

  1. 1 A robot camera captures a 1280 x 720 image. How many pixels are in one frame?
  2. 2 An object is 20 cm wide, the camera focal length is 600 pixels, and the object appears 150 pixels wide in the image. Estimate the distance to the object using distance = real object width x focal length / object width in pixels.
  3. 3 A pixel has RGB values R = 100, G = 150, and B = 200. Estimate its grayscale value using gray = 0.299R + 0.587G + 0.114B.
  4. 4 Why might a robotics team use HSV color space instead of RGB when detecting a colored game piece under changing lighting?