An optical sensor with a plurality of pixels, wherein each pixel comprises: a photoreceptor (PD) adapted to convert, during an exposure phase, received light into a photoreceptor voltage; an analog comparator (C) adapted to compare, during a detection phase, the photoreceptor voltage to an ON event ramp for determining ON events, an OFF event ramp for determining OFF events, and a registration ramp for determining a current illumination of the photoreceptor, the ON event ramp being offset from the registration ramp by an ON threshold offset and the OFF event ramp being oppositely offset from the registration ramp by an OFF threshold offset, each of said ramps being a voltage ramp that ascends or descends in voltage over time, where counting ascending/descending steps of the voltage ramps digitally represents the values of the voltage ramps by count values, and adapted to generate, during the detection phase, as registration count value the count value of the registration ramp when the registration ramp reaches the photoreceptor voltage, as ON count value the count value of the ON event ramp when the ON event ramp reaches the photoreceptor voltage, and as OFF count value the count value of the OFF event ramp when the OFF event ramp reaches the photoreceptor voltage; a memory (LO) adapted to store the registration count value during the detection phase; a digital comparator (AG1) adapted to compare the registration count value of a previous detection phase and either the ON count value or the OFF count value of the current detection phase; and control logic adapted to determine that an ON event has occurred when the ON count value of the current detection phase reaches the registration count value of the previous detection phase and for determining that an OFF event has occurred when the OFF count value of the current detection phase reaches the registration count value of the previous detection phase. a photoreceptor (PD) adapted to convert, during an exposure phase, received light into a photoreceptor voltage; an analog comparator (C) adapted to compare, during a detection phase, the photoreceptor voltage to an ON event ramp for determining ON events, an OFF event ramp for determining OFF events, and a registration ramp for determining a current illumination of the photoreceptor, the ON event ramp being offset from the registration ramp by an ON threshold offset and the OFF event ramp being oppositely offset from the registration ramp by an OFF threshold offset, each of said ramps being a voltage ramp that ascends or descends in voltage over time, where counting ascending/descending steps of the voltage ramps digitally represents the values of the voltage ramps by count values, and adapted to generate, during the detection phase, as registration count value the count value of the registration ramp when the registration ramp reaches the photoreceptor voltage, as ON count value the count value of the ON event ramp when the ON event ramp reaches the photoreceptor voltage, and as OFF count value the count value of the OFF event ramp when the OFF event ramp reaches the photoreceptor voltage; a memory (LO) adapted to store the registration count value during the detection phase; a digital comparator (AG1) adapted to compare the registration count value of a previous detection phase and either the ON count value or the OFF count value of the current detection phase; and control logic adapted to determine that an ON event has occurred when the ON count value of the current detection phase reaches the registration count value of the previous detection phase and for determining that an OFF event has occurred when the OFF count value of the current detection phase reaches the registration count value of the previous detection phase. <EOS>