1. A method for detecting an object within an image, comprising: a computer performing: determining a relationship between sampling parameters and a probability of an object detector detecting within the image an instance of the object; determining a relationship between the sampling parameters and a detection speed of the object detector, wherein the detection speed of the object detector contributes to an amount of time for an object detection process to complete; using the determined relationships to generate specific sampling parameters; and performing the object detection process, wherein the object detection process uses the sampling parameters to sample locations in the image, wherein a sampling process is used to refine the search for an instance of the object within the image by identifying locations that respond to the object detector and are hence likely to be proximate to an instance of the object within the image.