A method for autofocus in an imaging device, the method comprising: receiving depth information of an object within a scene; determining, for an autofocus lens system, a first lens position and a second lens position defining outer boundaries of a first range including a first plurality of lens positions based on the depth information; for each lens position of the first plurality of lens positions: setting a lens of the autofocus lens system to the lens position; and generating a focus value associated with the lens position; generating, based on the focus values associated with each of the first plurality of lens positions, data representing a focus value curve; identifying a slope of the focus value curve at each of the first plurality of lens positions; determining, based at least partly on the slope of the focus value curve at each of the first plurality of lens positions, whether a maximum focus value is within the first range; in response to determining that the maximum focus value is not within the first range: determining whether the slope of the focus value curve is decreasing at the first lens position or determining whether the slope of the focus value curve is increasing at the second lens position; wherein the first lens position is the closest lens position of the first range, and the second lens position is the farthest lens position of the first range; determining a second range including a second plurality of lens positions, the second range bounded by the one of the first lens position and the second lens position and a third lens position outside of the first range; setting the lens to the second plurality of lens positions in the second range; determining whether the maximum focus value is within the second range of lens positions; and in response to determining that the maximum focus value is within the second range, capturing an image by the imaging device with the lens at a position in the second range corresponding to the maximum focus value. receiving depth information of an object within a scene; determining, for an autofocus lens system, a first lens position and a second lens position defining outer boundaries of a first range including a first plurality of lens positions based on the depth information; for each lens position of the first plurality of lens positions: setting a lens of the autofocus lens system to the lens position; and generating a focus value associated with the lens position; setting a lens of the autofocus lens system to the lens position; and generating a focus value associated with the lens position; generating, based on the focus values associated with each of the first plurality of lens positions, data representing a focus value curve; identifying a slope of the focus value curve at each of the first plurality of lens positions; determining, based at least partly on the slope of the focus value curve at each of the first plurality of lens positions, whether a maximum focus value is within the first range; in response to determining that the maximum focus value is not within the first range: determining whether the slope of the focus value curve is decreasing at the first lens position or determining whether the slope of the focus value curve is increasing at the second lens position; wherein the first lens position is the closest lens position of the first range, and the second lens position is the farthest lens position of the first range; determining a second range including a second plurality of lens positions, the second range bounded by the one of the first lens position and the second lens position and a third lens position outside of the first range; setting the lens to the second plurality of lens positions in the second range; determining whether the maximum focus value is within the second range of lens positions; and in response to determining that the maximum focus value is within the second range, capturing an image by the imaging device with the lens at a position in the second range corresponding to the maximum focus value. determining whether the slope of the focus value curve is decreasing at the first lens position or determining whether the slope of the focus value curve is increasing at the second lens position; wherein the first lens position is the closest lens position of the first range, and the second lens position is the farthest lens position of the first range; determining a second range including a second plurality of lens positions, the second range bounded by the one of the first lens position and the second lens position and a third lens position outside of the first range; setting the lens to the second plurality of lens positions in the second range; determining whether the maximum focus value is within the second range of lens positions; and in response to determining that the maximum focus value is within the second range, capturing an image by the imaging device with the lens at a position in the second range corresponding to the maximum focus value.