# Thread: Concentration of points

1. ## Concentration of points

I am working on my final year project and my project title is Vision Based Navigating Robot. Therefore I must use image processing to obtain the robots heading. Now following is a sketch of the typical output which I obtain through image processing.

The red dots are the dots that will lead my robot to navigate through the path successfully. The blue dots occur due to noise which is erroneous. The number of dots I obtain vary from image to image which I obtain through the webcam. I need to find the BEST point which represents the majority of the correct points. I use only the x value of the point for navigation since the robot either turns right or left. I will give an example with x coordinate values to help understand this problem better.

The correct x Coordinates = [300, 310, 325, 321, 290, 285, 322]
The erroneous x Coordinates =[480,195,410]

Usually the erroneous x Coordinates lie a bit far apart from the correct x coordinates. Usually I get all the x coordinates in one matrix which is a mix of correct points n wrong points. I tried using the mean and median but still both mean and median values of the x coordinate matrix was affected by the erroneous points which affected the accuracy of my robot.

Is there any method of averaging to help in removing the effects of these erroneous points? I was thinking if its possible to find Q1 Q2 Q3 and then try to figure out what are the outliers. But I wasn't sure how to proceed with this. Is there any better statistical way to get the x Value that is closest to the cluster of the correct x coordinates which also effectively reduces the effect of the erroneous x coordinates. I am using matlab to process the images so I can use the tools in matlab for statistical purposes as well (As long as its not a brute force algorithm which would affect the speed of my robot) I will provide further details if required.

2. ## Re: Concentration of points

Hi,

Have you tried using a truncated mean?

1. Sort the entries in your matrix using the function sort.

2. Remove the $n$ first and $m$ last entries of the matrix.

3. Calculate the mean of what you have left.

If the number of outliers doesn't vary too much, you should be able to find values for $n$ and $m$ that get rid of most of the unwanted values.

Edit: There is a MATLAB function for calculating the truncated mean, called trimmean.