Lab 2: Vision Algorithm
Small Target 4 feet
Picture of small target from 4 feet away in REL Lab. Used as example to explain Pipline
Based on the hue and saturation values, thresholds were found for the binary image.
Threshold verifies pixels between .16 - .24 in Hue, and above .35 in Saturation.
Calculated these thresholds via spike in edges of balls on a row in image . Used graphs:
The green tennis balls produce a noticible change in hue, and saturation.
Using Recursion, grouped pixels and assigned values to each group.
Computed the 4 bulkest pixels masses and blackened out rest of groups.
This removes noise/insignificant masses that remained after thresholding.
Colorized 4 bulkest/highest concentration of pixels and determined as balls
Colorized balls in order of largest pixel masses, Red, Green, Blue, Teal.
The white X's represent balls centroid
For each ball group, average all the x and y coordinates of the pixels within to
obtain centroid coordinates.
Marked White X's to denote centroid's location.
Number of pixels in each ball group was also capture, and used later for distance triangulation.
First, determined if Big target (15 inch spacing) or Small target (5 inch spacing)
based on number of pixel in largest determined ball and proportions between Largest ball
pixel mass and average length between centroids
After defining target size (big 15 or small 5), a rough estimate of the focal length of
the camera was determined and then used in the triangulation equation (d = f * (h/ h')) to
Distance to Target: 46 inches
Distance to Target: 25 inches.
Distance to Target: 26 inches.
Distance to Target: 47 inches.
Distance to Target: 93 inches.
Distance to Target: 98 inches.
Distance to Target: 201 inches.
Distance to Target: 193 inches.
Potential sources of error:
Overthresholding Cuting off pixels form the balls expecially at up close ranges
This leads to mis calculation of centroids and ball pixel mass.
Compresstition of image from 2448 by 2448 to 196 by 196. information is lost.
compression was needed to fit within the realms of matLabs 500 stack recunsion depth limit
When target is 16 feet away balls become the sizes of 6 pixels. very Little info to work with, but enough.
Distance through triangulation is not exact. The shrinking via distance transversed
is a power function that needs something more accurate than and linear function.
To account for small error in the estimation of the big target, I added a coeffiecent to the
final distance estimation that addes or subtracts from the big focal length estimation based of average
length between tennis balls. This appear to get estimations within 15% error.
Support analysis with experiments:
Error for all targets at all distances is still within 15% error of total distance