A device for controlling a headlight of a vehicle, the device is configured to: receive images consecutively captured by a camera, the images showing an area in front of a vehicle, detect a road in one of the images, divide the road detected in the image in segments, track the segments over time in the images, determine at least one feature related to the brightness for each of the segments, determine from the features related to the brightness of the segments whether preceding and/or oncoming traffic exists, and generate a control signal for controlling a headlight of the vehicle if preceding and/or oncoming traffic exists; characterized in that the at least one feature related to the brightness for one of the segments is a relative brightness of the respective segment with respect to a brightness of the environment of the road, wherein the relative brightness of the respective segment with respect to the brightness of the environment of the road is calculated as the ratio of the mean brightness of the respective segment to the mean brightness of the environment of the road; wherein the device is further configured to determine that preceding and/or oncoming traffic exists if the at least one feature related to the brightness of at least one of the segments surpasses a first threshold and/or a rise of the at least one feature related to the brightness of at least one of the segments surpasses a second threshold; wherein the first threshold and/or the second threshold depend on the real world distance of the vehicle to the at least one segment and/or the brightness of the environment of the road and/or whether a high beam of the vehicle is switched on; and wherein the device is further configured to use a machine trained algorithm to determine from the features related to the brightness of the segments whether preceding and/or oncoming traffic exists. receive images consecutively captured by a camera, the images showing an area in front of a vehicle, detect a road in one of the images, divide the road detected in the image in segments, track the segments over time in the images, determine at least one feature related to the brightness for each of the segments, determine from the features related to the brightness of the segments whether preceding and/or oncoming traffic exists, and generate a control signal for controlling a headlight of the vehicle if preceding and/or oncoming traffic exists; characterized in that the at least one feature related to the brightness for one of the segments is a relative brightness of the respective segment with respect to a brightness of the environment of the road, wherein the relative brightness of the respective segment with respect to the brightness of the environment of the road is calculated as the ratio of the mean brightness of the respective segment to the mean brightness of the environment of the road; wherein the device is further configured to determine that preceding and/or oncoming traffic exists if the at least one feature related to the brightness of at least one of the segments surpasses a first threshold and/or a rise of the at least one feature related to the brightness of at least one of the segments surpasses a second threshold; wherein the first threshold and/or the second threshold depend on the real world distance of the vehicle to the at least one segment and/or the brightness of the environment of the road and/or whether a high beam of the vehicle is switched on; and wherein the device is further configured to use a machine trained algorithm to determine from the features related to the brightness of the segments whether preceding and/or oncoming traffic exists.