In order to detect vessel locations in spherical images of retina we consider the problem of minimizing the functional ∫0lℭ(γ(s))ξ2+kg2(s)ds for a curve γ 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 γ. Here the smooth external cost C ≥ δ > 0 is obtained from spherical data. We lift this problem to the sub-Riemannian (SR) problem in Lie group SO(3) and propose numerical solution to this problem with consequent comparison to exact solution in the case C = 1. An experiment of vessel tracking in a spherical image of the retina shows a benefit of using SO(3) geodesics.