Question
Program Inputs Enter image numbers to process in []: The user will always enter two whole numbers (lowest number first) corresponding to the puck images
Program Inputs Enter image numbers to process in []: The user will always enter two whole numbers (lowest number first) corresponding to the puck images Program Outputs Estimated fastest puck speed (pixels/second): XXX Replace XXX with the highest calculated p
Object Tracking Implement the color thresholding technique to track an air hockey puck across multiple images Key programming concepts: images, thresholding Approximate lines of code: 30 (does not include comments or white space) Note: You may not use any fancy image processing routines (rectangle,imerode,circle,etc...
Remember that images are just a grid of pixels (think width and height) where each pixel has a red, green, and blue color component adding a third dimension. By locating all the pixels that fall into the RGB color range of the blue puck, we can identify its location in every image! This process is known as thresholding and results in a binary image (black and white only). After thresholding, you can identify the center of the puck and determine its outer edge. Finally, you can estimate the pucks velocity from two consecutive images. For example given the puck image on the left, we can outline the puck in white and draw a red line showing the direction of travel:
Puck Tracking Algorithm Process the desired images in a loop Open and threshold the images for the blue puck and calculate the pucks center Find the pucks outline using the Erosion algorithm ? The outline of the puck is any pixel in the binary image that has a value of 1 but at least one of its four neighboring pixels is a zero. (The four neighbors are the pixel values that are above, below, left, and right of the current pixel. You can safely skip the pixels on the edge of the image!). ? More info: http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_morphological_ ops/py_morphological_ops.html Update the current image to show how the puck is moving ? Overlay a pure red line from the center of the puck that is 15 pixels long ? Overlay the pucks outline as a white line Save the new image by adding outline to the filename before the .png ? For example, if processing image 2.png, save the new one as 2 outline.png ? You can safely skip the first image! Calculate the pucks velocity based on this image and the previous image ? The images were taken with a PlayStation Eye camera at 120 frames per second (fps) Display the pucks fastest velocity in pixels per second from all images processed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started