An in-vehicle electronic device for adjusting a region of interest (ROI) in a dynamic image for an advanced driver-assistance system, the in-vehicle electronic device being installed on a vehicle and comprising a processor, a data storage, and a camera that is configured to continuously capture the dynamic image in front of the vehicle, the dynamic image including a plurality of image frames, wherein the processor is configured to:
- perform an object detecting operation for each of the image frames included in the dynamic image, so as to obtain a number of lane lines included in the image frame;
- for each of a set of a first predetermined number of successive image frames of the dynamic image, detect a pair of lane line segments which is segments of the lane lines within an initial ROI, and determine an intersection point in the image frame at which two imaginary extensions that extend respectively from the lane line segments cross each other, so as to obtain the first predetermined number of pairs of lane line segments and the first predetermined number of intersection points;
- using the first predetermined number of pairs of lane line segments and the first predetermined number of intersection points, determine a first vanishing point and a temporary ROI corresponding to the first vanishing point;
- perform an image processing operation on a set of a second predetermined number of successive image frames of the dynamic image that are captured by the camera after the first predetermined number of successive image frames, so as to calculate, for each of the second predetermined number of image frames, a pair of slopes associated with the pair of lane line segments within the temporary ROI, so as to obtain the second predetermined number of pairs of slopes;
- based on the second predetermined number of pairs of slopes, obtain a second vanishing point;
- and
- in a case where the second vanishing point and the first vanishing point correspond with one another, store the temporary ROI as an updated ROI in the data storage for subsequent use.