I would like to maximize $$ \int_0^{2\pi} \frac{(f'(x))^2}{f(x)}dx $$ subject to $f(x)\leq 1$ for all $x$ over the space of nonnegative trigonometric polynomials of degree smaller or equal to $n$.

The application would be to design a (theoretically) optimal 1d-image for position tracking via template matching.

Here is short explanation why the maximum of this interval gives the (theoretical) optimal image. The values of $f$ correspond to the intensity of the image, this is why it must be positive. The image is assumed to be periodic for simplification and because of practical reasons. The optics acts as a low-pass filter cutting of completely all frequencies above some threshold. Hence the image will be a trigonometric polynomial. With one measurement at $x$ we can determine the position with an std of $\sigma /f'(x)$. If the noise is dominated by shot noise we will have $\sigma=\sqrt{f(x)}$. The variance therefore is $f(x)/(f'(x))^2$. Combining a series of independent measurement at positions $x_1, \dots, x_n$ with corresponding weights $w_1, \dots, w_n$ with $\sum_{i=1}^n w_i=1$ the variance of the estimated position becomes $$ \sum_i w^2_i \frac{f(x_i)}{(f'(x_i))^2}\geq \frac{\left(\sum_i w_i \right)^2}{\left(\sum_i \frac{(f'(x_i))^2}{f(x_i)},\right)}=\left(\sum_i \frac{(f'(x_i))^2}{f(x_i)}\right)^{-1} $$ where we used Cauchy-Schwarz. Hence in order to minimize the variance/std we need to maximize $\sum_i \frac{(f'(x_i))^2}{f(x_i)}$. In the limit this becomes the integral.

As an extension it would also be interesting to solve a similar problem in two-dimensions where we need to track position (2dof's) and rotation (1 dof). I will think about a problem formulation in this case.