CN112927201A - Curve detection method and device - Google Patents
Curve detection method and device Download PDFInfo
- Publication number
- CN112927201A CN112927201A CN202110205455.7A CN202110205455A CN112927201A CN 112927201 A CN112927201 A CN 112927201A CN 202110205455 A CN202110205455 A CN 202110205455A CN 112927201 A CN112927201 A CN 112927201A
- Authority
- CN
- China
- Prior art keywords
- foreground
- sample
- curve
- points
- samples
- 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.)
- Granted
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 88
- 230000003044 adaptive effect Effects 0.000 claims abstract description 90
- 238000000034 method Methods 0.000 claims abstract description 32
- 238000005070 sampling Methods 0.000 claims description 108
- 230000006978 adaptation Effects 0.000 claims description 19
- 238000010606 normalization Methods 0.000 claims description 10
- 230000000877 morphologic effect Effects 0.000 claims description 7
- 238000012545 processing Methods 0.000 claims description 4
- 230000002123 temporal effect Effects 0.000 claims description 4
- 238000007689 inspection Methods 0.000 description 5
- 230000007613 environmental effect Effects 0.000 description 4
- 230000014509 gene expression Effects 0.000 description 3
- 238000010276 construction Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000011002 quantification Methods 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000002547 anomalous effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 238000012417 linear regression Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000003908 quality control method Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
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 discloses a curve detection method and device. In the method, foreground points in a foreground point set are sampled to obtain a sample set; the samples in the sample set comprise a first preset number of foreground points; obtaining a curve corresponding to the sample according to the positions of foreground points contained in the sample; obtaining an adaptive value of a sample according to the relative position of each foreground point and the curve in the foreground point set; and determining a target curve according to the adaptive value of each sample in the sample set. Compared with the traditional algorithm, the time complexity and the space complexity of the curve detection method are greatly reduced, the speed is high, and the curve detection method can run in real time. In addition, the curve detection precision is high, and the optimal solution can be found with great probability. Compared with a curve detection method based on Hough transform and a curve detection method based on a least square method in a parabolic detection scene, the method and the device have the advantages that detection accuracy is kept, and meanwhile, the method and the device have better robustness, and therefore the method and the device have obvious advantages.
Description
Technical Field
The present application relates to the field of computer vision technologies, and in particular, to a method and an apparatus for detecting a curve.
Background
In the field of computer vision technology, identifying object features is a very critical study. In application scenarios such as target tracking, target positioning, product quality control, factory automation, etc., curve detection needs to be performed based on sensor detection results.
The existing curve detection algorithm is based on Hough transform curve detection, the algorithm converts the problem of curve detection from a coordinate space of a point to a parameter space of a curve equation, and the problem of overhigh space and event complexity caused by overlarge parameter space is faced in practical application, so that the detection accuracy is higher, but the operation speed is slower, and the real-time operation is difficult. Another existing curve detection algorithm is a curve detection based on the least squares method. The algorithm treats the curve fitting problem as a linear regression problem, solves the problem by using a least square method, is high in speed, but is low in detection precision and easy to be influenced by noise points. From the two detection methods, it is not difficult to find that the accuracy problem and the speed problem are difficult to balance when curve detection is carried out at present, so that rapid and accurate curve detection cannot be realized.
Disclosure of Invention
Based on the above problems, the present application provides a curve detection method and apparatus to improve the speed and accuracy of curve detection.
The embodiment of the application discloses the following technical scheme:
the application provides a curve detection method in a first aspect, which includes:
sampling foreground points in the foreground point set to obtain a sample set; the samples in the sample set comprise a first preset number of foreground points;
obtaining a curve corresponding to the sample according to the position of the foreground point contained in the sample;
obtaining an adaptive value of the sample according to the relative position of each foreground point in the foreground point set and the curve;
and determining a target curve according to the adaptive value of each sample in the sample set.
Optionally, the obtaining an adaptive value of the sample according to a relative position of each foreground point in the foreground point set and the curve includes:
obtaining the distance between each foreground point and the curve according to the relative position of each foreground point and the curve in the foreground point set;
comparing the distance between each foreground point and the curve with a preset distance threshold value respectively;
and recording the number of foreground points in the foreground point set, the distance between which and the curve is less than the preset distance threshold value, as an adaptive value of the sample.
Optionally, the determining a target curve according to the adaptive value of each sample in the sample set includes:
and determining the curve corresponding to the sample with the maximum adaptive value in the samples as the target curve.
Optionally, the determining a target curve according to the adaptive value of each sample in the sample set includes:
when a preset cut-off condition is met, determining a curve corresponding to a sample with the maximum adaptive value in the past iteration as the target curve;
when the preset cutoff condition is not met, determining a second preset number of samples with larger adaptive values according to the adaptive values of the samples; updating the sampling probability of foreground points contained in the first preset number of samples with larger adaptive values; the updated sampling probabilities are used to sample foreground points in the foreground point set in the next iteration.
Optionally, the preset cutoff condition includes:
the iteration times reach a third preset number; or, continuously iterating the fourth preset number of times to determine that the samples with the maximum adaptive values are consistent.
Optionally, the sampling probability of each foreground point initialization in the foreground point set is 1/X, where X is the total number of foreground points included in the foreground point set; the updating the sampling probability of the foreground points contained in the first preset number of samples with the larger adaptation values includes:
taking foreground points contained in the first preset number of samples with larger adaptive values as foreground points to be updated according to the sampling probability;
and for each foreground point with the sampling probability to be updated, counting the total times Y of the foreground points with the sampling probability to be updated appearing in the first preset number of samples with the larger adaptive value, and taking the sum of the current sampling probability of the foreground points with the sampling probability to be updated and Y/X as the sampling probability of the foreground points with the sampling probability to be updated after updating.
Optionally, after the updating of the sampling probability of the foreground point included in the first second preset number of samples with the larger adaptation value, the method further includes:
and carrying out normalization processing on the sampling probability of each foreground point in the foreground point set.
Optionally, the sampling foreground points in the foreground point set to obtain a sample set includes:
randomly sampling a first preset number of foreground points from the foreground point set according to the current sampling probability of each foreground point to obtain a sample to be detected;
when the sample to be tested meets a preset prior condition, determining that the sample to be tested is qualified, and adding the sample to be tested into the sample set;
the preset prior condition comprises: a morphological prior condition and/or a temporal prior condition.
Optionally, before the sampling of foreground points in the foreground point set, the method further comprises:
identifying all foreground points from the detection result of the sensor; the foreground points are two-dimensional data or three-dimensional data;
and constructing the foreground point set according to all the identified foreground points.
This application second aspect provides a curve detection device, includes:
the sampling module is used for sampling foreground points in the foreground point set to obtain a sample set; the samples in the sample set comprise a first preset number of foreground points;
the curve generation module is used for obtaining a curve corresponding to the sample according to the positions of foreground points contained in the sample;
the adaptive value acquisition module is used for acquiring the adaptive value of the sample according to the relative position of each foreground point in the foreground point set and the curve;
and the target curve determining module is used for determining a target curve according to the adaptive value of each sample in the sample set.
Optionally, the adaptive value obtaining module includes:
the distance acquisition unit is used for acquiring the distance between each foreground point and the curve according to the relative position of each foreground point and the curve in the foreground point set;
the comparison unit is used for comparing the distances between the foreground points and the curve with a preset distance threshold respectively;
and the adaptive value acquisition unit is used for recording the number of foreground points in the foreground point set, the distance between which and the curve is less than the preset distance threshold, as the adaptive value of the sample.
Optionally, the target curve determining module includes:
and a curve first determining unit, configured to determine, as the target curve, a curve corresponding to a sample with a largest adaptation value among the samples.
Optionally, the target curve determining module includes:
the judging unit is used for judging whether a preset cut-off condition is met or not;
a second curve determining unit, configured to determine, as the target curve, a curve corresponding to a sample with a largest adaptation value in previous iterations when the determining unit determines that the preset cutoff condition is satisfied;
the sample determining unit is used for determining a first preset number of samples with larger adaptive values according to the adaptive values of the samples when the judging unit determines that the preset cutoff condition is not met;
the updating unit is used for updating the sampling probability of foreground points contained in a first preset number of samples with larger adaptive values; the updated sampling probabilities are used to sample foreground points in the foreground point set in the next iteration.
Optionally, the preset cutoff condition includes:
the iteration times reach a third preset number; or, continuously iterating the fourth preset number of times to determine that the samples with the maximum adaptive values are consistent.
Optionally, the sampling probability of each foreground point initialization in the foreground point set is 1/X, where X is the total number of foreground points included in the foreground point set; the update unit includes:
the foreground point determining unit is used for taking foreground points contained in a first preset number of samples with larger adaptive values as foreground points to be updated according to the sampling probability;
the counting unit is used for counting the total times Y of the foreground points with the sampling probability to be updated appearing in the first preset number of samples with the larger adaptive value for the foreground points with the sampling probability to be updated;
and the sampling probability updating unit is used for taking the sum of the current sampling probability of the foreground point with the sampling probability to be updated and the Y/X as the updated sampling probability of the foreground point with the sampling probability to be updated.
Optionally, the apparatus further comprises:
and the normalization module is used for performing normalization processing on the sampling probability of each foreground point in the foreground point set.
Optionally, the sampling module includes:
the sampling unit is used for randomly sampling a first preset number of foreground points according to the current sampling probability of each foreground point in the foreground point set to obtain a sample to be detected;
the inspection unit is used for inspecting whether the sample to be inspected meets a preset prior condition or not; when the inspection unit inspects that the sample to be inspected meets the preset prior condition, determining that the sample to be inspected is qualified;
the sample set constructing unit is used for adding the qualified sample determined by the testing unit into the sample set;
the preset prior condition comprises: a morphological prior condition and/or a temporal prior condition.
Optionally, the apparatus further comprises:
the foreground point identification module is used for identifying all foreground points from the detection result of the sensor; the foreground points are two-dimensional data or three-dimensional data;
and the foreground point set construction module is used for constructing the foreground point set according to all the foreground points identified by the foreground point identification module.
Compared with the prior art, the method has the following beneficial effects:
the curve detection method provided by the application samples foreground points in a foreground point set to obtain a sample set; the samples in the sample set comprise a first preset number of foreground points; obtaining a curve corresponding to the sample according to the positions of foreground points contained in the sample; obtaining an adaptive value of a sample according to the relative position of each foreground point and the curve in the foreground point set; and determining a target curve according to the adaptive value of each sample in the sample set. Compared with the traditional algorithm, the time complexity and the space complexity of the curve detection method are greatly reduced, the speed is high, and the curve detection method can run in real time. In addition, the curve detection precision is high, and the optimal solution can be found with great probability.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flowchart of a curve detection method according to an embodiment of the present disclosure;
FIG. 2 is a flow chart of another curve detection method provided in the embodiments of the present application;
fig. 3 is a schematic structural diagram of a curve detection apparatus according to an embodiment of the present application.
Detailed Description
As described above, the current curve detection method generally cannot satisfy the dual requirements of detection speed and detection accuracy at the same time. In order to solve the problem, the inventor provides a novel curve detection method and a novel curve detection device through research. Sampling and forming a sample set on the basis of the foreground point set, calculating each sample in the sample set to obtain a curve, obtaining an adaptive value of the sample according to the relative position of the curve and the foreground point, and determining a target curve according to the adaptive value. The method meets the precision requirement and the speed requirement at the same time, can run in real time, and improves the detection accuracy.
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Method embodiment
Referring to fig. 1, the figure is a flowchart of a curve detection method provided in an embodiment of the present application. As shown in fig. 1, the curve detection method includes:
step 101: and sampling foreground points in the foreground point set to obtain a sample set.
Foreground points refer to areas that appear in the detection of the scene by the sensor that are distinct from the background. To detect curves formed by moving objects from the scene, the sensors employed may include, but are not limited to, RGB cameras, depth cameras, lidar, and the like. For a sensor forming a two-dimensional image, the foreground points are two-dimensional data; for sensors that form a three-dimensional point cloud or three-dimensional image, the foreground points are three-dimensional data.
Before this step is performed, a set of foreground points has been obtained in advance. The foreground point set can be pre-imported, and the source of the foreground point set is not limited. In addition, all foreground points can be identified from the detection result of the sensor, and a foreground point set is constructed according to the identified foreground points. In some possible implementations, if the sensor is an RGB camera, the RGB image generated by the RGB camera may be first preprocessed (e.g., binarized) and foreground points may be identified from the preprocessed image.
In this step, foreground points in the foreground point set are randomly sampled. In the sample set, each sample includes a first preset number of foreground points. Thus, the number of foreground points in the set of foreground points should not be less than the first preset number, otherwise one sample cannot be generated. And if the number of the foreground points in the foreground point set is less than a first preset number, determining that the curve cannot be detected without executing subsequent steps. As an example, the first preset number is 3.
The validity of the formed samples may also be verified prior to forming the sample set. For example, the foreground point set includes foreground points a to q, where a to q are used to distinguish codes of different foreground points, and the coding method is not limited in the embodiment of the present application. The formed sample includes: samples 1{ a, b, c }, samples 2{ b, c, f }, samples 3{ o, p, q }, etc. The samples 1-3 are all called samples to be tested. And judging whether each sample to be detected meets a preset prior condition, if so, determining that the sample to be detected is qualified in inspection, and the sample to be detected is effective and can be added into the sample set. Hereinafter, the samples in the sample set refer to samples qualified through the prior condition detection.
The a priori conditions may be determined based on the actual scene or detection requirements. In one example, the preset a priori conditions include: a morphological prior condition. For example, in the application scenario of anomalous parabolic detection, the detected curve should be open downward, so that the open downward may be used as a morphological prior condition. In another example, the preset a priori conditions include: timing prior conditions. For example, foreground points located on a curve should sequentially follow a chronological precedence relationship. Of course, the preset prior condition may also include both a morphological prior condition and a timing prior condition. Since the prior condition may be set according to an actual scene or a detection requirement, specific content of the prior condition is not limited in this embodiment.
As can be seen from the above description of the example of the prior condition, a curve passing through all foreground points in the sample can be formed during the execution of step 101 according to the positions of the foreground points in the sample. In addition, the time sequence information of the foreground points can be obtained.
In order to facilitate understanding of the curve detection method provided in the embodiment of the present application, an application scenario of the method in the following description is an abnormal parabolic detection scenario, and a foreground point is two-dimensional data.
Step 102: and obtaining a curve corresponding to the sample according to the positions of foreground points contained in the sample.
In this step, samples in the sample set need to be traversed, and a curve is obtained based on each sample. The generation of the curve is related to the position of the foreground points in the sample, requiring that the generated curve can pass through all foreground points contained in the sample.
In the sample set, each sample may contain the codes of a first preset number of foreground points. The codes of the foreground points have a mapping relation with the positions (namely coordinate information), so the positions of the foreground points can be acquired correspondingly according to the codes.
In the sample set, each sample may also specifically include respective positions of the first preset number of foreground points. By way of example, a sample is represented as { (x)i,yi),(xj,yj),(xk,yk) In which (x)i,yi),(xj,yj),(xk,yk) The coordinates of the foreground point i, the foreground point j and the foreground point k, respectively.
The parabolic equation can be expressed in the form:
y=Ax2+ Bx + C formula (1)
In the above formulas, the expressions of the parameter a, the parameter B, and the parameter C are as shown in the following formulas (2) to (4):
A=[yk*(xj-xi)+yi*(xi-xk)]/[(yi-yj)*(yi-yk)*(yj-yk)]formula (2)
B=[yk*yk*(xi-xj)+yj*yj*(xk-xi)+yi*yi*(xj-xk)]/[(yi-yj)*(yi-yk)*(yj-yk)]
Formula (3)
C=[yj*yk*(yj-yk)*xi+yk*yi*(yk-yi)*xj+yi*yj*(yi-yj)*xk]/[(yi-yj)*(yi-yk)*(yj-yk)]
Formula (4)
With reference to the above equations (2) - (4), after the positions (coordinates) of all foreground points included in the sample are known, the values of the parameters A, B and C can be obtained according to the equations (2) - (4), and then the parabolic expression in the form of the equation (1) is obtained, i.e., the curve is obtained.
Step 103: and obtaining the adaptive value of the sample according to the relative position of each foreground point and the curve in the foreground point set.
It is understood that a curve corresponding to each sample in the sample set is obtained through the above step 102. When the number of samples in the sample set is greater than 1, a plurality of curves are obtained. In order to improve the curve detection accuracy, an adaptive value of each sample needs to be obtained in the embodiment of the present application. The adaptive value serves as an index indicating the matching degree of the curve corresponding to the sample to the foreground point set. The larger the sample adaptive value is, the higher the matching degree of the curve corresponding to the sample to the foreground point set is, and the more the curve formed by the sample meets the detection precision requirement; conversely, the smaller the sample adaptive value is, the lower the matching degree of the curve corresponding to the sample to the foreground point set is, and the less the curve formed by the sample is in accordance with the detection accuracy requirement.
Ideally, the curve (i.e. the target curve) detected by executing the method of the present embodiment should pass through all foreground points in the foreground point set. In practice, however, the ideal situation is often difficult to achieve. For this reason, the accuracy requirement can be reduced to some extent. In a possible implementation manner of the step, a preset distance threshold is set, and the distance between each foreground point and the curve is obtained according to the relative position of each foreground point and the curve in the foreground point set; and comparing the distance between each foreground point and the curve with a preset distance threshold respectively, and recording the number of the foreground points, which are less than the preset distance threshold from the curve, in the foreground point set as an adaptive value of the sample. And if the distance between the foreground point and the curve is smaller than a preset distance threshold value, the curve is considered to be matched with the foreground point, and the curve passes through the foreground point.
Taking the parabolic expression in the formula (1) as an example, the distance Da between the foreground point a and the curve is expressed as:
Da=|Axa 2+Bxa+C-yaequation (5)
In the formula (5), xaIs the abscissa of the foreground point, yaIs the ordinate of the foreground point.
Step 104: and determining a target curve according to the adaptive value of each sample in the sample set.
Since the adaptive value of the sample represents the matching degree of the curve corresponding to the sample to the foreground point set, in order to ensure the curve detection accuracy, the curve corresponding to the sample with the largest adaptive value in the sample set can be directly determined as the target curve. For example, if there are 10 samples in the sample set, and the adaptive value of sample 1 is the maximum value of 8, the curve corresponding to sample 1 is taken as the target curve, and the curve detection result is obtained.
The above is the curve detection method provided in the embodiment of the present application. In the method, foreground points in a foreground point set are sampled to obtain a sample set; the samples in the sample set comprise a first preset number of foreground points; obtaining a curve corresponding to the sample according to the positions of foreground points contained in the sample; obtaining an adaptive value of a sample according to the relative position of each foreground point and the curve in the foreground point set; and determining a target curve according to the adaptive value of each sample in the sample set. Compared with the traditional algorithm, the time complexity and the space complexity of the curve detection method are greatly reduced, the speed is high, and the curve detection method can run in real time. In addition, the curve detection precision is high, and the optimal solution can be found with great probability. In a parabolic detection scene, the problem that the acquired image usually has more environmental noise, and the environmental noise may be generated by people or other objects, which brings certain difficulty to parabolic detection. Compared with a curve detection method based on Hough transform and a curve detection method based on a least square method in a parabolic detection scene, the method provided by the embodiment of the application has better robustness while maintaining the detection precision, and therefore, the method has obvious advantages.
As introduced above, in step 101, foreground points in the foreground point set need to be sampled to establish a sample set. The samples in the sample set do not coincide with each other. When the number of foreground points in the current scenery set is huge, the step 101 may be executed to make the sample set include a fifth preset number of samples. As an example, the fifth preset number is 10.
First 10 samples were obtained by random sampling. After a round of steps 102 and 103, some samples with higher adaptation values are determined. The foreground points contained in the samples with higher adaptive values have higher probability of being located in the finally optimized target curve, and the target curve can be determined more conveniently, quickly, efficiently and accurately by utilizing the foreground points. Therefore, higher sampling probability can be configured for the foreground points, the foreground points in the foreground point set are re-sampled according to the updated sampling probability, and samples with high adaptive values possibly existing are continuously searched. Based on the idea, an implementation of another curve detection method is described below with reference to the embodiment and fig. 2.
Referring to fig. 2, the figure is a flowchart of another curve detection method provided in the embodiment of the present application. As shown in fig. 2, another curve detection method provided in the embodiment of the present application includes:
step 201: and sampling foreground points in the foreground point set to obtain a sample set.
Step 202: and obtaining a curve corresponding to the sample according to the positions of foreground points contained in the sample.
Step 203: and obtaining the adaptive value of the sample according to the relative position of each foreground point and the curve in the foreground point set.
The implementation manners of steps 201-203 in this embodiment are substantially the same as those of steps 101-103 in the foregoing embodiment, and therefore, the related descriptions can refer to the foregoing embodiment, which is not described herein again.
Step 204: judging whether a preset cut-off condition is met, if so, entering the step 205; if not, step 206 is entered.
The purpose of setting the preset cutoff condition is to decide whether to stop generating new samples or not by the preset cutoff condition, and whether to consider that only a target curve can be selected from the formed curves.
As an example, the preset cutoff condition includes: the number of iterations reaches a third preset number of times. The number of iterations refers to the number of loops of step 201-203. The iteration count is incremented by 1 for each execution of the steps 201 and 203. When the iteration times reach the third preset number, the iteration times are enough, and new samples do not need to be generated again. As an example, the third preset number is 50.
As another example, the preset cutoff condition includes: and continuously iterating the fourth preset number of times to determine that the samples with the maximum adaptive values are consistent. And the samples with the maximum adaptive values determined by continuously iterating the fourth preset number of times are consistent, so that the probability of determining the samples with the larger adaptive values under the continuous iteration is very low, and new samples do not need to be generated again. As an example, the fourth preset number is 5.
Step 205: and determining a curve corresponding to the sample with the maximum adaptive value in the past iterations as a target curve.
For example, when it is determined that the preset cutoff condition is satisfied, 20 iterations have been completed, and the sample with the largest adaptation value determined in each iteration may be transversely compared, so as to determine the sample with the largest adaptation value, which is the result of the global screening. The curve corresponding to the sample with the largest adaptation value is used as the target curve.
Step 206: and determining a second preset number of samples with larger adaptation values according to the adaptation values of the samples.
If the sample set includes a fifth predetermined number of samples, the curve with the fifth predetermined number can be obtained by performing the steps 201 and 203. As an example, if the fifth preset number is 10 and the second preset number is 5, then 5 samples with larger adaptive values are selected from the sample set in step 206.
In one possible implementation, the adaptation values of the 10 samples are sorted in a descending order, and the samples corresponding to the top 5 sorted adaptation values are determined.
Step 207: and updating the sampling probability of foreground points contained in the first second preset number of samples with larger adaptive values, and entering the step 201 again.
If the total number of foreground points in the foreground point set is X, where X is a positive integer greater than or equal to 3, then the sampling probabilities of the foreground points are unified to 1/X when step 201 is executed for the first time. In step 206, a second predetermined number of samples with larger adaptive values are determined, and these samples include foreground points that may partially overlap, for example, both samples include foreground point i. In addition, the first second preset number of samples with larger adaptation values may not have coincident foreground points. The foreground points contained in the first preset number of samples with the larger adaptive value are called as foreground points with sampling probability to be updated, and the sampling probabilities of the rest foreground points in the foreground point set do not need to be changed.
When the step is specifically executed, the total number of times Y that the foreground point with the sampling probability to be updated appears in the second preset number of samples before the foreground point with the larger adaptation value can be counted, and the sum of the current sampling probability of the foreground point with the sampling probability to be updated and Y/X is used as the sampling probability of the foreground point with the sampling probability to be updated after updating. Y is a positive integer, and Y is less than or equal to a second preset number. For example, the foreground point i appears 2 times in 5 samples before the adaptive value, the sampling probability of the foreground point i before updating is 1/X, and the sampling probability after updating is 3/X.
By performing step 207, the sampling probabilities of some foreground points are updated, while the sampling probabilities of some foreground points are not updated. For the foreground point set, when foreground points in the foreground point set are randomly sampled to form samples, in order to ensure the sampling randomness and the accuracy of the solution curve, as an optional mode, the sampling probabilities of all the foreground points are normalized, and the sum of the sampling probabilities of all the foreground points is ensured to be 1. For any foreground point, the normalized sampling probability is as follows: the ratio of the sampling probability of the foreground point before normalization to the sum of the sampling probabilities of all the foreground points before normalization. Through normalization, accurate quantification of foreground point sampling probability is achieved.
Thereafter, foreground points in the foreground point set can be randomly sampled according to the normalized sampling probability. That is, the sampling probability obtained in step 207 is used to sample foreground points in the foreground point set in the next iteration, so as to obtain a sample set used in the next iteration.
In the method provided by the above embodiment, after the adaptive values of the samples are obtained, the sampling probabilities of the foreground points are sorted and updated, so that the solving efficiency of the target curve can be improved, the solving speed can be improved, and the detection accuracy of the curve can be ensured.
On the basis of the embodiment of the curve detection method, correspondingly, the application also provides a curve detection device. The following describes an implementation of the apparatus with reference to the embodiments and the accompanying drawings.
Device embodiment
Referring to fig. 3, the drawing is a schematic structural diagram of a curve detection apparatus provided in the embodiment of the present application. As shown in fig. 3, the curve detecting apparatus 300 includes: a sampling module 301, a curve generation module 302, an adaptive value acquisition module 303 and a target curve determination module 304.
The sampling module 301 is configured to sample foreground points in a foreground point set to obtain a sample set; the samples in the sample set comprise a first preset number of foreground points;
a curve generating module 302, configured to obtain a curve corresponding to the sample according to a position of a foreground point included in the sample;
an adaptive value obtaining module 303, configured to obtain an adaptive value of the sample according to a relative position between each foreground point in the foreground point set and the curve;
and a target curve determining module 304, configured to determine a target curve according to the adaptive value of each sample in the sample set.
The curve detection device provided by the embodiment of the application is the above. Compared with the traditional algorithm, the time complexity and the space complexity of curve detection of the device are greatly reduced, the speed is high, and the device can run in real time. In addition, the device has high detection precision on the curve, and the optimal solution can be found with great probability. In a parabolic detection scene, the problem that the acquired image usually has more environmental noise, and the environmental noise may be generated by people or other objects, which brings certain difficulty to parabolic detection. Compared with a curve detection method based on Hough transform and a curve detection method based on a least square method in a parabolic detection scene, the curve detection device provided by the embodiment of the application has better robustness while maintaining detection precision, and therefore has obvious advantages.
Optionally, the adaptive value obtaining module 303 includes:
the distance acquisition unit is used for acquiring the distance between each foreground point and the curve according to the relative position of each foreground point and the curve in the foreground point set;
the comparison unit is used for comparing the distances between the foreground points and the curve with a preset distance threshold respectively;
and the adaptive value acquisition unit is used for recording the number of foreground points in the foreground point set, the distance between which and the curve is less than the preset distance threshold, as the adaptive value of the sample.
Optionally, the target curve determining module 304 includes:
and a curve first determining unit, configured to determine, as the target curve, a curve corresponding to a sample with a largest adaptation value among the samples.
When the number of foreground points in the current sight spot set is huge, a target curve can be found in a mode of multiple iterations. For example, 10 samples are first obtained by random sampling. Some samples with higher adaptation values are determined after one iteration. The foreground points contained in the samples with higher adaptive values have higher probability of being located in the finally optimized target curve, and the target curve can be determined more conveniently, quickly, efficiently and accurately by utilizing the foreground points. Therefore, higher sampling probability can be configured for the foreground points, the foreground points in the foreground point set are re-sampled according to the updated sampling probability, and samples with high adaptive values possibly existing are continuously searched. Based on this idea, other alternative implementations of the curve detection apparatus are described below.
Optionally, the target curve determining module 304 includes:
the judging unit is used for judging whether a preset cut-off condition is met or not;
a second curve determining unit, configured to determine, as the target curve, a curve corresponding to a sample with a largest adaptation value in previous iterations when the determining unit determines that the preset cutoff condition is satisfied;
the sample determining unit is used for determining a first preset number of samples with larger adaptive values according to the adaptive values of the samples when the judging unit determines that the preset cutoff condition is not met;
the updating unit is used for updating the sampling probability of foreground points contained in a first preset number of samples with larger adaptive values; the updated sampling probabilities are used to sample foreground points in the foreground point set in the next iteration.
Optionally, the preset cutoff condition includes:
the iteration times reach a third preset number; or, continuously iterating the fourth preset number of times to determine that the samples with the maximum adaptive values are consistent.
Optionally, the sampling probability of each foreground point initialization in the foreground point set is 1/X, where X is the total number of foreground points included in the foreground point set; the update unit includes:
the foreground point determining unit is used for taking foreground points contained in a first preset number of samples with larger adaptive values as foreground points to be updated according to the sampling probability;
the counting unit is used for counting the total times Y of the foreground points with the sampling probability to be updated appearing in the first preset number of samples with the larger adaptive value for the foreground points with the sampling probability to be updated;
and the sampling probability updating unit is used for taking the sum of the current sampling probability of the foreground point with the sampling probability to be updated and the Y/X as the updated sampling probability of the foreground point with the sampling probability to be updated.
By sequencing and updating the sampling probability of the foreground points after the adaptive values of the samples are obtained, the solving efficiency of the target curve can be improved, the solving speed is improved, and the detection precision of the curve is ensured.
Optionally, the apparatus further comprises:
and the normalization module is used for performing normalization processing on the sampling probability of each foreground point in the foreground point set. Through normalization, accurate quantification of foreground point sampling probability is achieved.
Optionally, the sampling module 301 includes:
the sampling unit is used for randomly sampling a first preset number of foreground points according to the current sampling probability of each foreground point in the foreground point set to obtain a sample to be detected;
the inspection unit is used for inspecting whether the sample to be inspected meets a preset prior condition or not; when the inspection unit inspects that the sample to be inspected meets the preset prior condition, determining that the sample to be inspected is qualified;
the sample set constructing unit is used for adding the qualified sample determined by the testing unit into the sample set;
the preset prior condition comprises: a morphological prior condition and/or a temporal prior condition.
Optionally, the apparatus further comprises:
the foreground point identification module is used for identifying all foreground points from the detection result of the sensor; the foreground points are two-dimensional data or three-dimensional data;
and the foreground point set construction module is used for constructing the foreground point set according to all the foreground points identified by the foreground point identification module.
The above description is only one specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1. A curve detection method, comprising:
sampling foreground points in the foreground point set to obtain a sample set; the samples in the sample set comprise a first preset number of foreground points;
obtaining a curve corresponding to the sample according to the position of the foreground point contained in the sample;
obtaining an adaptive value of the sample according to the relative position of each foreground point in the foreground point set and the curve;
and determining a target curve according to the adaptive value of each sample in the sample set.
2. The method of claim 1, wherein obtaining the adaptive value of the sample according to the relative position of each foreground point in the set of foreground points and the curve comprises:
obtaining the distance between each foreground point and the curve according to the relative position of each foreground point and the curve in the foreground point set;
comparing the distance between each foreground point and the curve with a preset distance threshold value respectively;
and recording the number of foreground points in the foreground point set, the distance between which and the curve is less than the preset distance threshold value, as an adaptive value of the sample.
3. The method of claim 1, wherein determining a target curve according to the adaptive value of each sample in the sample set comprises:
and determining the curve corresponding to the sample with the maximum adaptive value in the samples as the target curve.
4. The method of claim 1, wherein determining a target curve according to the adaptive value of each sample in the sample set comprises:
when a preset cut-off condition is met, determining a curve corresponding to a sample with the maximum adaptive value in the past iteration as the target curve;
when the preset cutoff condition is not met, determining a second preset number of samples with larger adaptive values according to the adaptive values of the samples; updating the sampling probability of foreground points contained in the first preset number of samples with larger adaptive values; the updated sampling probabilities are used to sample foreground points in the foreground point set in the next iteration.
5. The method of claim 4, wherein the preset cutoff condition comprises:
the iteration times reach a third preset number; or, continuously iterating the fourth preset number of times to determine that the samples with the maximum adaptive values are consistent.
6. The method of claim 4, wherein the sampling probability for initializing each foreground point in the set of foreground points is 1/X, where X is the total number of foreground points contained in the set of foreground points; the updating the sampling probability of the foreground points contained in the first preset number of samples with the larger adaptation values includes:
taking foreground points contained in the first preset number of samples with larger adaptive values as foreground points to be updated according to the sampling probability;
and for each foreground point with the sampling probability to be updated, counting the total times Y of the foreground points with the sampling probability to be updated appearing in the first preset number of samples with the larger adaptive value, and taking the sum of the current sampling probability of the foreground points with the sampling probability to be updated and Y/X as the sampling probability of the foreground points with the sampling probability to be updated after updating.
7. The method according to any one of claims 4 to 6, wherein after the updating of the sampling probability of the foreground point included in the second preset number of samples with the larger adaptation value, the method further comprises:
and carrying out normalization processing on the sampling probability of each foreground point in the foreground point set.
8. The method of claim 1, wherein sampling foreground points in a set of foreground points to obtain a set of samples comprises:
randomly sampling a first preset number of foreground points from the foreground point set according to the current sampling probability of each foreground point to obtain a sample to be detected;
when the sample to be tested meets a preset prior condition, determining that the sample to be tested is qualified, and adding the sample to be tested into the sample set;
the preset prior condition comprises: a morphological prior condition and/or a temporal prior condition.
9. The method of claim 1, wherein prior to said sampling foreground points in a set of foreground points, the method further comprises:
identifying all foreground points from the detection result of the sensor; the foreground points are two-dimensional data or three-dimensional data;
and constructing the foreground point set according to all the identified foreground points.
10. A curve detecting device, comprising:
the sampling module is used for sampling foreground points in the foreground point set to obtain a sample set;
the samples in the sample set comprise a first preset number of foreground points;
the curve generation module is used for obtaining a curve corresponding to the sample according to the positions of foreground points contained in the sample;
the adaptive value acquisition module is used for acquiring the adaptive value of the sample according to the relative position of each foreground point in the foreground point set and the curve;
and the target curve determining module is used for determining a target curve according to the adaptive value of each sample in the sample set.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110205455.7A CN112927201B (en) | 2021-02-24 | 2021-02-24 | Curve detection method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110205455.7A CN112927201B (en) | 2021-02-24 | 2021-02-24 | Curve detection method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112927201A true CN112927201A (en) | 2021-06-08 |
CN112927201B CN112927201B (en) | 2024-08-20 |
Family
ID=76170623
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110205455.7A Active CN112927201B (en) | 2021-02-24 | 2021-02-24 | Curve detection method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112927201B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114636828A (en) * | 2022-05-07 | 2022-06-17 | 深圳市帝迈生物技术有限公司 | Sample real-time detection method and device, sample analyzer and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100296697A1 (en) * | 2007-09-28 | 2010-11-25 | Sony Computer Entertainment Inc. | Object tracker and object tracking method |
US20160275692A1 (en) * | 2015-03-17 | 2016-09-22 | Lyrical Labs Video Compression Technology, LLC | Foreground detection using fractal dimensional measures |
CN106327468A (en) * | 2015-06-25 | 2017-01-11 | 株式会社理光 | Curve detection method and device |
CN111862132A (en) * | 2020-08-09 | 2020-10-30 | 成都市精卫鸟科技有限责任公司 | Curve detection method, device, equipment and medium |
CN112069730A (en) * | 2020-09-02 | 2020-12-11 | 彭涛 | Three-dimensional curve acquisition method and device for 3D printing |
CN112365524A (en) * | 2020-11-10 | 2021-02-12 | 宁波博登智能科技有限责任公司 | High-altitude parabolic real-time alarm system based on time sequence images |
-
2021
- 2021-02-24 CN CN202110205455.7A patent/CN112927201B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100296697A1 (en) * | 2007-09-28 | 2010-11-25 | Sony Computer Entertainment Inc. | Object tracker and object tracking method |
US20160275692A1 (en) * | 2015-03-17 | 2016-09-22 | Lyrical Labs Video Compression Technology, LLC | Foreground detection using fractal dimensional measures |
CN106327468A (en) * | 2015-06-25 | 2017-01-11 | 株式会社理光 | Curve detection method and device |
CN111862132A (en) * | 2020-08-09 | 2020-10-30 | 成都市精卫鸟科技有限责任公司 | Curve detection method, device, equipment and medium |
CN112069730A (en) * | 2020-09-02 | 2020-12-11 | 彭涛 | Three-dimensional curve acquisition method and device for 3D printing |
CN112365524A (en) * | 2020-11-10 | 2021-02-12 | 宁波博登智能科技有限责任公司 | High-altitude parabolic real-time alarm system based on time sequence images |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114636828A (en) * | 2022-05-07 | 2022-06-17 | 深圳市帝迈生物技术有限公司 | Sample real-time detection method and device, sample analyzer and storage medium |
CN114636828B (en) * | 2022-05-07 | 2022-10-25 | 深圳市帝迈生物技术有限公司 | Sample real-time detection method and device, sample analyzer and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112927201B (en) | 2024-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112036074B (en) | Radar signal sorting method and system in high pulse density environment | |
KR101856401B1 (en) | Method, apparatus, storage medium, and device for processing lane line data | |
CN112308881B (en) | Ship multi-target tracking method based on remote sensing image | |
CN106886216B (en) | Robot automatic tracking method and system based on RGBD face detection | |
CN108846835A (en) | The image change detection method of convolutional network is separated based on depth | |
CN108537286B (en) | Complex target accurate identification method based on key area detection | |
CN105654507A (en) | Vehicle outer contour dimension measuring method based on image dynamic feature tracking | |
CN106557740B (en) | The recognition methods of oil depot target in a kind of remote sensing images | |
CN110084830B (en) | Video moving object detection and tracking method | |
CN108537790B (en) | Different-source image change detection method based on coupling translation network | |
CN110502962B (en) | Method, device, equipment and medium for detecting target in video stream | |
CN111753757A (en) | Image recognition processing method and device | |
CN116152257B (en) | Detection information optimization method applied to sensor, server and medium | |
CN110956613B (en) | Image quality-based target detection algorithm performance normalization evaluation method and system | |
CN108986142A (en) | Shelter target tracking based on the optimization of confidence map peak sidelobe ratio | |
CN109117746A (en) | Hand detection method and machine readable storage medium | |
CN115841488A (en) | Hole checking method of PCB (printed Circuit Board) based on computer vision | |
CN112164093A (en) | Automatic person tracking method based on edge features and related filtering | |
CN116432144A (en) | Data fusion system based on carrier communication | |
CN112927201B (en) | Curve detection method and device | |
CN107392948B (en) | Image registration method of amplitude-division real-time polarization imaging system | |
CN111814689B (en) | Training method of fire disaster identification network model, fire disaster identification method and related equipment | |
CN110059591B (en) | Method for identifying moving target area | |
Tan et al. | An application of an improved FCOS algorithm in detection and recognition of industrial instruments | |
CN111983247A (en) | Sampling method and system for seal sample submission |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |