The automatic shape control of deformable objects is an open (and currently hot) manipulation problem that is challenging due to the object's high-dimensional shape information and its complex physical properties. As a feasible solution to these issues, in this paper, we propose a new methodology to automatically deform elastic rods into 2D desired shapes. For that, we present an efficient vision-based controller that uses a deep autoencoder network to compute a compact representation of the object's infinite dimensional shape. To deal with the (typically unknown) mechanical properties of the object, we use an online algorithm that approximates the sensorimotor mapping between the robot's configuration and the object's shape features. Our new approach has the capability to compute the rod's centerline from raw visual data in real-time; This is done by introducing an adaptive algorithm based on a self-organizing network. The effectiveness of the proposed method is thoroughly validated with simulations and experiments.