Search

US-20260125074-A1 - METHOD, APPARATUS, ELECTRONIC DEVICE, COMPUTER PROGRAM AND COMPUTER READABLE RECORDING MEDIUM FOR MEASURING INTER-VEHICLE DISTANCE USING DRIVING IMAGE

US20260125074A1US 20260125074 A1US20260125074 A1US 20260125074A1US-20260125074-A1

Abstract

A method for measuring an inter-vehicle distance using a processor is provided. The method includes acquiring a driving image photographed by a photographing device of a first vehicle; detecting a second vehicle from the driving image and calculating a ratio between an image width of the detected second vehicle and an image width of a lane in which the second vehicle is located; determining a size class of the second vehicle among a plurality of size classes based on the calculated ratio; determining a width of the second vehicle based on the determined size class of the second vehicle; and calculating a distance from the photographing device to the second vehicle based on the determined width of the second vehicle, a focal length of the photographing device, and the image width of the second vehicle.

Inventors

  • Shin Hyoung Kim

Assignees

  • THINKWARE CORPORATION

Dates

Publication Date
20260507
Application Date
20260102
Priority Date
20181206

Claims (20)

  1. 1 . A non-transitory computer readable storage medium storing one or more programs, the one or more programs comprising instructions which, when executed by a processor of an electronic device in a vehicle being moved, cause the electronic device to: obtain a plurality of images via a camera in the vehicle; identify, from at least a part of the plurality of images, a first visual object corresponding to another vehicle being moved, a second visual object corresponding to a left line of a lane in which the another vehicle is being moved, and a third visual object corresponding to a right line of the lane; determine a first width of the lane based on intersections between the second visual object, the third visual object and a virtual line connecting positions within the first visual object respectively corresponding to preset parts of the another vehicle; determine, based on a ratio between a second width of the first visual object and the first width, a size class of the another vehicle; identify a distance between the vehicle and the another vehicle, based on a focal length of a lens of the camera, a third width corresponding to the determined size class and the second width; and execute, according to whether the distance between the vehicle and the another vehicle is shorter than a reference distance, at least one function for assisting a movement of the vehicle.
  2. 2 . The non-transitory computer readable storage medium of claim 1 , wherein the one or more programs comprise instructions which, when executed by the processor of the electronic device, cause the electronic device to identify the second width of the first visual object by identifying a distance between a left edge of the first visual object and a right edge of the first visual object.
  3. 3 . The non-transitory computer readable storage medium of claim 1 , wherein the one or more programs comprise instructions which, when executed by the processor of the electronic device, cause the electronic device to: identify, from at least a part of the plurality images, a first position among the positions corresponding to a part of the first visual object corresponding to a left rear wheel of the another vehicle and a second position among the positions corresponding to another part of the first visual object corresponding to a right rear wheel of the another vehicle; and identify the first width between the intersections, wherein the intersections comprises a first intersection between the second visual object and the virtual line and a second intersection between the third visual object and the virtual line.
  4. 4 . The non-transitory computer readable storage medium of claim 1 , wherein the one or more programs comprise instructions which, when executed by the processor of the electronic device, cause the electronic device to: identify, from among a plurality of reference size classes, a reference size class corresponding to the ratio; and determine the size class of the another vehicle as the identified reference size class.
  5. 5 . The non-transitory computer readable storage medium of claim 1 , wherein the one or more programs comprise instructions which, when executed by the processor of the electronic device, cause the electronic device to: identify the first visual object based on whether both the another vehicle and the vehicle are moved within the lane.
  6. 6 . The non-transitory computer readable storage medium of claim 1 , wherein the at least one function comprises reducing a movement speed of the vehicle for increasing the distance between the vehicle and the another vehicle.
  7. 7 . The non-transitory computer readable storage medium of claim 1 , wherein the at least one function comprises displaying an indication for guiding that increasing the distance between the vehicle and the another vehicle is required, on a display of the vehicle.
  8. 8 . A method executed in an electronic device in a vehicle being moved, the method comprising: obtaining a plurality of images via a camera in the vehicle; identifying, from at least a part of the plurality of images, a first visual object corresponding to another vehicle being moved, a second visual object corresponding to a left line of a lane in which the another vehicle is being moved, and a third visual object corresponding to a right line of the lane; determining a first width of the lane based on intersections between the second visual object, the third visual object and a virtual line connecting positions within the first visual object respectively corresponding to preset parts of the another vehicle; determining, based on a ratio between a second width of the first visual object and the first width, a size class of the another vehicle; identifying a distance between the vehicle and the another vehicle, based on a focal length of a lens of the camera, a third width corresponding to the determined size class, and the second width; and executing, according to whether the distance between the vehicle and the another vehicle is shorter than a reference distance, at least one function for assisting a movement of the vehicle.
  9. 9 . The method of claim 8 , further comprising: identifying the second width of the first visual object by identifying a distance between a left edge of the first visual object and a right edge of the first visual object.
  10. 10 . The method of claim 8 , further comprising: identifying, from at least a part of the plurality images, a first position among the positions corresponding to a part of the first visual object corresponding to a left rear wheel of the another vehicle and a second position among the positions corresponding to another part of the first visual object corresponding to a right rear wheel of the another vehicle; and identifying the first width between the intersections, wherein the intersections comprises a first intersection between the second visual object and the virtual line and a second intersection between the third visual object and the virtual line.
  11. 11 . The method of claim 8 , wherein determining the size class of the another vehicle comprises: identifying, from among a plurality of reference size classes, a reference size class corresponding to the ratio; and determining the size class of the another vehicle as the identified reference size class.
  12. 12 . The method of claim 8 , further comprising: identifying the first visual object based on whether both the another vehicle and the vehicle are moved within the lane.
  13. 13 . The method of claim 8 , wherein the at least one function comprises reducing a movement speed of the vehicle for increasing the distance between the vehicle and the another vehicle.
  14. 14 . The method of claim 8 , wherein the at least one function comprises displaying an indication for guiding that increasing the distance between the vehicle and the another vehicle is required, on a display of the vehicle.
  15. 15 . An electronic device in a vehicle being moved, the electronic device comprising: a memory configured to store instructions; and a processor configured to execute the instructions to: obtain a plurality of images via a camera in the vehicle; identify, from at least a part of the plurality of images, a first visual object corresponding to another vehicle being moved, a second visual object corresponding to a left line of a lane in which the another vehicle is being moved, and a third visual object corresponding to a right line of the lane; determine a first width of the lane based on intersections between the second visual object, the third visual object and a virtual line connecting positions within the first visual object respectively corresponding to preset parts of the another vehicle; determine, based on a ratio between a second width of the first visual object and the first width, a size class of the another vehicle; identify a distance between the vehicle and the another vehicle, based on a focal length of a lens of the camera, a third width corresponding to the determined size class and the second width; and execute, according to whether the distance between the vehicle and the another vehicle is shorter than a reference distance, at least one function for assisting a movement of the vehicle.
  16. 16 . The electronic device of claim 15 , wherein the processor is configured to execute the instructions to identify the second width of the first visual object by identifying a distance between a left edge of the first visual object and a right edge of the first visual object.
  17. 17 . The electronic device of claim 15 , wherein the processor is configured to execute the instructions to: identify, from at least a part of the plurality images, a first position among the positions corresponding to a part of the first visual object corresponding to a left rear wheel of the another vehicle and a second position among the positions corresponding to another part of the first visual object corresponding to a right rear wheel of the another vehicle; and identify the first width between the intersections, wherein the intersections comprises a first intersection between the second visual object and the virtual line and a second intersection between the third visual object and the virtual line.
  18. 18 . The electronic device of claim 15 , wherein the processor is configured to execute the instructions to: identify, from among a plurality of reference size classes, a reference size class corresponding to the ratio; and determine the size class of the another vehicle as the identified reference size class.
  19. 19 . The electronic device of claim 15 , wherein the processor is configured to execute the instructions to: identify the first visual object based on whether both the another vehicle and the vehicle are moved within the lane.
  20. 20 . The electronic device of claim 15 , wherein the at least one function comprises at least one of reducing a movement speed of the vehicle for increasing the distance between the vehicle and the another vehicle or displaying an indication for guiding that increasing the distance between the vehicle and the another vehicle is required, on a display of the vehicle.

Description

CROSS-REFERENCE TO RELATED APPLICATION(S) This application is a continuation of U.S. application Ser. No. 18/388,612, filed on Nov. 10, 2023, which is a continuation of U.S. application Ser. No. 17/388,222, filed on Jul. 29, 2021, which is a continuation of U.S. application Ser. No. 16/703,489, filed on Dec. 4, 2019, which is based upon and claims benefit of priority to Korean Patent Application No. 10-2018-0156143 filed on Dec. 6, 2018 in the Korean Intellectual Property Office, the disclosure of which is incorporated herein by reference in its entirety. BACKGROUND 1. Field The present invention relates to a method, an apparatus, an electronic device, a computer program, and a computer readable recording medium for measuring an inter-vehicle distance using a driving image photographed while driving of a vehicle. 2. Description of Related Art It is most important to safely drive a vehicle and prevent a traffic accident at the time of driving the vehicle. To this end, various assistance apparatuses performing an attitude control of the vehicle, a function control of components of the vehicle, and the like, and safety apparatuses such as a seat belt, an air bag, and the like, have been mounted in the vehicle. In addition, apparatuses such as a car dash cam and the like positioned in the vehicle and storing a driving image of the vehicle and data transmitted from various sensors to thereby find out a cause of an accident of the vehicle at the time of occurrence of the accident have recently been provided in the vehicle. Portable terminals such as a smartphone and a tablet in which a car dash cam application, a navigation application, or the like may be mounted are used as the apparatuses for a vehicle as described above. In recent years, advanced driver assistance systems (ADAS) have been developed and distributed to assist the driving of the driver of the vehicle by using the driving image photographed while driving of the vehicle, thereby increasing convenience as well as safe driving of the driver. Among functions provided by such an ADAS, a forward collision warning system (FCWS) is a function of measuring a distance from a front vehicle located in front of a vehicle's driving route and informing the driver that there is a risk of collision depending on the distance. However, according to a conventional method for measuring an inter-vehicle distance, since the inter-vehicle distance is measured by treating a vehicle width as a predetermined specific constant value without considering an actual vehicle width of a large number of vehicles having different widths (e.g., compact cars, midsize cars, and full-sized cars), there was a problem that the measured inter-vehicle distance value is not accurate. In addition, in the ADAS, a small error of the measured value on which the risk judgment is based may be a big problem in a system operation, thereby deteriorating convenience and stability of the driver. As an example, although the distance between the vehicles is not large enough to perform a forward collision warning, the warning is performed, thereby causing the ADAS function to interfere with a safe driving of the driver. SUMMARY An object of the present invention is to calculate a ratio between an image width of a front vehicle and an image width of a lane in which the front vehicle is located, and determine a size class of the front vehicle among a plurality of size classes (e.g., a compact car, a midsize car, and a full-sized car) based on the calculated ratio. Another object of the present invention is to determine a width of a front vehicle based on a size class of the front vehicle, and measure an inter-vehicle distance between a reference vehicle and the front vehicle using the determined width of the front vehicle. Still another object of the present invention is to provide an accurate forward collision warning system using the measured inter-vehicle distance. According to an exemplary embodiment of the present invention, a method for measuring an inter-vehicle distance using a processor includes acquiring a driving image photographed by a photographing device of a first vehicle which is being driven; detecting a second vehicle from the driving image and calculating a ratio between an image width of the detected second vehicle and an image width of a lane in which the second vehicle is located; determining a size class of the second vehicle based on the calculated ratio; determining a width of the second vehicle based on the determined size class of the second vehicle; and calculating a distance from the photographing device to the second vehicle based on the determined width of the second vehicle, a focal length of the photographing device, and the image width of the second vehicle. The calculating of the ratio may include detecting the second vehicle, which is a distance measurement target, among a plurality of vehicles included in the driving image; identifying a left line and a right line of a l