  In order to detect salient lines in spherical images, we consider the problem
of minimizing the functional $\int \limits_0^l C(\gamma(s)) \sqrt{\xi^2 +
k_g^2(s)} \, {\rm d}s$ for a curve $\gamma$ on a sphere with fixed boundary
points and directions. The total length $l$ is free, $s$ denotes the spherical
arclength, and $k_g$ denotes the geodesic curvature of $\gamma$. Here the
smooth external cost $C\geq \delta>0$ is obtained from spherical data. We lift
this problem to the sub-Riemannian (SR) problem in Lie group $SO(3)$ and show
that the spherical projection of certain SR geodesics provides a solution to
our curve optimization problem. In fact, this holds only for the geodesics
whose spherical projection does not exhibit a cusp. The problem is a spherical
extension of a well-known contour perception model, where we extend the model
by Boscain and Rossi to the general case $\xi > 0$, $C \neq 1$. For $C=1$, we
derive SR geodesics and evaluate the first cusp time. We show that these curves
have a simpler expression when they are parameterized by spherical arclength
rather than by sub-Riemannian arclength. For case $C \neq 1$ (data-driven SR
geodesics), we solve via a SR Fast Marching method. Finally, we show an
experiment of vessel tracking in a spherical image of the retina and study the
effect of including the spherical geometry in analysis of vessels curvature.
