# Help with transforming a value so that it better fits within a recursive filter

I am working on an application where I need to evaluate a metric that determines how 'well distributed' a set of points (\$X) are in the 2D plane that is a camera image. By evaluating this metric for different positions of the camera, I attempt to find out certain good locations that are of use in a robotic application. The way this metric is evaluated is by binning the image (using preset bin sizes), finding out how many points lie in each bin, and then taking the variance, which is then divided by the number of points present in the image (for normalization purposes). Hence, the lower this value, the 'better' the location.

In the next step, in order to actually understand the concept of a 'good' location and to indicate that spending more time in a good location reduces uncertainty, a Kalman filter is used. The previously computed metric is used to scale the measurement noise covariance in the filter. Simply put, assuming the initial covariance is $$P'$$, and the measurement noise covariance is $$R$$, the equations can be written as below.

$$S = P' + R$$ $$K = S^{-1}*P$$ $$P = (I - K)*P'$$

Because of the way these equations are constructed, the relationship between the scaling value of R and the output covariance $$P$$ looks as below: the system exhibits the biggest change between $$P'$$ and $$P$$ around values 0-5 of R. In this example, $$P'$$ was set to $$I_{3\times3}$$. Intuitively, this means once R drops below 5, we can confidently assume we are in a location with good measurements.

Here comes the problem: the Kalman filter equations act perfectly in determining good areas when R is a metric such as "Euclidean distance from a point of interest", because this function descends with a significant slope when approaching the point. But with the camera based metric described above, the variance values responsible for R are usually much less than 1, which causes the system to treat almost every area as good. Example below:

Using a scaling factor to multiply the values of R to scale them to a range such as 0-10 works, but the values of R usually depend on various factors such as camera parameters, distribution of points being viewed: which means the scaling factor would have to be set by hand for each application. The minimum value of R over the space is not known beforehand, which makes it hard to normalize it. Is there a better way to transform this data to fit the system of equations described by the Kalman filter and to exhibit significant change over the search space?

• I am not sure why you are using a Kalman filter, because what you are trying to optimize does not have any dynamics in time. Wouldn't an optimization algorithm like gradient decent work better? – Kwin van der Veen Feb 1 at 0:22