In this paper, we address the problem of estimating the shape of a planar elastic rod (e.g., a thin flexible strip of metal) using images of the rod. This is done by treating configurations of the elastic rod as solutions of a geometric optimal control problem. The necessary conditions for optimality provide coordinates over which to perform inference, and the sufficient conditions provide the gradient of the shape of the rod with respect to these coordinates. This optimal control formulation allows for configurations of the rod to be represented as points in a finite-dimensional space without having to discretize the shape of the rod. We consider the estimation problem with and without fiducial markers attached to the rod. Results from both simulations and hardware experiments demonstrate the ability of our approach to track the shape of a deforming elastic rod.