CN115147803A - Object detection method and device - Google Patents

Object detection method and device Download PDF

Info

Publication number
CN115147803A
CN115147803A CN202110333573.6A CN202110333573A CN115147803A CN 115147803 A CN115147803 A CN 115147803A CN 202110333573 A CN202110333573 A CN 202110333573A CN 115147803 A CN115147803 A CN 115147803A
Authority
CN
China
Prior art keywords
line segment
target
line segments
contour
line
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110333573.6A
Other languages
Chinese (zh)
Inventor
郑迪威
云一宵
苏惠荞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202110333573.6A priority Critical patent/CN115147803A/en
Publication of CN115147803A publication Critical patent/CN115147803A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20092Interactive image processing based on input by user
    • G06T2207/20104Interactive definition of region of interest [ROI]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The application provides an object detection method and device, and the method comprises the following steps: performing inverse perspective transformation processing on the first target image to obtain a second target image, wherein the second target image is an image obtained after the first target image is mapped to a target plane; contour line extraction processing is carried out on the second target image to obtain a plurality of contour line segments; selecting a plurality of line segments of which the straight lines pass through a set target point from the plurality of contour line segments; dividing the plurality of line segments into at least one line segment set according to the positions of the plurality of line segments in the second target image; for each set of line segments, performing the steps of: projecting at least two line segments contained in the target line segment set to a first target image to obtain at least two projected line segments; the position of a target object in the first target image is determined from at least two projection line segments, wherein the set of target line segments is each set of line segments. The scheme provided by the application can improve the accuracy and the universality of detecting the object in the image.

Description

Object detection method and device
Technical Field
The present application relates to the field of data processing technologies, and in particular, to an object detection method and apparatus.
Background
In the field of intelligent driving such as assistant driving and automatic driving, in the driving process of a vehicle, an automatic driving system or an advanced driver-assistance system (ADAS) is generally required to detect and judge the current driving road condition, so as to detect a general obstacle, thereby effectively avoiding the obstacle and ensuring the driving safety of the vehicle.
The detection of the obstacle can be realized by adopting a traditional image processing method or a network processing method at present. The traditional image processing method can be used for screening the obstacles in a targeted manner based on image processing algorithms, manual construction, feature extraction and other modes, but the method usually needs to limit driving scenes and detected obstacle types so as to keep the rationality of features, so that the method is poor in universality. The network processing method takes data driving as a main means, performs feature construction and extraction through machine learning, has certain generalization, but has certain missing detection on obstacles with great feature difference with training data. Therefore, the conventional method for detecting the obstacle has the problems of missing detection, false detection and the like, and is poor in universality.
Disclosure of Invention
The application provides an object detection method and device, which are used for improving the accuracy and universality of detection on an object in an image.
In a first aspect, the present application provides an object detection method, comprising:
performing inverse perspective transformation processing on a first target image to obtain a second target image, wherein the first target image is an image shot for a scene containing at least one target object, and the second target image is an image obtained after the first target image is mapped to a target plane; contour line extraction processing is carried out on the second target image, and a plurality of contour line segments are obtained in the second target image; selecting a plurality of line segments of which the straight lines pass through a set target point from the plurality of contour line segments; dividing the line segments into at least one line segment set according to the positions of the line segments in the second target image, wherein the line segments contained in different line segment sets are different, and any line segment set contains at least two line segments in the line segments; for each set of line segments, performing the steps of: projecting at least two line segments contained in a target line segment set to the first target image to obtain at least two projected line segments; and determining the position of a target object in the first target image according to the at least two projection line segments, wherein the target line segment sets are each line segment set.
In the method, the object detection is carried out according to the second target image obtained after the first target image is projected to the target plane, the affine geometric characteristics presented by the contour of the object in the image, particularly the height contour of the object after the first target image is subjected to inverse perspective transformation can be fully utilized, the position of the object in the image can be accurately detected, the accuracy of the object detection can be improved, the method can realize the detection of various different objects, and the method has wide application scenes and good universality. In addition, the method can realize accurate detection of the object in the image only according to the acquired frame of image, so the cost for detection is low.
In one possible design, dividing the plurality of line segments into at least one set of line segments according to the positions of the plurality of line segments in the second target image includes: sorting the line segments according to the positions of the starting endpoints of the line segments in the second target image, wherein the starting endpoint of any line segment is the endpoint which is closest to the target point in the two endpoints of the line segment; according to the sequence of the line segments, selecting a line segment which is not divided into a line segment set as a reference line segment in sequence, and executing the following dividing process on the reference line segment: taking other line segments of the plurality of line segments except the reference line segment and the line segment which is divided into a line segment set as line segments to be branched; determining a target line segment, of the line segments to be divided, wherein an included angle between the target line segment and the reference line segment is smaller than a set threshold, and the target line segment comprises at least one line segment; calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour; when the error parameter is smaller than or equal to a set threshold value, dividing the target line segment and the reference line segment into the same line segment set; and when the error parameter is larger than the set threshold, the target line segment and the reference line segment are not divided into the same line segment set, and the dividing process is finished.
In the method, when a line segment set is divided, according to the sequence of a plurality of line segments, a line segment and a line segment which belongs to the same object contour line with a high probability are respectively selected to form the line segment set, finally, the division of the line segment set is realized, the line segments which belong to different object contour lines are divided into different sets, on one hand, the line segments are processed according to the line segment arrangement, the division of the line segment set can be simply, conveniently and quickly carried out, the division flow of the line segment is simplified, the division efficiency of the line segment set is improved, on the other hand, the distribution of the line segments in the contour line of the same object is approximate, and the accuracy of the division of the line segment set can be realized by carrying out the division of the line segment set according to the line segment positions.
In one possible design, the sorting the plurality of line segments according to the positions of the starting endpoints of the plurality of line segments in the second target image includes: and sequencing the line segments according to the position distribution sequence of the starting endpoints of the line segments in the second target image in the clockwise or anticlockwise direction.
In the method, the plurality of line segments are all the line segments of which the straight lines pass through the same target point, so that after the plurality of line segments are sequenced according to the position distribution sequence of the starting endpoints of the plurality of line segments, when the target line segment corresponding to the reference line segment is selected in the division process of the line segment set, the line segment which is adjacent to the reference line segment and has a higher probability to belong to the same object can be selected as accurately as possible.
In one possible design, calculating an error parameter that classifies the target line segment and the reference line segment to the same object contour includes: and calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour according to a set data model, wherein the set data model is used for calculating errors existing when a plurality of line segments are classified into the same object contour.
In the method, the probability value that the target line segment and the reference line segment belong to the same object contour can be quickly and accurately calculated by using the set data model.
In one possible design, calculating an error parameter that classifies the target line segment and the reference line segment to the same object contour includes: executing multiple calculation processes on the target line segment and the reference line segment to obtain multiple alternative error parameters; wherein, each calculation process comprises the following steps: randomly selecting at least one line segment from the target line segments; taking the reference line segment and at least one line segment randomly selected from the target line segments as sample line segments; calculating target parameters corresponding to the sample line segments, and determining alternative error parameters according to the target parameters; wherein the target parameter is: comprises at least one parameter for characterizing the geometric distribution of the sample line segments; determining a minimum value of the plurality of candidate error parameters; and taking the minimum value as an error parameter for classifying the target line segment and the reference line segment into the same object contour.
According to the method, the probability values of the target line segment and the reference line segment belonging to the same object contour are repeatedly calculated for multiple times, the minimum value of the obtained multiple probability values is selected as the final judgment basis, the judgment accuracy and the judgment reliability can be guaranteed, and errors or misjudgments caused by uncertainty of single calculation are reduced in a repeated calculation mode for multiple times.
In one possible design, determining the alternative error parameter based on the target parameter includes: if the target parameters only comprise one parameter for characterizing the geometric distribution characteristics of the sample line segments, taking the parameter as the alternative error parameter; if the target parameters comprise a plurality of parameters for representing the geometric distribution characteristics of the sample line segments, performing weighted summation on the plurality of parameters according to weights corresponding to the plurality of parameters in the target parameters to obtain the alternative error parameters.
In the method, weights corresponding to different parameters in the target parameters are applied to the probability value determination, so that the emphasis of the reference information can be adjusted according to actual scene requirements in specific implementation, the segment set division is further flexibly performed, and the scene adaptability is improved.
In one possible design, the sample line segments include a plurality of first line segments; the target parameter comprises at least one of: a parameter with a value of 1/(1 + exp (-x)), where exp () is an exponential function with a natural constant as a base, x is a variance of a scaling parameter of the plurality of first line segments, the scaling parameter of any one first line segment is a ratio between a length of the first line segment and a distance from a termination endpoint of the first line segment to the target point, and the termination endpoint of any one first line segment is one endpoint of two endpoints of the first line segment that is farthest from the target point; the variance of texture direction values of all points contained in at least one second line segment is obtained by sequentially connecting starting end points of the plurality of first line segments according to the sequence of the plurality of first line segments in the plurality of line segments; a distance between one of the at least one second line segment that is closest to the target point and the target point; and respectively connecting the two end points of the reference line segment with the target point to obtain an included angle between the two line segments.
In the method, the target parameters comprise geometric characteristic information or geometric distribution characteristic information such as length, texture, angle and the like of the line segments in the line segment set, so that whether the line segments in the line segment set belong to the contour line of the same object or not can be judged according to the characteristic information of each dimension of the line segments in the line segment set, the judgment accuracy is improved, and the accuracy of subsequent target detection is improved.
In one possible design, performing contour extraction on the second target image to obtain a plurality of contour line segments in the second target image includes: carrying out edge contour detection on the second target image to obtain a plurality of contour points in the second target image; and obtaining the plurality of contour line segments according to the plurality of contour points.
In the method, a plurality of contour line segments are obtained by performing contour extraction processing on the image, and then line segments corresponding to different objects can be determined according to the plurality of contour line segments, so that object detection is further performed.
In one possible design, deriving the plurality of contour line segments from the plurality of contour points includes: filtering the plurality of contour points to obtain a plurality of target contour points; performing linear detection on the plurality of target contour points to obtain a plurality of contour line segments; or carrying out straight line detection on the plurality of contour points to obtain a plurality of contour line segments.
In the method, the contour points in the image are filtered, so that the contour points of other objects except the target object to be detected can be filtered, the interference of the contour points on the target detection process is reduced, and the detection precision and efficiency are improved.
In one possible design, filtering the plurality of contour points includes: dividing the image area of the second target image into a plurality of grids according to the set grid size; classifying the objects displayed in the plurality of grids by using a set classifier; and if the type of the object displayed in the target grid is a set type in the grids, deleting the contour points in the target grid.
In the method, the classifier can be used for rapidly classifying the pixel points in the image, and the contour points of the region where the object with the set category is located are deleted, so that the number of processed contour points can be reduced while the detection of the target object to be detected is not influenced, and the processing speed and efficiency are improved.
In a second aspect, the present application provides an object detection apparatus, the apparatus comprising:
the perspective transformation unit is used for performing inverse perspective transformation processing on a first target image to obtain a second target image, wherein the first target image is an image shot for a scene containing at least one target object, and the second target image is an image obtained after the first target image is mapped to a target plane; the image processing unit is used for carrying out contour line extraction processing on the second target image and obtaining a plurality of contour line segments in the second target image; the selection unit is used for selecting a plurality of line segments of which the straight lines pass through a set target point from the plurality of contour line segments; the dividing unit is used for dividing the line segments into at least one line segment set according to the positions of the line segments in the second target image, wherein the line segments contained in different line segment sets are different, and any line segment set contains at least two line segments in the line segments; a positioning unit, configured to perform the following steps for each set of line segments: projecting at least two line segments contained in a target line segment set to the first target image to obtain at least two projected line segments; and determining the position of a target object in the first target image according to the at least two projection line segments, wherein the target line segment sets are each line segment set.
In one possible design, the object detection device further includes an acquisition unit configured to acquire the first target image.
In a possible design, when the dividing unit divides the plurality of line segments into at least one line segment set according to the positions of the plurality of line segments in the second target image, the dividing unit is specifically configured to: sequencing the line segments according to the positions of the starting endpoints of the line segments in the second target image, wherein the starting endpoint of any line segment is the endpoint which is closest to the target point in the two endpoints of the line segment; according to the sequence of the line segments, selecting a line segment which is not divided into a line segment set as a reference line segment in sequence, and executing the following dividing process on the reference line segment: taking other line segments of the plurality of line segments except the reference line segment and the line segment which is divided into a line segment set as line segments to be branched; determining a target line segment, of the line segments to be divided, wherein an included angle between the target line segment and the reference line segment is smaller than a set threshold, and the target line segment comprises at least one line segment; calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour; when the error parameter is smaller than or equal to a set threshold value, dividing the target line segment and the reference line segment into the same line segment set; and when the error parameter is greater than the set threshold value, the target line segment and the reference line segment are not divided into the same line segment set, and the dividing process is finished.
In a possible design, when the dividing unit sorts the line segments according to the positions of the starting end points of the line segments in the second target image, the dividing unit is specifically configured to: and sequencing the line segments according to the position distribution sequence of the starting endpoints of the line segments in the second target image in the clockwise or anticlockwise direction.
In a possible design, when the dividing unit calculates an error parameter that classifies the target line segment and the reference line segment into the same object contour, it is specifically configured to: and calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour according to a set data model, wherein the set data model is used for calculating errors existing when a plurality of line segments are classified into the same object contour.
In a possible design, when the dividing unit calculates an error parameter that classifies the target line segment and the reference line segment into the same object contour, it is specifically configured to: performing multiple calculation processes on the target line segment and the reference line segment to obtain multiple alternative error parameters; wherein, each calculation process comprises the following steps: randomly selecting at least one line segment from the target line segments; taking the reference line segment and at least one line segment randomly selected from the target line segments as sample line segments; calculating target parameters corresponding to the sample line segments, and determining alternative error parameters according to the target parameters; wherein the target parameter is: comprises at least one parameter for characterizing the geometric distribution of the sample line segments; determining a minimum value of the plurality of candidate error parameters; and taking the minimum value as an error parameter for classifying the target line segment and the reference line segment into the same object contour.
In one possible design, the sample line segment includes a plurality of first line segments; the target parameter comprises at least one of: a parameter with a value of 1/(1 + exp (-x)), where exp () is an exponential function with a natural constant as a base, x is a variance of a scaling parameter of the plurality of first line segments, the scaling parameter of any one first line segment is a ratio between a length of the first line segment and a distance from a termination endpoint of the first line segment to the target point, and the termination endpoint of any one first line segment is one of two endpoints of the first line segment that is farthest from the target point; the variance of texture direction values of all points contained in at least one second line segment is obtained by sequentially connecting starting end points of the plurality of first line segments according to the sequence of the plurality of first line segments in the plurality of line segments; a distance between one of the at least one second line segment that is closest to the target point and the target point; and respectively connecting the two end points of the reference line segment with the target point to obtain an included angle between the two line segments.
In a possible design, the image processing unit performs contour extraction processing on the second target image, and when a plurality of contour line segments are obtained in the second target image, the image processing unit is specifically configured to: performing edge contour detection on the second target image to obtain a plurality of contour points in the second target image; and obtaining the plurality of contour line segments according to the plurality of contour points.
In a possible design, when the image processing unit obtains the plurality of contour line segments according to the plurality of contour points, the image processing unit is specifically configured to: filtering the plurality of contour points to obtain a plurality of target contour points; performing linear detection on the plurality of target contour points to obtain a plurality of contour line segments; or performing straight line detection on the plurality of contour points to obtain the plurality of contour line segments.
In a possible design, when the image processing unit filters the plurality of contour points, it is specifically configured to: dividing the image area of the second target image into a plurality of grids according to the set grid size; classifying the objects displayed in the plurality of grids by using a set classifier; and if the type of the object displayed in the target grid is a set type in the grids, deleting the contour points in the target grid.
In a third aspect, the present application provides an object detection apparatus comprising a memory and a processor; the memory is used for storing a computer program; the processor is configured to execute a computer program stored in the memory to implement the method described in the first aspect or any of the possible designs of the first aspect.
In a fourth aspect, the present application provides an object detection apparatus comprising at least one processor and an interface; the interface is used for providing program instructions or data for the at least one processor; the at least one processor is configured to execute the program instructions to implement the method described in the first aspect or any possible design of the first aspect.
In a fifth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which, when run on an object detection apparatus, causes the object detection apparatus to perform a method as described in the first aspect or any one of the possible designs of the first aspect.
In a sixth aspect, the present application provides a computer program product comprising a computer program or instructions for implementing the method as described in the first aspect or any of the possible designs of the first aspect, when the computer program or instructions are executed by an object detection apparatus.
In a seventh aspect, the present application provides a chip system, where the chip system includes at least one processor and an interface, where the interface is configured to provide program instructions or data for the at least one processor, and the at least one processor is configured to execute the program instructions to implement the method described in the first aspect or any possible design of the first aspect.
In one possible design, the system-on-chip further includes a memory to store program instructions and data.
In one possible design, the chip system is formed by a chip or comprises a chip and other discrete components.
For the advantageous effects of the second aspect to the seventh aspect, please refer to the description of the advantageous effects of the first aspect, and the description is not repeated here.
Drawings
Fig. 1 is a schematic diagram of an object detection method according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram illustrating a contour line extraction process performed on a second target image according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of an inverse perspective transformation provided in an embodiment of the present application;
FIG. 4 is a diagram illustrating a selection of a line segment from contour line segments in a second target image according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram illustrating a target line segment selected based on a reference line segment according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a target line segment according to an embodiment of the present application;
FIG. 7 is a schematic diagram illustrating a method for determining a position of an object in a first target image according to an embodiment of the present disclosure;
fig. 8 is a schematic diagram of an object detection method according to an embodiment of the present disclosure;
fig. 9 is a schematic flowchart of an object detection method according to an embodiment of the present disclosure;
fig. 10 is a schematic flowchart of an object detection method according to an embodiment of the present disclosure;
fig. 11 is a schematic flowchart of an object detection method according to an embodiment of the present disclosure;
fig. 12 is a schematic view of an object detecting device according to an embodiment of the present disclosure;
fig. 13 is a schematic structural diagram of an object detection apparatus according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in further detail with reference to the accompanying drawings. In the description of the embodiments of the present application, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or to implicitly indicate the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
For ease of understanding, a description of concepts related to the present application is given by way of illustration and reference.
1) And object detection: object detection refers to the process of locating multiple target objects from an image. In addition, in some implementation scenarios, the object detection may not only determine the position of the target object in the image, but also identify information including the category of the target object, where generally after identifying the position of the target object in the image, the target object may be generally marked with a rectangular box, which may also be referred to as a bounding box (bounding box), to prompt the user.
2) Inverse Perspective Mapping (IPM): in an image captured by a front-view camera, some object contour lines which are originally parallel may be shown to be intersected due to the perspective effect, and the IPM transform is a method for eliminating the perspective effect. At present, the conversion relationship among various coordinate systems in the imaging process of a camera can be utilized to abstract and simplify the basic principle of the camera, so that the corresponding relationship of coordinates between a world coordinate system and an image coordinate system is obtained, and further, the coordinate relationship of inverse perspective transformation is described in a formula mode.
3) Region of interest (ROI): in image processing, a region to be processed, which is defined in a processed image in the form of a square, a circle, an ellipse, an irregular polygon, or the like, is referred to as a region of interest, i.e., the region of interest is an image region selected from the image.
It should be understood that "at least one" in the embodiments of the present application means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a alone, both A and B, and B alone, where A, B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a and b, a and c, b and c, or a, b and c, wherein a, b and c can be single or multiple.
The object detection method provided by the embodiment of the application can be suitable for various target detection fields, such as security, image processing, video processing, land transportation, marine transportation, unmanned aerial vehicle monitoring, navigation, smart home, automatic driving and the like. The following description will be made taking an automatic driving scenario as an example.
In the field of automatic driving, the driving safety of an automatic driving vehicle is extremely important, and the automatic driving vehicle generally needs to utilize an automatic driving system or an ADAS and other systems to detect and judge the current road condition in time in the driving process, so that obstacles are effectively avoided, and the driving safety is ensured. However, due to the complexity of road conditions and the diversity of participants in roads, it is difficult to implement high-precision detection of common obstacles by one set of solution. The unreliable detection result easily causes a great potential safety hazard to automatic driving, for example, the decision of the ADAS System is easily influenced by the false detection condition, and then a Forward Collision Warning System (FCWS) of the vehicle is frequently triggered, so that the driving efficiency is reduced, and a serious vehicle Collision accident is easily caused by the false detection.
The existing obstacle detection methods in the field of automatic driving at present mainly comprise detection methods based on a monocular camera, a binocular camera, a radar, a laser radar and the like, and the detection methods mainly comprise the following steps:
the method comprises the following steps: the method comprises the steps of obtaining a current frame image and a historical frame image through a vehicle-mounted forward-looking camera, reconstructing dense three-dimensional point cloud of a road surface by utilizing a triangulation algorithm, thus obtaining relative depth corresponding to pixels in the image, and further detecting the barrier through depth information.
However, in this method, tens of historical frame images need to be processed to obtain a dense three-dimensional point cloud of the road surface from the image, so the calculation amount is large, and in addition, the triangulation algorithm has a high requirement on the matching accuracy of the features, which means that the algorithm is sensitive to the accuracy of the feature matching and has poor universality.
The method 2 comprises the following steps: the method comprises the steps of collecting a picture of a current surrounding environment through a vehicle-mounted forward-looking camera, directly subtracting the picture from a picture collected in a previous frame on an RGB (red, green, blue, red and blue) color gamut, mapping a difference image obtained after subtraction to a road surface by using inverse perspective transformation, and finally counting an angle histogram of the mapped image to obtain a candidate position of an obstacle.
However, the method mainly depends on the pixel difference between two frames of images to obtain the candidate position of the obstacle, so that the static obstacle has the problems of false detection and missing detection.
The method 3 comprises the following steps: the method comprises the steps of obtaining a point cloud data set by scanning a front obstacle through laser emitted by a vehicle-mounted laser radar, then fusing image information collected by a vehicle-mounted camera, screening the point cloud data set, and detecting the obstacle with a certain height by using the screened point cloud data.
The method is an information fusion type technical scheme based on a laser radar and a camera, the implementation cost of the scheme is high, and in addition, false detection to a certain degree is easily caused when the three-dimensional point cloud is too dense.
In summary, most of the methods for detecting obstacles in the prior art have the problems of missing detection, false detection, and the like, so the efficiency of detection is low, and the universality of the scheme is poor.
In order to solve the problem, embodiments of the present application provide an object detection method and apparatus, so as to efficiently and accurately detect an object. The method can be applied to the intelligent driving fields of automatic driving, auxiliary driving and the like to detect the obstacles, and can realize relatively accurate obstacle detection under various road conditions.
For convenience of introduction, hereinafter, an object detection method provided in an embodiment of the present application is described as an example performed by an object detection apparatus.
The object detection method provided by the embodiment of the application can be used for detecting the object by combining the image acquired by the image acquisition device. The method can be applied to an object detection device with data processing capability. Wherein the image acquisition device may be integrated into the object detection device, or the image acquisition device may transmit images to the object detection device in real time. In addition, the image acquisition device can also detect images in the stored multimedia files.
By way of example and not limitation, the object detection device may be a vehicle with a data processing function, or an on-board device with a data processing function in a vehicle, or a sensor with a function of acquiring and processing images. The in-vehicle device may include, but is not limited to, an in-vehicle terminal, an in-vehicle controller, an in-vehicle module, an in-vehicle component, an in-vehicle chip, an in-vehicle unit, an Electronic Control Unit (ECU), a Domain Controller (DC), and the like. The object detection device may also be other electronic devices with data processing functions, where the electronic devices include, but are not limited to, smart home devices (e.g., televisions, etc.), smart robots, mobile terminals (e.g., mobile phones, tablet computers, etc.), wearable devices (e.g., smart watches, etc.), and other smart devices. The object detection device may also be a controller, chip, or other device within the smart device.
The image acquisition device in the embodiment of the present application may be a camera, a monocular camera, a binocular camera, a near infrared camera, a video camera, a cabin-type video camera, a vehicle data recorder (i.e., a video recording terminal), a back-up image camera, etc., and is not particularly limited in the embodiment of the present application.
For example, in the intelligent driving field such as automatic driving and driving assistance, the shooting area of the image capturing device may be the external environment of the vehicle. For example, when the vehicle is moving forward, the shooting area may be a front area of the vehicle head; when the vehicle is backed, the shooting area can be an area behind the tail of the vehicle; when the image acquisition device is a 360-degree multi-angle camera, the shooting area can be an area of a 360-degree range around the vehicle, and the like.
The object detection method provided in the embodiments of the present application is described in detail below with reference to the accompanying drawings, and it is to be understood that the embodiments described below are only a part of the embodiments of the present application, and not all of the embodiments.
Fig. 1 is a schematic diagram of an object detection method according to an embodiment of the present application. Referring to fig. 1, a method for detecting an object according to an embodiment of the present application will be specifically described.
S101: the object detection device performs inverse perspective transformation processing on a first target image to obtain a second target image, wherein the first target image is an image shot for a scene containing at least one target object, and the second target image is an image obtained after the first target image is mapped to a target plane.
In this embodiment of the application, the object detection device may detect a target object included in a certain scene based on an image captured for the scene, determine a position of the target object in the image, and further determine the position of the target object in the scene according to the position of the target object in the image.
When detecting an object, an object detection device first acquires a first target image to be detected, wherein the first target image is an image shot for a scene containing at least one target object. The object detection device may acquire the first target image by receiving an image sent by the image acquisition device or receiving an image input by a user.
And after the object detection device acquires the first target image, performing inverse perspective transformation on the first target image to obtain a second target image, wherein the second target image is an image obtained after the first target image is mapped to a target plane.
In some embodiments of the present application, the first target image may be a complete image taken for a certain scene, or the first target image may be a partial image corresponding to a region of interest in a certain image. The object plane may be the same plane in which most of the object objects in the scene are located.
For example, in an autopilot scenario, the target plane may be an ideal ground plane. For another example, in a sea traffic scenario, the target plane may be an ideal sea level.
In view of the fact that images acquired by an image acquisition device in most of the existing scenes cause certain geometric distortion due to perspective effect, an object detection device can project an acquired first target image to an ideal ground plane to obtain a second target image, and therefore the real geometric characteristics of an object in the first target image are restored.
The object detection device may map the first target image to an ideal ground plane through a homography matrix to obtain the second target image, where the homography matrix may be used to describe a position mapping relationship of the object between a world coordinate system and a pixel coordinate system.
In the present embodiment, the second target image obtained by mapping the first target image captured for a certain scene onto the ideal ground plane may be understood as an image of the scene in a top view.
S102: and the object detection device carries out contour line extraction processing on the second target image and obtains a plurality of contour line segments in the second target image.
After the object detection device obtains the second target image corresponding to the first target image, edge contour detection may be performed on the second target image, a plurality of contour points are obtained in the second target image, and then the plurality of contour line segments are obtained according to the plurality of contour points.
The object detection device can adopt an edge contour detection algorithm based on a Canny operator to complete the extraction of contour points to obtain a plurality of contour points; the hough transform algorithm can be adopted to perform straight line detection on the contour points to obtain the contour line segments.
As an alternative embodiment, when the object detection device determines the plurality of contour line segments, the object detection device may directly perform straight line detection on the plurality of contour points to obtain the plurality of contour line segments.
As another optional implementation, when the object detection apparatus determines the plurality of contour segments, the object detection apparatus may filter the plurality of contour points obtained by performing edge contour detection to obtain a plurality of target contour points, and then perform straight line detection on the plurality of target contour points to obtain the plurality of contour segments.
The object detection device may divide the image area of the second target image into a plurality of grids according to the set grid size, then classify the objects displayed in the plurality of grids by using the set classifier, and delete the contour points located in the target grid if the type of the object displayed in the target grid is the set type in the plurality of grids after the classification, thereby filtering the plurality of contour points.
In some embodiments of the present application, the set classifier may be a lightweight classifier, such as a Support Vector Machine (SVM) based classifier or an extreme gradient boosting (XGBoost) based classifier.
The object detection device may filter contour points in a grid region where the object of the set category is located in the second target image by using the classifier, and delete contour points in a grid of a region where the object of the set category is located with a higher probability, thereby avoiding interference of pixel points in the regions on the object detection process.
For example, in the field of automatic driving, when the target plane is set to be an ideal plane, and the set category may be a road surface, the object detection apparatus may classify pixel points in the second target image by using a lightweight road surface classifier, determine road surface pixels therein, and delete contour points in a grid region corresponding to the road surface pixels, so as to filter out contour points in a grid having a high probability of being the road surface region, thereby avoiding interference of the road surface region with an object detection process.
For another example, in a marine traffic scene, when the target plane is set as an ideal sea plane, the set type may be a sea plane, and the corresponding contour point filtering manner may refer to the ground contour point filtering manner, which is not described herein again.
Fig. 2 is a schematic diagram illustrating a process of extracting a contour line from a second target image according to an embodiment of the present application. Fig. 2 (a) is a schematic diagram of a second target image obtained by performing inverse perspective transformation on an image captured by a camera, and after performing the edge contour detection on the second target image, a contour map as shown in fig. 2 (b) is obtained, in which a plurality of contour points are displayed to represent contours of a plurality of objects in the second target image shown in the schematic diagram (a). A plurality of line segments shown in a schematic diagram (c) in fig. 2 are obtained by filtering a plurality of contour points in the contour diagram and performing straight line detection on the target contour points obtained after filtering, wherein the schematic diagram (c) deletes the contour points of the road surface, so that the influence of road surface elements on object detection can be avoided, and the plurality of line segments shown in the schematic diagram (c) represent the contour line segments of the object extracted from the second target image shown in the schematic diagram (a) and are used for determining the position of the object in the second target image.
S103: the object detection device selects a plurality of line segments of which the straight line passes through a set target point from the plurality of contour line segments.
After the image is subjected to inverse perspective transformation, the height contour lines of objects with a certain height in the image are obviously elongated, and the contour lines of the transformed objects on the height are close to the same point. Therefore, after the object detection device performs inverse perspective transformation on the first target image, the obtained contour line segments corresponding to the height of the object in the second target image are all close to the same feature point in the second target image.
Fig. 3 is a schematic diagram of an inverse perspective transformation provided in an embodiment of the present application. Fig. 3 (a) is a schematic diagram of a first target image, in fig. 3 (a), a quadrangle ABCD represents an outline of an object in a road in the first target image, where line segments AC and BD represent outlines of the object in a height direction. A corresponding second target image obtained by performing inverse perspective transformation on the first target image shown in the schematic diagram (a) in fig. 3 is shown in the schematic diagram (B) in fig. 3, where a quadrangle EFGH is a figure obtained by performing inverse perspective transformation on a quadrangle ABCD in the schematic diagram (a), and points E, F, G, and H correspond to points a, B, C, and D, respectively. As can be seen from comparison between the schematic diagrams (a) and (b) in fig. 3, the contour line of the object in the height direction in the image is significantly elongated after the inverse perspective transformation, and the contour line of the object in the width direction has a smaller change in length after the inverse perspective transformation.
Based on the above characteristics, the object detection device may select a line segment corresponding to the height profile of the object from the plurality of contour lines after performing contour line extraction processing on the second target image to obtain the plurality of contour lines, and perform object detection according to the selected line segment.
In a specific implementation, the object detection device may select, from the plurality of contour line segments obtained, a plurality of line segments in which a straight line of the line segment passes through a set target point, or may select a plurality of line segments in which a straight line of the line segment passes through a set area with the target point as a center, and then analyze and process the plurality of line segments.
Optionally, the set target point is a feature point corresponding to the optical center of the image capturing device in the second target image. For example, the target point may be a feature point at the bottom center position of the second target image.
For example, fig. 4 is a schematic diagram of selecting a line segment from contour line segments in a second target image according to an embodiment of the present application. Line segment L, as shown in FIG. 4 1 To line segment L 8 The two contour line segments are respectively extracted from the second target image, and the point P is a target point set in the second target image. Wherein, among the 8 contour line segments, the line segment L 1 Line segment L 2 And a line segment L 6 Line segment L 7 All the straight lines pass through the target point P, so that the line outgoing section L can be selected from 8 contour line sections 1 Line segment L 2 Line segment L 6 Line segment L 7 As a selected plurality of line segments, thereby according to the line segment L 1 Line segment L 2 Line segment L 6 Line segment L 7 And carrying out object detection.
S104: the object detection device divides the line segments into at least one line segment set according to the positions of the line segments in the second target image, wherein the line segments contained in different line segment sets are different, and any line segment set contains at least two line segments in the line segments.
The object detection device selects a plurality of line segments from a plurality of contour line segments, then divides the plurality of line segments into line segment sets, and then detects an object according to the divided line segment sets.
Specifically, the object detection device may execute S104 by the following steps A1 to A2:
a1: and the object detection device sorts the line segments according to the positions of the starting endpoints of the line segments in the second target image, wherein the starting endpoint of any line segment is the endpoint which is closest to the target point in the two endpoints of the line segment.
A2: the object detection device selects a line segment which is not divided into a line segment set as a reference line segment in sequence according to the sequence of the line segments, and executes the following dividing processes B1-B4 on the reference line segment:
b1: and taking other line segments of the plurality of line segments except the reference line segment and the line segment which is divided into the line segment set as line segments to be branched.
B2: and determining a target line segment, of the line segments to be divided, of which the included angle with the reference line segment is smaller than a set threshold, wherein the target line segment comprises at least one line segment.
B3: and calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour.
B4: when the error parameter is less than or equal to a set threshold value, dividing the target line segment and the reference line segment into the same line segment set; and when the error parameter is greater than the set threshold value, the target line segment and the reference line segment are not divided into the same line segment set, and the dividing process is finished.
Wherein, the smaller the error parameter calculated above, the higher the possibility that the reference line segment and the target line segment belong to the same object contour.
In some embodiments of the present application, the object detection apparatus may apply the above-mentioned line segment set partitioning method to a random sample consensus (RANSAC) algorithm model, and complete the partitioning of the line segment set by using the model.
In some embodiments of the present application, when the object detection apparatus sorts the plurality of line segments, the plurality of line segments may be sorted according to a position distribution order of start endpoints of the line segments in the second target image, which is clockwise or counterclockwise.
In some embodiments of the present application, an included angle between any one of the target line segment and the reference line segment is an included angle formed at a point when the target line segment and the reference line segment are respectively extended to intersect at the point. When the object detection device determines a target line segment in the line segment to be divided, wherein the included angle between the object detection device and the reference line segment is smaller than a set threshold, the object detection device can connect the starting end point of the reference line segment with the target point to obtain a first auxiliary line segment, and when the included angle between the line segment obtained by connecting the starting end point of a certain line segment with the target point and the first auxiliary line segment is smaller than a set angle, the object detection device considers that the included angle between the line segment and the reference line segment is smaller than the set threshold.
For example, fig. 5 is a schematic diagram of selecting a target line segment based on a reference line segment according to an embodiment of the present application. As shown in FIG. 5, based on the second target image shown in FIG. 4, among the selected line segments, if the line segment L is currently selected 1 As a reference line segment, the angle is set to a threshold value of
Figure BDA0002996402720000111
Then connect line segment L 1 Starting endpoint A of 0 Obtaining an auxiliary line segment L with the target point 01 With the auxiliary line segment L 01 The range of the included angle of (a) to set the threshold value may be an angle range corresponding to the sector shown in fig. 5. At the selected line segment L 1 Corresponding target line segmentFor the line segment L shown in FIG. 5 2 Connecting the starting end points B of the line segments 0 Obtaining an auxiliary line segment L after the target point 02 Due to the auxiliary line segment L 02 And an auxiliary line segment L 01 The included angle delta between is smaller than the set angle
Figure BDA0002996402720000112
Then line segment L 2 Can be taken as a line segment L 1 A corresponding target line segment, and so on, may determine the line segment L 1 All reference line segments corresponding.
In this application, when the object detection apparatus calculates an error parameter for classifying the target line segment and the reference line segment into the same object contour, the method can be implemented by, but is not limited to:
in a first embodiment, the object detection apparatus may perform multiple calculation processes on the target line segment and the reference line segment to obtain multiple candidate error parameters. Wherein, each calculation process comprises the following steps:
c1: at least one line segment is randomly selected from the target line segments.
C2: and taking the reference line segment and at least one line segment randomly selected from the target line segments as sample line segments.
C3: calculating target parameters corresponding to the sample line segments, and determining alternative error parameters according to the target parameters; wherein the target parameter is: at least one parameter characterizing the geometric distribution of the sample line segments is included.
C4: determining a minimum value of the plurality of candidate error parameters.
C5: and taking the minimum value as an error parameter for classifying the target line segment and the reference line segment into the same object contour.
In a second embodiment, the algorithm for calculating the error parameter of the process of classifying the target line segment and the reference line segment into the same object contour may be implemented by a set data model, which is used to calculate probability values of a plurality of line segments belonging to the same object, and the error parameter of classifying the target line segment and the reference line segment into the same object contour may be calculated by the method for calculating probability values.
Optionally, in the first embodiment, the sample line segments include a plurality of first line segments, and the target parameter calculated by the object detection apparatus includes at least one of the following four parameters:
1) The value of the parameter is 1/(1 + exp (-x)), which may be referred to as a proportional constraint parameter in this embodiment, where exp () is an exponential function with a natural constant as a base, x is a variance of the proportional parameters of the plurality of first line segments, the proportional parameter of any first line segment is a ratio between a length of the first line segment and a distance from a termination endpoint of the first line segment to the target point, and the termination endpoint of any first line segment is one endpoint of two endpoints of the first line segment that is farthest from the target point.
Exemplarily, fig. 6 is a schematic diagram of a target line segment provided in an embodiment of the present application. As shown in fig. 6, it is assumed that the sample line segments include 3 first line segments, which are line segments L according to the line segment ordering 9 Line segment L 10 And a line segment L 11 Wherein, line segment L 9 Also as a reference line segment, point P is the target point. By line segment L 9 For example, line segment L 9 Has an initial endpoint of A 1 The termination point is A 2 Then line segment L 9 The corresponding proportional parameter is the auxiliary line segment A 1 Length of P and auxiliary line segment A 2 Ratio of the lengths of P, line segment L 10 Line segment L 11 The same is true. Calculating the line outgoing section L according to the mode 9 Line segment L 10 Line segment L 11 And calculating the variance of the 3 proportional parameters according to the 3 proportional parameters to obtain the proportional constraint parameters corresponding to the sample line segments.
2) And the variance of the texture direction values of all points included in at least one second line segment, where the at least one second line segment is a line segment obtained by sequentially connecting the starting endpoints of the plurality of first line segments according to the sequence of the plurality of first line segments in the plurality of line segments, and the parameter may be referred to as a texture constraint parameter in this embodiment of the present application.
The object detection means may calculate a texture direction (texture orientation) value of the point on each second line segment using a wavelet (gabor) operator.
And the texture direction of any point on any second line segment is the texture direction of a pixel point corresponding to the point in the first target image or the second target image.
Illustratively, as shown in fig. 6, it is assumed that the order of 3 first line segments included in the sample line segments among a plurality of line segments selected from a plurality of contour line segments is line segments L in order 9 Line segment L 10 Line segment L 11 Wherein, line segment L 9 Has a starting endpoint of A 1 The termination end point is A 2 Line segment L 10 Has a starting endpoint of B 1 The termination point is B 2 Line segment L 11 Has a starting endpoint of C 1 The termination point is C 2 . The object detecting means may be connected to a 1 Dot, B 1 Point-derived auxiliary line segment L 12 Is connected to B 1 Dot, C 1 Point-derived auxiliary line segment L 13 Line segment L 12 Line segment L 13 As a second line segment, then calculate line segment L separately 12 Line segment L 13 The corresponding texture direction value of each point is added, and the obtained line segment L is aligned 12 And a line segment L 13 And solving the variance of the corresponding texture direction values of all the points to obtain the texture constraint parameters corresponding to the sample line segments.
3) And a distance between a closest line segment of the at least one second line segment to the target point and the target point, which may be referred to as a distance constraint parameter in this embodiment, where the at least one second line segment is a line segment obtained by sequentially connecting starting end points of the plurality of first line segments according to a sequence of the plurality of first line segments in the plurality of line segments.
Illustratively, as shown in FIG. 6, the object detecting devices are respectively connected to A 1 Dot, B 1 Point-derived auxiliary line segment L 12 Is connected to B 1 Dots, C 1 Point-derived auxiliary line segment L 13 Then, the line segment L is judged 12 Line segment L 13 The line segment closest to the point P is the line segment L 12 Then segment L is divided 12 The distance to the P point is determined as the distance constraint parameter for the sample line segment. Wherein, the line segment L 12 The distance from the point P is from the point P to the line segment L 12 Perpendicular line segment L 03 Of the length of (c).
4) And respectively connecting the two end points of the reference line segment with the target point to obtain an included angle between the two line segments, wherein the parameter can be referred to as an angle constraint parameter in the embodiment of the application.
In some embodiments of the present application, after the object detection device determines the target parameter, the following method may be adopted when determining the candidate error parameter according to the target parameter: if the object detection device determines that the target parameters only contain one parameter, the object detection device takes the parameter as the alternative error parameter; and if the target parameters comprise multiple parameters, carrying out weighted summation on the multiple parameters according to weights corresponding to the multiple parameters in the target parameters to obtain the alternative error parameters.
The weights corresponding to the parameters included in the target parameter may be input by a user, and the weights corresponding to the same parameter in different scenes may be different.
S105: the object detection device performs the following steps for each set of line segments: projecting at least two line segments contained in a target line segment set to the first target image to obtain at least two projected line segments; and determining the position of a target object in the first target image according to the at least two projection line segments, wherein the target line segment set is each line segment set.
In some embodiments of the present application, after the object detection apparatus performs the division of the line segment sets in the second target image in the above manner, the object detection apparatus performs the following processing with each line segment set as a target line segment set: and if the at least two projection line segments cannot form a closed surrounding frame, connecting the starting end point/the ending end point of each two adjacent projection line segments or connecting the starting end point of one projection line segment and the ending end point of the other projection line segment in each two adjacent projection line segments to enable the at least two projection line segments to form the closed surrounding frame, using the surrounding frame as a boundary frame of a target object of the first target image, and using the position defined by the surrounding frame as the position of the target object in the first target image.
In some embodiments of the present application, when the object detection apparatus processes the target line segment set, if at least two line segments included in the target line segment set cannot form a closed bounding box, the object detection apparatus may also connect the start end point/the end point of each two adjacent line segments, or connect the start end point of one line segment of each two adjacent line segments and the end point of another line segment, so that the at least two line segments can form a closed bounding box, and then project all line segments forming the bounding box into the first target image, to obtain a bounding box corresponding to the target object.
Fig. 7 is a schematic diagram for determining a position of an object in a first target image according to an embodiment of the present disclosure. Based on the schematic diagram of the second object image shown in fig. 4, in fig. 7, (a) is a schematic diagram of a line segment L selected from the contour line segments shown in fig. 4 1 Line segment L 2 Line segment L 7 Line segment L 8 A schematic diagram of a second target image after the division of the line segment sets, wherein the second target image comprises two line segment sets respectively including a line segment L 1 Line segment L 2 And contains line segment L 7 Line segment L 8 Of the second set of line segments. Wherein the first line segment geometrically comprises a line segment L 1 Line segment L 2 The object detection device can be connected with the line segment L if the closed surrounding frame can not be formed 1 And a line segment L 2 The starting end point of (A) is obtained as a line segment L 14 And a connecting line segment L 1 And a line segment L 2 The termination end point of (A) is obtained as a line segment L 15 So that the line segment L 1 Line segment L 2 Line segment L 14 Line segment L 15 Form a closedThe enclosure frame and the second line segment set have the same function. Then, the object detection apparatus projects the line segments of each bounding box in the second target image into the first target image, so as to obtain the schematic diagram of the first target image shown in the schematic diagram (b) in fig. 7, where each bounding box projected into the first target image can be used as a bounding box of one target object for marking the position of the target object.
It should be noted that the step numbers in the embodiments described in this application are only an example of an execution flow, and do not limit the sequence of executing the steps, and there is no strict execution sequence between steps that have no time sequence dependency relationship between them in this application embodiment.
In the above embodiment, the object detection device performs object detection according to the second target image obtained by projecting the first target image onto the target plane, and can perform object detection by fully utilizing affine geometric features presented by the object outline after the first target image is subjected to inverse perspective transformation, so that the accuracy of object detection is improved.
The object detection method provided by the embodiment of the application can be applied to the field of automatic driving and used for detecting the obstacles on the road surface. For example, an in-vehicle device of an autonomous vehicle may perform object detection on an image captured by a front in-vehicle camera using the object detection method. The following description will be given with reference to specific examples. Hereinafter, the object detection device will be described as an example of an entity that executes the object detection method.
Fig. 8 is a schematic diagram of an object detection method according to an embodiment of the present application. As shown in fig. 8, after the object detection device acquires the current frame image to be detected, the image may be directly used as the first target image to perform inverse perspective transformation to obtain the second target image, that is, the bird's-eye view image, or the image of the region of interest in the image may be used as the first target image to perform inverse perspective transformation to obtain the second target image, and the second target image is subjected to contour line extraction processing to obtain a processed contour map, where the contour map includes a plurality of contour line segments.
The object detection device can map the first target image to the ground plane according to the calibration parameters of the camera for shooting the image on the basis of the ideal ground plane hypothesis to obtain a second target image, and extract the outer contour line in the second target image. Optionally, after the object detection device obtains the contour map, the noise processing may be performed on the contour map to remove the road noise points in the contour map.
Based on IPM transformation, the contour line segment with a certain height will be elongated significantly, and for the object with a certain height on the road surface, the contour of the height will be close to the optical center. Therefore, the local RANSAC algorithm model based on the optical center constraint can be adopted in the following embodiments to perform iterative sampling and segment set division on the profile segments.
In the RANSAC algorithm model, the coordinates of pixel points in the image coordinate system can be expressed as points n = (x, y), wherein point n And (3) representing the nth end point, wherein x corresponds to the abscissa in the image coordinate system, and y corresponds to the ordinate in the image coordinate system. The contour line segments in the image can be represented as lines in the image coordinate system n =(point n1 ,point n2 ) Wherein, line n Indicates the nth line segment, point n1 Indicates the starting end point of the nth line segment n2 The termination end point of the nth line segment is indicated. And n is a positive integer. The line segments in the image are sorted chronologically according to their starting endpoints to obtain a contained (line) 1 ,line 2 ,…,line n ) The model of (1).
The object detection device performs linear detection to obtain a plurality of contour line segments in the second target image, and then performs linear detection/clustering, namely segment set division on the contour line segments in the second target image by using a RANSAC algorithm model, and then stretches the contour line segments to be equal in length after IPM transformation based on the same height, so that contour proportion constraint can be added to the RANSAC algorithm model, namely if the lengths of some line segments are determined to be close to the distance proportion from the termination end points to the optical center, the line segments tend to be considered to belong to the same object.
In addition, the contour line segment of the object tail part facing the camera forms a texture with the contour direction converging after IPM transformation. Based on the method, the RANSAC algorithm model can also detect the texture direction of the line segment connected with the top point of the object on the aerial view by using a wavelet operator, namely the connection line of the starting points of two adjacent line segments of the model, and the determined texture direction parameter is used as reference information to determine whether different line segments belong to the same object.
After the object detection device divides the contour line segments into line segment sets through the RANSAC algorithm model, the line segments of different line segment sets obtained through division are respectively back-projected to the first target image, and final surrounding frames (boundary frames) of different target objects are obtained.
According to the method, the IPM transformation is carried out on the shot images, so that the outline characteristics of objects on the road surface are enhanced, and then the RANSAC algorithm model is utilized to extract the outline line segments with the object characteristics. And performing line segment extraction and line segment set division on the contour line to obtain a candidate model contour, namely the line segment of each line segment set, and performing back projection on the candidate model contour to the original image plane to obtain a final enclosing frame of the object. According to the method, the geometrical characteristics of the object contour after the image is subjected to IPM transformation are fully utilized, all candidate obstacle contours with the characteristics on the road surface are screened out, and meanwhile, the problems of obstacle diversification and distance are solved, so that the algorithm flow is simplified. The method is suitable for detecting objects in structured roads and unstructured roads.
The following describes an execution flow of the object detection method in conjunction with a specific embodiment.
Example one
Fig. 9 is a schematic flowchart of an object detection method according to an embodiment of the present application. The process of the method is explained by dividing a line segment set by using an RANSAC algorithm model into examples, and relates to an algorithm overall iteration process and a process for screening a candidate line segment set by using the RANSAC algorithm model. The RANSAC algorithm model randomly samples local line segments, and scores each group of sampling line segment sets by using proportion constraint, texture constraint, distance constraint and angle constraint based on the specific geometric characteristics of the object contour to obtain divided line segment sets.
As shown in fig. 9, the flow of the method includes:
s900: the image acquisition device acquires a current image frame.
The image acquisition device acquires a current image frame by shooting an image, takes the current image frame as a first target image and sends the first target image to the object detection device. Wherein the image acquisition device may be a camera.
S901: the object detection apparatus performs IPM conversion on the current image frame.
The object detection device performs IPM transformation on a current image frame, namely a first target image, through a homography matrix, so that the conversion from an image plane of the first target image to an ideal ground plane is realized, and a second target image is obtained, wherein the second target image is a bird's-eye view.
S902: the object detection device obtains a profile map.
And the object detection device finishes the extraction of the initial contour points in the second target image by using an edge contour detection algorithm based on a Canny operator to obtain a contour map containing a plurality of contour points.
S903: the object detection device acquires an initial line segment candidate set.
The object detection device performs linear detection on the contour points based on Hough transform to obtain a plurality of contour line segments, selects a plurality of line segments of which the straight lines pass through a set target point from the contour line segments, and takes the plurality of line segments as an initial line segment candidate set.
S904: the object detection device traverses the RANSAC algorithm model counterclockwise through the line segments in the initial line segment candidate set.
And the object detection device carries out reverse-time needle sequencing on the line segments according to the starting end points of the line segments. The starting point is defined as a segment of the line segment that is closer to the optical center, i.e., the detection algorithm traverses the line segment counterclockwise.
Wherein the detection algorithm can be realized by a RANSAC algorithm model.
S905: and the object detection device screens the RANSAC algorithm model to realize the segment set division of the initial segment candidate concentrated segments.
In this step, the object detecting apparatus traverses each line segment counterclockwise by using a RANSAC algorithm model, wherein the RANSAC algorithm model includes the steps of:
step 1: and taking the current line segment currently processed and other line segments which are adjacent left and right and do not exceed a set angle range as a local sampling set of the RANSAC algorithm model.
The current line segment is a reference line segment, and the range where the left and right adjacent current line segments do not exceed the set angle refers to the range of the set angle around the auxiliary line segment obtained by connecting the starting end point and the target point of the current line segment, which can be referred to in the above embodiments. The line segments included in the sampling set correspond to the reference line segments and the target line segments in the above embodiments.
Step 2: the object detection device takes the local sampling set as the input of the RANSAC algorithm model, and sets the iteration times of the RANSAC algorithm model.
Wherein, the iteration number can be input by a user. And the object detection device iteratively executes the following steps 3 to 4 according to the iteration times.
And step 3: and the object detection device randomly samples a part of line segments from the local sampling set to obtain a plurality of line segments comprising the current line segment, and calculates the score of the RANSAC algorithm model, wherein the final score is the error parameter for classifying the target line segment and the reference line segment into the same object contour.
The multiple line segments including the current line segment are sample line segments, and the scores of the RANSAC algorithm model are target parameters corresponding to the sample line segments.
When the object detection device determines the score of the RANSAC algorithm model, the following four scores need to be calculated firstly:
1) Proportional constraint score (proportional constraint parameter).
The object detection device calculates the ratio of the length of each line segment to the maximum length from the termination end point of the line segment to the optical center. Since the inputs to the RANSAC algorithm model contain at least two line segments, there must be at least two proportional values. And calculating a corresponding proportion constraint score through a formula 1/(1 + exp (-var (disti/distio))), wherein exp () is an exponential function taking a natural constant as a base, var () is a variance function, disti represents the length of the line segment, and distio represents the maximum distance from the end point of the line segment to the optical center, namely the distance from the end point of the line segment to the optical center.
2) Texture constraint score (texture constraint parameter).
The object detection device is sequentially connected with the starting end points of all line segments according to the sequence of the line segments input into the RANSAC algorithm model to obtain at least one line segment, the texture orientation of all points contained in the at least one line segment is solved by utilizing a wavelet operator, and the variance of the texture orientation of the points is calculated.
3) Distance constraint score (distance constraint parameter).
The object detection device determines the sequence of a plurality of line segments according to the input RANSAC algorithm model, and the shortest distance from the line segments to the optical center is obtained after the starting end points of the line segments are connected in sequence.
4) Angle constraint score (angle constraint parameter).
The object detection device calculates an included angle formed by the starting end point of the current line segment and the ending end point of the line segment to the optical center.
And 4, step 4: and determining weights corresponding to different scores according to the operation scene of the algorithm, applying the weights to each constraint score, and acquiring a final score.
And 5: and 3, after the iteration of the step 3 to the step 4 is finished, taking the RANSAC algorithm model with the lowest score in multiple iterations as the final RANSAC algorithm model of the current line segment, and if the score of the model is smaller than a set threshold value, indicating that the model exists, otherwise, indicating that the model exists.
Step 6: and if the model exists, removing the line segment set in the current final RANSAC algorithm model from the initial line segment set, namely marking the line segments in the set as deleted.
And 7: s904 is repeatedly executed, and the next line segment is processed using the RANSAC algorithm model.
S906: the object detection device performs object detection based on the divided line segment sets.
The object detection device back-projects all line segment sets in the RANSAC algorithm model meeting the conditions to the image plane of the first target image, and determines the position of at least one target object in the first target image according to the obtained projected line segments.
For the specific implementation of the above steps, reference may be made to the implementation manner in the object detection method provided in fig. 1, and repeated descriptions are omitted.
In the above embodiment, by introducing the camera calibration information, a homography matrix required for IPM conversion from the image plane to the ideal ground plane is constructed, and the geometric attributes of the object in the original image frame are restored and strengthened, wherein the restoration is mainly performed on the landmarks located in the ground plane, such as lane lines, sidewalks, and the like, and the contour of the object with height is significantly elongated. Therefore, in a new data expression form, the RANSAC algorithm is more favorable for model screening. In the embodiment, the significant affine geometric features formed by the objects in the image after IPM transformation are fully utilized, particularly for higher and farther targets, the contour formed by the objects on the aerial view is close to or passes through the optical center, and the contour corresponding to the height of the object is significantly elongated, and based on the geometric constraints, the contour of the target object is iteratively screened through a semi-random RANSAC algorithm and a self-defined contour model and evaluation terms. Meanwhile, the method can measure the distance according to the camera calibration information, integrates the detection and distance measurement algorithms, and integrates the detection and distance measurement into the same iterative model, so that the distance information and the detection information can be returned at the same time, and the overall flow of the algorithm is simplified.
Example two
Fig. 10 is a schematic flowchart of an object detection method according to an embodiment of the present application. The flow of the method is described by dividing a line segment set into examples by adopting an RANSAC algorithm model, and relates to an algorithm overall iteration flow and a process for screening a candidate line segment set by the RANSAC algorithm model. The RANSAC algorithm model randomly samples local line segments, and scores each group of sampling line segment sets by using proportion constraint, texture constraint, distance constraint and angle constraint based on the specific geometric characteristics of the object contour to obtain divided line segment sets.
As shown in fig. 10, the flow of the method includes:
s1000: the image acquisition device acquires a current image frame.
The image acquisition device acquires a current image frame by shooting an image, takes the current image frame as a first target image and sends the first target image to the object detection device. Wherein the image acquisition device may be a camera.
S1001: the object detection apparatus performs IPM conversion on the current image frame.
The object detection device performs IPM transformation on a current image frame, namely a first target image, through a homography matrix, so that the conversion from an image plane of the first target image to an ideal ground plane is realized, and a second target image is obtained, wherein the second target image is a bird's-eye view.
S1002: the object detecting device obtains a profile.
And the object detection device completes the extraction of the initial contour points in the second target image by using an edge contour detection algorithm based on a Canny operator to obtain a contour map containing a plurality of contour points.
S1003: the object detection device performs meshing on the contour map.
The object detection device divides the contour map, i.e., the second target image, into meshes of a set size.
S1004: the object detection device deletes the road surface area contour points using the classifier.
The object detection device performs preliminary filtering of road surface pixels using a lightweight road surface classifier, and deletes contour points in a region classified as a road surface.
The image processed in the following steps is an image of deleting contour points in the road surface area determined according to the classification result of the road surface classifier and the contour map.
S1005: the object detection device acquires an initial line segment candidate set.
The object detection device performs linear detection on the contour points based on Hough transform to obtain a plurality of contour line segments, selects a plurality of line segments of which the straight lines pass through a set target point from the contour line segments, and takes the plurality of line segments as an initial line segment candidate set.
S1006: the object detection device traverses the RANSAC algorithm model counterclockwise through the line segments in the initial line segment candidate set.
And the object detection device carries out reverse-time needle sequencing on the line segments according to the starting end points of the line segments. The starting point is defined as a segment of the line segment that is closer to the optical center, i.e., the detection algorithm traverses the line segment counterclockwise.
Wherein the detection algorithm can be realized by a RANSAC algorithm model.
S1007: and screening an RANSAC algorithm model by the object detection device to realize segment set division of the initial segment candidate concentrated segments.
In this step, the object detecting apparatus traverses each line segment counterclockwise by using a RANSAC algorithm model, wherein the RANSAC algorithm model includes the steps of:
step 1: and taking the current line segment which is currently processed and other line segments which are adjacent left and right and do not exceed a set angle range as a local sampling set of the RANSAC algorithm model.
The current line segment is a reference line segment, and the range where the left and right adjacent current line segments do not exceed the set angle refers to the range of the set angle around the auxiliary line segment obtained by connecting the starting end point and the target point of the current line segment, which can be referred to in the above embodiments. The line segments included in the sampling set correspond to the reference line segment and the target line segment in the above embodiments.
Step 2: the object detection device takes the local sampling set as the input of the RANSAC algorithm model, and sets the iteration times of the RANSAC algorithm model.
Wherein the number of iterations may be user input. And the object detection device iteratively executes the following steps 3 to 4 according to the iteration times.
And step 3: and the object detection device randomly samples partial line segments from the local sampling set to obtain a plurality of line segments comprising the current line segment, and calculates the score of the RANSAC algorithm model, wherein the final score is an error parameter for classifying the target line segment and the reference line segment into the same object contour.
The multiple line segments including the current line segment are sample line segments, and the scores of the RANSAC algorithm model are target parameters corresponding to the sample line segments.
When the object detection device determines the score of the RANSAC algorithm model, the following three scores need to be calculated firstly:
1) Proportional constraint score (proportional constraint parameter).
The object detection device calculates the ratio of the length of each line segment to the maximum length from the termination end point of the line segment to the optical center. Since the inputs to the RANSAC algorithm model contain at least two line segments, there must be at least two proportional values. And calculating a corresponding proportion constraint score through a formula 1/(1 + exp (-var (disti/distio))), wherein exp () is an exponential function taking a natural constant as a base, var () is a variance function, disti represents the length of the line segment, and distio represents the maximum distance from the end point of the line segment to the optical center, namely the distance from the end point of the line segment to the optical center.
2) Distance constraint score (distance constraint parameter).
The object detection device determines the sequence of a plurality of line segments input into the RANSAC algorithm model, and the shortest distance from the line segments to the optical center is obtained after the starting end points of the line segments are connected in sequence.
3) And an angle constraint score (angle constraint parameter).
The object detection device calculates the included angle formed by the starting end point of the current line segment and the ending end point of the line segment to the optical center.
And 4, step 4: and determining weights corresponding to different scores according to the operation scene of the algorithm, applying the weights to each constraint score, and obtaining a final score.
And 5: and 3, after the iteration of the step 3 to the step 4 is finished, taking the RANSAC algorithm model with the lowest score in multiple iterations as the final RANSAC algorithm model of the current segment, if the score of the model is smaller than a set threshold value, indicating that the model exists, and otherwise, indicating that the model exists.
Step 6: and if the model exists, removing the line segment set in the current final RANSAC algorithm model from the initial line segment set, and marking the line segments in the set as deleted.
And 7: s1004 is repeatedly executed, and the next line segment is processed using the RANSAC algorithm model.
S1008: the object detection device performs object detection based on the divided line segment sets.
The object detection device back-projects all line segment sets in the RANSAC algorithm model meeting the conditions to the image plane of the first target image, and determines the position of at least one target object in the first target image according to the obtained projected line segments.
For the specific implementation of the above steps, reference may be made to the implementation manner in the object detection method provided in fig. 1, and repeated descriptions are omitted.
In the above embodiment, by introducing the camera calibration information, a homography matrix required for IPM conversion from the image plane to the ideal ground plane is constructed, and the geometric attributes of the object in the original image frame are restored and strengthened, wherein the restoration is mainly performed on the landmarks located in the ground plane, such as lane lines, sidewalks, and the like, and the contour of the object with height is significantly elongated. Therefore, under the new data expression form, the RANSAC algorithm is more beneficial to screening of the model. In the embodiment, the significant affine geometric features formed by the objects in the image after IPM transformation are fully utilized, particularly for higher and farther targets, the contour formed by the objects on the aerial view is close to or passes through the optical center, and the contour corresponding to the height of the object is significantly elongated, and based on the geometric constraints, the contour of the target object is iteratively screened through a semi-random RANSAC algorithm and a self-defined contour model and evaluation terms. Meanwhile, the method can measure the distance according to the camera calibration information, integrates the detection and distance measurement algorithms, and integrates the detection and distance measurement into the same iterative model, so that the distance information and the detection information can be returned at the same time, and the overall flow of the algorithm is simplified. In addition, the algorithm uses a light classifier to delete the contour points of the road surface area, so that the efficiency of the algorithm can be improved.
EXAMPLE III
Fig. 11 is a schematic flowchart of an object detection method according to an embodiment of the present application. The process of the method is explained by dividing a line segment set by using an RANSAC algorithm model into examples, and relates to an algorithm overall iteration process and a process for screening a candidate line segment set by using the RANSAC algorithm model. The RANSAC algorithm model randomly samples local line segments, and scores each group of sampling line segment sets by using proportion constraint, texture constraint, distance constraint and angle constraint based on the specific geometric characteristics of the object contour to obtain divided line segment sets.
As shown in fig. 11, the flow of the method includes:
s1100: the image acquisition device acquires a current image frame.
The image acquisition device acquires a current image frame by shooting an image, takes the current image frame as a first target image and sends the first target image to the object detection device. Wherein the image acquisition device may be a camera.
S1101: the object detection apparatus performs IPM conversion on the current image frame.
The object detection device performs IPM transformation on a current image frame, namely a first target image, through a homography matrix, so that the conversion from an image plane of the first target image to an ideal ground plane is realized, and a second target image is obtained, wherein the second target image is a bird's-eye view.
S1102: the object detecting device obtains a profile.
And the object detection device finishes the extraction of the initial contour points in the second target image by using an edge contour detection algorithm based on a Canny operator to obtain a contour map containing a plurality of contour points.
S1103: the object detection device performs meshing on the contour map.
The object detection device divides the contour map, i.e., the second target image, into meshes of a set size.
S1104: the object detection device deletes the road surface area contour points using the classifier.
The object detection device performs preliminary filtering of road surface pixels using a lightweight road surface classifier, and deletes contour points in a region classified as a road surface.
The image processed in the following steps is an image of deleting contour points in the road surface area determined according to the classification result of the road surface classifier and the contour map.
S1105: the object detection device acquires an initial line segment candidate set.
And the object detection device performs linear detection on the plurality of contour points based on Hough transform to obtain a plurality of contour line segments, selects a plurality of line segments of which the straight lines pass through a set target point from the plurality of contour line segments, and takes the plurality of line segments as an initial line segment candidate set.
S1106: the object detection device traverses the RANSAC algorithm model counterclockwise through the line segments in the initial line segment candidate set.
And the object detection device carries out reverse-time needle sequencing on the line segments according to the starting end points of the line segments. The starting point is defined as a segment of the line segment that is closer to the optical center, i.e., the detection algorithm traverses the line segment counterclockwise.
Wherein, the detection algorithm can be realized by a RANSAC algorithm model.
S1107: and the object detection device screens the RANSAC algorithm model to realize the segment set division of the initial segment candidate concentrated segments.
In this step, the object detecting apparatus traverses each line segment counterclockwise by using a RANSAC algorithm model, wherein the RANSAC algorithm model includes the steps of:
step 1: and taking the current line segment currently processed and other line segments which are adjacent left and right and do not exceed a set angle range as a local sampling set of the RANSAC algorithm model.
The current line segment is a reference line segment, and the range where the left and right adjacent current line segments do not exceed the set angle refers to the range of the set angle around the auxiliary line segment obtained by connecting the starting end point and the target point of the current line segment, which can be referred to in the above embodiments. The line segments included in the sampling set correspond to the reference line segment and the target line segment in the above embodiments.
And 2, step: the object detection device takes the local sampling set as the input of the RANSAC algorithm model, and sets the iteration times of the RANSAC algorithm model.
Wherein the number of iterations may be user input. And the object detection device iteratively executes the following steps 3 to 4 according to the iteration times.
And step 3: and the object detection device randomly samples a part of line segments from the local sampling set to obtain a plurality of line segments comprising the current line segment, and calculates the score of the RANSAC algorithm model, wherein the final score is the error parameter for classifying the target line segment and the reference line segment into the same object contour.
The multiple line segments including the current line segment are sample line segments, and the scores of the RANSAC algorithm model are target parameters corresponding to the sample line segments.
When the object detection device determines the score of the RANSAC algorithm model, the following four scores need to be calculated:
1) Proportional constraint score (proportional constraint parameter).
The object detection device calculates the ratio of the length of each line segment to the maximum length from the end point of the line segment to the optical center. Since the inputs to the RANSAC algorithm model contain at least two line segments, there must be at least two proportional values. And calculating a corresponding proportion constraint score through a formula 1/(1 + exp (-var (disti/distio))), wherein exp () is an exponential function taking a natural constant as a base, var () is a variance function, disti represents the length of the line segment, and distio represents the maximum distance from the end point of the line segment to the optical center, namely the distance from the end point of the line segment to the optical center.
2) Texture constraint score (texture constraint parameter).
The object detection device is sequentially connected with the starting end points of all line segments according to the sequence of the line segments input into the RANSAC algorithm model to obtain at least one line segment, the texture orientation of all points contained in the at least one line segment is solved by utilizing a wavelet operator, and the variance of the texture orientation of the points is calculated.
When the object detection device determines the texture orientation of any end point, the texture orientation of the pixel point corresponding to the end point in the source image, i.e. the first target image, is used as the texture orientation of the end point.
3) Distance constraint score (distance constraint parameter).
The object detection device determines the sequence of a plurality of line segments input into the RANSAC algorithm model, and the shortest distance from the line segments to the optical center is obtained after the starting end points of the line segments are connected in sequence.
4) Angle constraint score (angle constraint parameter).
The object detection device calculates the included angle formed by the starting end point of the current line segment and the ending end point of the line segment to the optical center.
And 4, step 4: and determining weights corresponding to different scores according to the operation scene of the algorithm, applying the weights to each constraint score, and obtaining a final score.
And 5: and 3, after the iteration of the step 3 to the step 4 is finished, taking the RANSAC algorithm model with the lowest score in multiple iterations as the final RANSAC algorithm model of the current line segment, if the score of the model is smaller than a set threshold value, indicating that the model exists, and otherwise, indicating that the model exists.
And 6: and if the model exists, removing the line segment set in the current final RANSAC algorithm model from the initial line segment set, and marking the line segments in the set as deleted.
And 7: s1104 is repeatedly executed, and the next line segment is processed using the RANSAC algorithm model.
S1108: the object detection device performs object detection based on the divided line segment sets.
The object detection device back-projects all line segment sets in the RANSAC algorithm model meeting the conditions to the image plane of the first target image, and determines the position of at least one target object in the first target image according to the obtained projected line segments.
In the above embodiment, by introducing the camera calibration information, a homography matrix required for IPM conversion from the image plane to the ideal ground plane is constructed, and the geometric attributes of the object in the original image frame are restored and strengthened, wherein the restoration is mainly performed on the landmarks located in the ground plane, such as lane lines, sidewalks, and the like, and the contour of the object with height is significantly elongated. Therefore, under the new data expression form, the RANSAC algorithm is more beneficial to screening of the model. In the embodiment, the significant affine geometric features formed by the objects in the image after IPM transformation are fully utilized, particularly for higher and farther targets, the contour formed by the objects on the aerial view is close to or passes through the optical center, and the contour corresponding to the height of the object is significantly elongated, and based on the geometric constraints, the contour of the target object is iteratively screened through a semi-random RANSAC algorithm and a self-defined contour model and evaluation terms. Meanwhile, the method can carry out distance measurement according to the camera calibration information, integrates the detection and distance measurement algorithms, and integrates the detection and distance measurement into the same iterative model, so that the distance information and the detection information can be returned simultaneously, and the whole flow of the algorithm is simplified. In addition, the algorithm uses a light classifier to delete the contour points of the road surface area, and the efficiency of the algorithm can be improved.
Based on the above embodiments and the same concept, the embodiments of the present application further provide an object detection apparatus, as shown in fig. 12, the object detection apparatus 1200 may include: perspective transformation unit 1201, image processing unit 1202, selection unit 1203, division unit 1204, and positioning unit 1205.
The perspective transformation unit 1201 is configured to perform inverse perspective transformation on a first target image to obtain a second target image, where the first target image is an image captured of a scene including at least one target object, and the second target image is an image obtained after the first target image is mapped to a target plane.
The image processing unit 1202 is configured to perform contour extraction processing on the second target image, and obtain a plurality of contour line segments in the second target image.
The selecting unit 1203 is configured to select, from the plurality of contour line segments, a plurality of line segments in which a straight line where the line segment passes through a set target point.
The dividing unit 1204 is configured to divide the plurality of line segments into at least one line segment set according to the positions of the plurality of line segments in the second target image, where different line segment sets include different line segments, and any one line segment set includes at least two line segments of the plurality of line segments; for each set of line segments, performing the steps of: and projecting at least two line segments contained in the target line segment set to the first target image to obtain at least two projected line segments.
The positioning unit 1205 is configured to determine a position of a target object in the first target image according to the at least two projection line segments, where the target line segment sets are each line segment set.
In one possible design, the object detection apparatus 1200 further includes an acquisition unit 1206, and the acquisition unit 1206 is configured to acquire the first target image.
In a possible design, when the dividing unit 1204 divides the plurality of line segments into at least one line segment set according to the positions of the plurality of line segments in the second target image, specifically, the dividing unit is configured to: sequencing the line segments according to the positions of the starting endpoints of the line segments in the second target image, wherein the starting endpoint of any line segment is the endpoint which is closest to the target point in the two endpoints of the line segment; according to the sequence of the line segments, selecting a line segment which is not divided into a line segment set as a reference line segment in sequence, and executing the following dividing process on the reference line segment: taking other line segments of the plurality of line segments except the reference line segment and the line segment which is divided into a line segment set as line segments to be branched; determining a target line segment, of the line segments to be divided, wherein an included angle between the target line segment and the reference line segment is smaller than a set threshold, and the target line segment comprises at least one line segment; calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour; when the error parameter is smaller than or equal to a set threshold value, dividing the target line segment and the reference line segment into the same line segment set; and when the error parameter is larger than the set threshold, the target line segment and the reference line segment are not divided into the same line segment set, and the dividing process is finished.
In a possible design, when the dividing unit 1204 sorts the line segments according to the positions of the starting endpoints of the line segments in the second target image, it is specifically configured to: and sequencing the line segments according to the position distribution sequence of the starting endpoints of the line segments in the second target image in the clockwise or anticlockwise direction.
In a possible design, when the dividing unit 1204 calculates an error parameter for classifying the target line segment and the reference line segment into the same object contour, it is specifically configured to: and calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour according to a set data model, wherein the set data model is used for calculating errors existing when a plurality of line segments are classified into the same object contour.
In a possible design, when the dividing unit 1204 calculates an error parameter for classifying the target line segment and the reference line segment into the same object contour, it is specifically configured to: performing multiple calculation processes on the target line segment and the reference line segment to obtain multiple alternative error parameters; wherein, each calculation process comprises the following steps: randomly selecting at least one line segment from the target line segments; taking the reference line segment and at least one line segment randomly selected from the target line segments as sample line segments; calculating target parameters corresponding to the sample line segments, and determining alternative error parameters according to the target parameters; wherein the target parameter is: comprises at least one parameter for characterizing the geometric distribution of the sample line segments; determining a minimum value of the plurality of candidate error parameters; and taking the minimum value as an error parameter for classifying the target line segment and the reference line segment into the same object contour.
In one possible design, the sample line segment includes a plurality of first line segments; the target parameter comprises at least one of: a parameter with a value of 1/(1 + exp (-x)), where exp () is an exponential function with a natural constant as a base, x is a variance of a scaling parameter of the plurality of first line segments, the scaling parameter of any one first line segment is a ratio between a length of the first line segment and a distance from a termination endpoint of the first line segment to the target point, and the termination endpoint of any one first line segment is one of two endpoints of the first line segment that is farthest from the target point; the variance of texture direction values of all points contained in at least one second line segment is obtained by sequentially connecting starting end points of the plurality of first line segments according to the sequence of the plurality of first line segments in the plurality of line segments; the distance between one line segment which is closest to the target point in at least one second line segment and the target point is the line segment obtained by sequentially connecting the starting end points of the plurality of first line segments according to the sequence of the plurality of first line segments in the plurality of line segments; and respectively connecting the two end points of the reference line segment with the target point to obtain an included angle between the two line segments.
In a possible design, the image processing unit 1202 performs contour extraction processing on the second target image, and when a plurality of contour line segments are obtained in the second target image, is specifically configured to: carrying out edge contour detection on the second target image to obtain a plurality of contour points in the second target image; and obtaining the plurality of contour line segments according to the plurality of contour points.
In a possible design, when the image processing unit 1202 obtains the plurality of contour line segments according to the plurality of contour points, it is specifically configured to: filtering the plurality of contour points to obtain a plurality of target contour points; performing linear detection on the plurality of target contour points to obtain a plurality of contour line segments; or carrying out straight line detection on the plurality of contour points to obtain a plurality of contour line segments.
In one possible design, when the image processing unit 1202 filters the contour points, it is specifically configured to: dividing an image area of the second target image into a plurality of grids according to the set grid size; classifying the objects displayed in the plurality of grids by using a set classifier; and if the type of the object displayed in the target grid is a set type in the grids, deleting the contour points in the target grid.
In the embodiment of the present application, the division of the unit is schematic, and is only a logical function division, and in actual implementation, there may be another division manner, and in addition, each functional unit in each embodiment of the present application may be integrated in one processor or controller, may also exist alone physically, or may be integrated in one unit by two or more units. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
For example, the perspective transformation unit 1201, the image processing unit 1202, the selection unit 1203, the division unit 1204, and the positioning unit 1205 may be different processors or controllers, respectively; or the perspective transformation unit 1201, the image processing unit 1202, the selection unit 1203, the division unit 1204, and the positioning unit 1205 may be the same processor or controller; alternatively, some functional units of the perspective transformation unit 1201, the image processing unit 1202, the selection unit 1203, the division unit 1204, and the positioning unit 1205 may be integrated into one processor or controller, and another functional unit may be integrated into another processor or controller.
The processor or controller may be, for example, a general-purpose Central Processing Unit (CPU), a general-purpose processor, a Digital Signal Processing (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, transistor logic, hardware components, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, etc. described in connection with the disclosure herein. A processor may also be a combination of computing functions, e.g., comprising one or more microprocessors, a DSP and a microprocessor, or the like.
The acquiring unit 1206 may be an interface circuit of the object detecting device 1200, and is used for receiving data from other devices, for example, receiving the first target image sent by the image capturing device. When the object detection apparatus is implemented in the form of a chip, the obtaining unit 1206 may be an interface circuit of the chip for receiving data from or transmitting data to other chips or apparatuses.
Only one or more of the various elements of fig. 12 may be implemented in software, hardware, firmware, or a combination thereof. The software or firmware includes, but is not limited to, computer program instructions or code and may be executed by a hardware processor. The hardware includes, but is not limited to, various integrated circuits such as a Central Processing Unit (CPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), or an Application Specific Integrated Circuit (ASIC).
Based on the above embodiments and the same concept, the embodiments of the present application further provide an object detection apparatus for implementing the obstacle detection method provided by the embodiments of the present application. As shown in fig. 13, the object detection apparatus 1300 may include: one or more processors 1301, memory 1302, and one or more computer programs (not shown).
As one implementation, the above devices may be coupled by one or more communication lines 1303. Wherein the memory 1302 has stored therein one or more computer programs, the one or more computer programs comprising instructions; the processor 1301 invokes the instructions stored in the memory 1302, so that the object detection apparatus 1300 executes the object detection method provided by the embodiment of the application.
In the embodiments of the present application, the processor may be a general processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic blocks disclosed in the embodiments of the present application. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in a processor.
In embodiments of the present application, the memory may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. Volatile memory can be Random Access Memory (RAM), which acts as external cache memory. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate SDRAM, enhanced SDRAM, SLDRAM, synchronous Link DRAM (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory. The memory in the embodiments of the present application may also be a circuit or any other device capable of implementing a storage function.
As one implementation, the object detection apparatus 1300 may further include a communication interface 1304 for communicating with other apparatuses via a transmission medium, for example, the communication interface 1304 may receive the first target image from the image capturing apparatus. In embodiments of the present application, the communication interface may be a transceiver, circuit, bus, module, or other type of communication interface. In the embodiment of the present application, when the communication interface is a transceiver, the transceiver may include an independent receiver and an independent transmitter; a transceiver that integrates transceiving functions, or an interface circuit may be used.
In some embodiments of the present application, the processor 1301, the memory 1302, and the communication interface 1304 may be connected to each other through a communication line 1303; the communication line 1303 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication line 1303 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 13, but this is not intended to represent only one bus or type of bus.
The method provided by the embodiment of the present application may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, a network appliance, a user device, or other programmable apparatus. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL), or wireless (e.g., infrared, wireless, microwave, etc.).
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (20)

1. An object detection method, comprising:
performing inverse perspective transformation processing on a first target image to obtain a second target image, wherein the first target image is an image shot for a scene containing at least one target object, and the second target image is an image obtained after the first target image is mapped to a target plane;
contour line extraction processing is carried out on the second target image, and a plurality of contour line segments are obtained in the second target image;
selecting a plurality of line segments of which the straight lines pass through a set target point from the plurality of contour line segments;
dividing the line segments into at least one line segment set according to the positions of the line segments in the second target image, wherein the line segments contained in different line segment sets are different, and any line segment set contains at least two line segments in the line segments;
for each set of line segments, performing the steps of: projecting at least two line segments contained in a target line segment set into the first target image to obtain at least two projected line segments; and determining the position of a target object in the first target image according to the at least two projection line segments, wherein the target line segment sets are each line segment set.
2. The method of claim 1, wherein dividing the plurality of line segments into at least one set of line segments according to the locations of the plurality of line segments in the second target image comprises:
sequencing the line segments according to the positions of the starting endpoints of the line segments in the second target image, wherein the starting endpoint of any line segment is the endpoint which is closest to the target point in the two endpoints of the line segment;
according to the sequence of the line segments, selecting a line segment which is not divided into a line segment set as a reference line segment in sequence, and executing the following dividing process on the reference line segment:
taking other line segments of the plurality of line segments except the reference line segment and the line segment which is divided into a line segment set as line segments to be branched;
determining a target line segment, of the line segments to be divided, wherein an included angle between the target line segment and the reference line segment is smaller than a set threshold, and the target line segment comprises at least one line segment;
calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour;
when the error parameter is smaller than or equal to a set threshold value, dividing the target line segment and the reference line segment into the same line segment set;
and when the error parameter is larger than the set threshold, the target line segment and the reference line segment are not divided into the same line segment set, and the dividing process is finished.
3. The method of claim 2, wherein sorting the plurality of line segments according to their starting endpoints in the position of the second target image comprises:
and sequencing the line segments according to the position distribution sequence of the starting endpoints of the line segments in the second target image in the clockwise or anticlockwise direction.
4. The method of claim 2 or 3, wherein calculating an error parameter that classifies the target line segment and the reference line segment to the same object contour comprises:
and calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour according to a set data model, wherein the set data model is used for calculating errors existing when a plurality of line segments are classified into the same object contour.
5. The method of claim 2 or 3, wherein calculating an error parameter that classifies the target line segment and the reference line segment to the same object contour comprises:
performing multiple calculation processes on the target line segment and the reference line segment to obtain multiple alternative error parameters; wherein, each calculation process comprises the following steps: randomly selecting at least one line segment from the target line segments; taking the reference line segment and at least one line segment randomly selected from the target line segments as sample line segments; calculating target parameters corresponding to the sample line segments, and determining alternative error parameters according to the target parameters; wherein the target parameter is: comprises at least one parameter for characterizing the geometric distribution of the sample line segments;
determining a minimum value of the plurality of candidate error parameters;
and taking the minimum value as an error parameter for classifying the target line segment and the reference line segment into the same object contour.
6. The method of claim 5, wherein the sample line segments comprise a plurality of first line segments; the target parameter comprises at least one of:
a parameter with a value of 1/(1 + exp (-x)), where exp () is an exponential function with a natural constant as a base, x is a variance of a scaling parameter of the plurality of first line segments, the scaling parameter of any one first line segment is a ratio between a length of the first line segment and a distance from a termination endpoint of the first line segment to the target point, and the termination endpoint of any one first line segment is one endpoint of two endpoints of the first line segment that is farthest from the target point;
the variance of texture direction values of all points contained in at least one second line segment is obtained by sequentially connecting starting end points of the plurality of first line segments according to the sequence of the plurality of first line segments in the plurality of line segments;
a distance between one of the at least one second line segment that is closest to the target point and the target point;
and respectively connecting the two end points of the reference line segment with the target point to obtain an included angle between the two line segments.
7. The method according to any one of claims 1 to 6, wherein performing contour extraction processing on the second target image to obtain a plurality of contour line segments in the second target graphic includes:
performing edge contour detection on the second target image to obtain a plurality of contour points in the second target image;
and obtaining the plurality of contour line segments according to the plurality of contour points.
8. The method of claim 7, wherein deriving the plurality of contour segments from the plurality of contour points comprises:
filtering the plurality of contour points to obtain a plurality of target contour points; performing linear detection on the plurality of target contour points to obtain a plurality of contour line segments; or
And carrying out straight line detection on the plurality of contour points to obtain a plurality of contour line segments.
9. The method of claim 8, wherein filtering the plurality of contour points comprises:
dividing an image area of the second target image into a plurality of grids according to the set grid size;
classifying the objects displayed in the plurality of grids by using a set classifier;
and if the type of the object displayed in the target grid is a set type in the grids, deleting the contour points in the target grid.
10. An object detection device, comprising:
the perspective transformation unit is used for performing inverse perspective transformation processing on a first target image to obtain a second target image, wherein the first target image is an image shot for a scene containing at least one target object, and the second target image is an image obtained after the first target image is mapped to a target plane;
the image processing unit is used for carrying out contour line extraction processing on the second target image and obtaining a plurality of contour line segments in the second target image;
the selection unit is used for selecting a plurality of line segments of which the straight lines pass through a set target point from the plurality of contour line segments;
the dividing unit is used for dividing the line segments into at least one line segment set according to the positions of the line segments in the second target image, wherein the line segments contained in different line segment sets are different, and any line segment set contains at least two line segments in the line segments;
a positioning unit configured to perform the following steps for each segment set: projecting at least two line segments contained in a target line segment set to the first target image to obtain at least two projected line segments; and determining the position of a target object in the first target image according to the at least two projection line segments, wherein the target line segment sets are each line segment set.
11. The object detection device according to claim 10, wherein the dividing unit is configured to, when dividing the plurality of line segments into at least one set of line segments according to the positions of the plurality of line segments in the second target image, specifically:
sorting the line segments according to the positions of the starting endpoints of the line segments in the second target image, wherein the starting endpoint of any line segment is the endpoint which is closest to the target point in the two endpoints of the line segment;
according to the sequence of the line segments, selecting a line segment which is not divided into a line segment set as a reference line segment in sequence, and executing the following dividing process on the reference line segment:
taking other line segments of the plurality of line segments except the reference line segment and the line segment which is divided into a line segment set as line segments to be branched;
determining a target line segment, of the line segments to be divided, wherein an included angle between the target line segment and the reference line segment is smaller than a set threshold, and the target line segment comprises at least one line segment;
calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour;
when the probability value is less than or equal to a set threshold value, dividing the target line segment and the reference line segment into the same line segment set;
and when the error parameter is greater than the set threshold value, the target line segment and the reference line segment are not divided into the same line segment set, and the dividing process is finished.
12. The object detection device according to claim 11, wherein the dividing unit is specifically configured to, when sorting the plurality of line segments according to positions of starting end points of the plurality of line segments in the second target image:
and sequencing the line segments according to the position distribution sequence of the starting end points of the line segments in the second target image in the clockwise or anticlockwise direction.
13. The object detection device according to claim 11 or 12, wherein the dividing unit is configured to, when calculating the error parameter for classifying the target line segment and the reference line segment into the same object contour, specifically:
and calculating an error parameter for classifying the target line segment and the reference line segment into the same object contour according to a set data model, wherein the set data model is used for calculating errors existing when a plurality of line segments are classified into the same object contour.
14. The object detection device according to claim 11 or 12, wherein the dividing unit is configured to, when calculating the error parameter for classifying the target line segment and the reference line segment into the same object contour, specifically:
executing multiple calculation processes on the target line segment and the reference line segment to obtain multiple alternative error parameters; wherein, each calculation process comprises the following steps: randomly selecting at least one line segment from the target line segments; taking the reference line segment and at least one line segment randomly selected from the target line segments as sample line segments; calculating target parameters corresponding to the sample line segments, and determining alternative error parameters according to the target parameters; wherein the target parameter is: comprises at least one parameter for characterizing the geometric distribution of the sample line segments;
determining a minimum value of the plurality of candidate error parameters;
and taking the minimum value as an error parameter for classifying the target line segment and the reference line segment into the same object contour.
15. The object detecting device according to claim 14, wherein the sample line segment includes a plurality of first line segments; the target parameter comprises at least one of:
a parameter with a value of 1/(1 + exp (-x)), where exp () is an exponential function with a natural constant as a base, x is a variance of a scaling parameter of the plurality of first line segments, the scaling parameter of any one first line segment is a ratio between a length of the first line segment and a distance from a termination endpoint of the first line segment to the target point, and the termination endpoint of any one first line segment is one of two endpoints of the first line segment that is farthest from the target point;
the variance of the texture direction values of all points contained in at least one second line segment is obtained by sequentially connecting the starting end points of the plurality of first line segments according to the sequence of the plurality of first line segments in the plurality of line segments;
a distance between one of the at least one second line segment that is closest to the target point and the target point;
and respectively connecting the two end points of the reference line segment with the target point to obtain an included angle between the two line segments.
16. The object detection device according to any one of claims 10 to 15, wherein the image processing unit performs contour extraction processing on the second target image, and when a plurality of contour line segments are obtained in the second target image, is specifically configured to:
carrying out edge contour detection on the second target image to obtain a plurality of contour points in the second target image;
and obtaining the plurality of contour line segments according to the plurality of contour points.
17. The object detecting device according to claim 16, wherein when the image processing unit obtains the plurality of contour line segments from the plurality of contour points, the image processing unit is specifically configured to:
filtering the plurality of contour points to obtain a plurality of target contour points; performing linear detection on the plurality of target contour points to obtain a plurality of contour line segments; or
And carrying out straight line detection on the plurality of contour points to obtain a plurality of contour line segments.
18. The object detecting device according to claim 17, wherein when the image processing unit filters the plurality of contour points, it is specifically configured to:
dividing the image area of the second target image into a plurality of grids according to the set grid size;
classifying the objects displayed in the plurality of grids by using a set classifier;
and if the type of the object displayed in the target grid is a set type in the grids, deleting the contour points in the target grid.
19. An object detection device comprising a memory and a processor;
the memory is used for storing a computer program;
the processor is configured to execute the computer program stored in the memory to implement the method according to any one of claims 1 to 9.
20. A computer-readable storage medium, characterized in that it stores a computer program which, when run on an object detection apparatus, causes the object detection apparatus to perform the method according to any one of the preceding claims 1 to 9.
CN202110333573.6A 2021-03-29 2021-03-29 Object detection method and device Pending CN115147803A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110333573.6A CN115147803A (en) 2021-03-29 2021-03-29 Object detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110333573.6A CN115147803A (en) 2021-03-29 2021-03-29 Object detection method and device

Publications (1)

Publication Number Publication Date
CN115147803A true CN115147803A (en) 2022-10-04

Family

ID=83404240

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110333573.6A Pending CN115147803A (en) 2021-03-29 2021-03-29 Object detection method and device

Country Status (1)

Country Link
CN (1) CN115147803A (en)

Similar Documents

Publication Publication Date Title
CN111553859B (en) Laser radar point cloud reflection intensity completion method and system
US10699134B2 (en) Method, apparatus, storage medium and device for modeling lane line identification, and method, apparatus, storage medium and device for identifying lane line
CN110136182B (en) Registration method, device, equipment and medium for laser point cloud and 2D image
WO2022126377A1 (en) Traffic lane line detection method and apparatus, and terminal device and readable storage medium
US11521311B1 (en) Collaborative disparity decomposition
EP2811423B1 (en) Method and apparatus for detecting target
US8199977B2 (en) System and method for extraction of features from a 3-D point cloud
US10521694B2 (en) 3D building extraction apparatus, method and system
CN109658454B (en) Pose information determination method, related device and storage medium
CN111222395A (en) Target detection method and device and electronic equipment
CN109872366B (en) Method and device for detecting three-dimensional position of object
CN114782499A (en) Image static area extraction method and device based on optical flow and view geometric constraint
US20200191971A1 (en) Method and System for Vehicle Detection Using LIDAR
WO2023016082A1 (en) Three-dimensional reconstruction method and apparatus, and electronic device and storage medium
CN115147333A (en) Target detection method and device
CN113255444A (en) Training method of image recognition model, image recognition method and device
CN115147328A (en) Three-dimensional target detection method and device
CN115187941A (en) Target detection positioning method, system, equipment and storage medium
CN115100616A (en) Point cloud target detection method and device, electronic equipment and storage medium
CN114120254A (en) Road information identification method, device and storage medium
EP4287137A1 (en) Method, device, equipment, storage media and system for detecting drivable space of road
CN112288817B (en) Three-dimensional reconstruction processing method and device based on image
CN115147803A (en) Object detection method and device
Borisagar et al. Census and segmentation-based disparity estimation algorithm using region merging
CN113255405A (en) Parking space line identification method and system, parking space line identification device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination