A method for determining a distance to an object, the method comprising: - illuminating a scenery with a periodically pulsed pattern of spots, said periodically pulsed pattern comprising in alternation an illuminated phase and a non-illuminated phase; - using a detector comprising an imaging array with a plurality of pixels to detect light representing said pattern of spots as reflected by said object in synchronization with said sequence of pulses; - calculating said distance to said object as a function of exposure values generated by said pixels in response to said detected light; wherein said pixels generate said exposure values by accumulating, for each pulse of said sequence, a first amount of electrical charge representative of a first amount of light reflected by said object during a first predetermined time window and a second electrical charge representative of a second amount of light reflected by said object during a second predetermined time window, said second predetermined time window occurring after said first predetermined time window; wherein background light is subtracted from an exposure value of a first pixel in said image array by: - accumulating in said first pixel a charge in proportion to a first quantity of incident light, received in said first pixel while detecting said spot during a predetermined amount of time; and - decreasing said charge in proportion to a second quantity of incident light received during said predetermined amount of time in absence of said spot; wherein said second quantity of incident light comprises light received in said first pixel during said predetermined amount of time in said non-illuminated phase; and wherein said second quantity of light comprises light received in the same individual light-sensitive area of said first pixel such that said second quantity of light is detected with the same components that detect said first quantity of light. - illuminating a scenery with a periodically pulsed pattern of spots, said periodically pulsed pattern comprising in alternation an illuminated phase and a non-illuminated phase; - using a detector comprising an imaging array with a plurality of pixels to detect light representing said pattern of spots as reflected by said object in synchronization with said sequence of pulses; - calculating said distance to said object as a function of exposure values generated by said pixels in response to said detected light; wherein said pixels generate said exposure values by accumulating, for each pulse of said sequence, a first amount of electrical charge representative of a first amount of light reflected by said object during a first predetermined time window and a second electrical charge representative of a second amount of light reflected by said object during a second predetermined time window, said second predetermined time window occurring after said first predetermined time window; wherein background light is subtracted from an exposure value of a first pixel in said image array by: - accumulating in said first pixel a charge in proportion to a first quantity of incident light, received in said first pixel while detecting said spot during a predetermined amount of time; and - decreasing said charge in proportion to a second quantity of incident light received during said predetermined amount of time in absence of said spot; - accumulating in said first pixel a charge in proportion to a first quantity of incident light, received in said first pixel while detecting said spot during a predetermined amount of time; and - decreasing said charge in proportion to a second quantity of incident light received during said predetermined amount of time in absence of said spot; wherein said second quantity of incident light comprises light received in said first pixel during said predetermined amount of time in said non-illuminated phase; and wherein said second quantity of light comprises light received in the same individual light-sensitive area of said first pixel such that said second quantity of light is detected with the same components that detect said first quantity of light.