An auto focus method for setting a focus of a camera comprising a rolling shutter image sensor and a focus lens arrangement, the auto focus method comprising the steps of: capturing one or more image frames (100; 100a-f) by the rolling shutter image sensor, wherein the rolling shutter image sensor comprises a plurality of pixel regions (106a-d), wherein the rolling shutter image sensor during capture of an image frame reads out pixel data from one pixel region at a time, continuously measuring a camera motion level of the camera during the read-out of pixel data, for producing motion data associated with the pixel data and indicating a plurality of camera motion levels measured during read-out of pixel data from the plurality of pixel regions, wherein each pixel region of the plurality of pixel regions is associated with zero or one camera motion level, setting the focus of the camera using an auto focus algorithm, the auto focus algorithm dividing each of the one or more image frames into a plurality of focus windows (108a-c), wherein each focus window comprises pixel data of one or more of the plurality of pixel regions, wherein the auto focus algorithm comprises, for each focus window of the plurality of focus windows, calculating a focus measure for the focus window based on the pixel data comprised in the focus window, calculating a level of motion for the focus window based on the motion data associated with the pixel data comprised in the focus window, calculating a weighted focus measure for the focus window by weighting the focus measure for the focus window by at least the level of motion for the focus window such that the focus measure of a focus window with a high level of motion will be weighted with a lower weight than the focus measure of a focus window with a low level of motion. capturing one or more image frames (100; 100a-f) by the rolling shutter image sensor, wherein the rolling shutter image sensor comprises a plurality of pixel regions (106a-d), wherein the rolling shutter image sensor during capture of an image frame reads out pixel data from one pixel region at a time, continuously measuring a camera motion level of the camera during the read-out of pixel data, for producing motion data associated with the pixel data and indicating a plurality of camera motion levels measured during read-out of pixel data from the plurality of pixel regions, wherein each pixel region of the plurality of pixel regions is associated with zero or one camera motion level, setting the focus of the camera using an auto focus algorithm, the auto focus algorithm dividing each of the one or more image frames into a plurality of focus windows (108a-c), wherein each focus window comprises pixel data of one or more of the plurality of pixel regions, wherein the auto focus algorithm comprises, for each focus window of the plurality of focus windows, calculating a focus measure for the focus window based on the pixel data comprised in the focus window, calculating a level of motion for the focus window based on the motion data associated with the pixel data comprised in the focus window, calculating a weighted focus measure for the focus window by weighting the focus measure for the focus window by at least the level of motion for the focus window such that the focus measure of a focus window with a high level of motion will be weighted with a lower weight than the focus measure of a focus window with a low level of motion. calculating a focus measure for the focus window based on the pixel data comprised in the focus window, calculating a level of motion for the focus window based on the motion data associated with the pixel data comprised in the focus window, calculating a weighted focus measure for the focus window by weighting the focus measure for the focus window by at least the level of motion for the focus window such that the focus measure of a focus window with a high level of motion will be weighted with a lower weight than the focus measure of a focus window with a low level of motion.