- Small Target at 2 Feet

The centroid are (923,277),(711,283), (709,472), and (920,479).

The number of pixels are 9497, 10078, 10524, and 10435

The Covariances are -4.174271e+05, -1.833804e+05, -5.623353e+04, -1.945664e+05

The estimate was 2.0047 feet. - Small Target at 4 Feet

The centroid are (804,312),(694,320), (808,416), and (698,418).

The number of pixels are 2659, 2801, 2968, and 2910

The Covariances are -2.423972e+05, -1.395426e+05, -1.535951e+05, -7.842580e+04

The estimate was 3.8636 feet. - Small Target at 8 Feet

The centroid are (741,331), (686,335), (688,384), and (744,383).

The number of pixels are 215, 230, 264, and 246

The Covariances are -1.683344e+05, -1.231095e+05, -9.249119e+04, -1.302084e+05

The estimate was 7.7273 feet. - Small Target at 16 Feet

The centroid are (678,343), (678,368), (706,368), and (707,341).

The number of pixels are 215, 189, 190, and 131

The Covariances are -1.123070e+05, -1.339523e+05, -9.614419e+04, -1.143799e+05

The estimate was 14.6552 feet. - Big Target at 2 Feet

The centroid are (998,90),(358,98), (1009,719), and (371,737).

The number of pixels are 9039, 8386, 9879, and 7993

The Covariances are -8.240790e+05, -6.771527e+04, -8.402864e+04, -1.338204e+05

The estimate was 1.9926 feet. - Big Target at 4 Feet

The centroid are (912,149),(572,158), (916,491), and (576,498).

The number of pixels are 1590, 2081, 2542, and 2004

The Covariances are -2.423972e+05, -1.395426e+05, -1.535951e+05, -7.842580e+04

The estimate was 3.75 feet. - Big Target at 8 Feet

The centroid are (540,253), (710,254), (711,421), and (542,423).

The number of pixels are 540, 600, 742, and 619

The Covariances are -8.234647e+04, -2.081553e+05, -8.410008e+04, -1.412916e+04

The estimate was 7.5 feet. - Big Target at 16 Feet

The centroid are (574,356), (658,360), (571,441), and (656,444).

The number of pixels are 132, 141, 159, and 192

The Covariances are -4.749927e+04, -8.895610e+04, -1.691511e+04, -4.491936e+04

The estimate was 15.179 feet.

Data Collection procedure:

- First we put the image we are working with in the same directory as the program
- Next we call img = threshold(filepath); to get the thresholded image
- Then we call [segImg, count] = segregator(img); to get a segregated image and the number of segments found so that statistics can handle it.
- After that we call [centers, cov, nump] = statistics(segImg,count); which filters out the pixels and prints the centers, numpixels and covariances for each
- Lastly, we call tennisTriangulate(centers,x); where x is half the wood length in inches. This provides the distance in feet away from the camera.

We can see here that as the distance increases, the amount of error increases. This is most likely due to pixel density. It was found that when we used a higher resolution
camera, we were able to get better results at further distances because we just had more information and could use better thresholds to more accurately get the center of each tennis ball.
Currently, with the lower resolutions and the increased distance, the shade of the balls becomes less distinct and so the entire ball is not captured perfectly. Thus the center of the ball is misjudged and
since that is what is most signficantly used to calculate the distance, the error in the distance will be more. The smoothing function used in the first step of the pipeline would play a larger effect on images that are smaller since it would dilate and erode them proportionally much more than the larger images. Other factors that contribute to error is the yellow tape that has a similar hue to the tennis ball, when it is near the ball, its pixels may be added to the mass of the ball, skewing the distance metric. Also, as we got further away, the intensity of each tennis ball pixel decreased and this may have affected the hue and saturation we used to catch those pixels.

Furthermore, the tilt of the camera also has an affect on the resulting errror. A skewed angle make the balls appear farther than they actually are because they appear to be closer together than they actually are. A possible fix for this issue is to use use the slight change in y values to detect skews and use the orientation of all four balls for triangulation. It was found when we took pictures with slightly different angles of the 8 feet large targe, we got error of +- .131 inches which is relatively high. The skew is visible in the picture for the large target at distance 16.

Moreover, we see that the smaller target was more accurate for closer distances. This could be because the constant used in the last stage of the pipeline was calibrated using the small target at 2 and 4 feet. Furthermore, the small difference in the hue of the tennis balls between the small and big targets could have led to the difference in errors seen as perhaps not all the tennis ball pixels were filtered in correctly. Another cause of this error is focus of the camera. If the camera was not focused exactly on the tennis balls used for measuring distance, there is possible blurring of pixels that could lead to innacurate centers of for the balls. It was seen with experimentation that similar shots at the same distance had error around (0.126). This error may be due to angle or focus, but it more likely due to focus as the angle was held as constant as possible. In addition, we can see from the threshold image for the large target at distance 2 feet that there is dark smudge on one of the tennis balls. This did not meet the value of the threshold (modying the threshold here would have caused some wood and more tape to be counted) and so the ball center was skewed.

- The Threshold : threshold.m
- The Segmentation : segmenter.m
- The Statistics : statistics.m
- The Triangulation : tennisTriangulate.m