Summary: Techniques for automatically generating optimal vision programs from high-level task descriptions are presented. Vision programs are the object models that describe strategies to recognize and locate objects in an image. The effectiveness of the program depends on the features used for recognition and the order in which the features are evaluated. We describe three probabilistic feature utility measures and a cost function based on program execution time that serve as the basis of our technique. Techniques for computing the utility measures and combining them to generate the best vision program are described and are demonstrated on a realistic vision application.