Corner detection method and system based on Harris and decision tree
By combining the Harris algorithm and decision tree, and using the Gaussian operator and ID3 algorithm to construct a multi-scale differential convolution function, the problems of large computational complexity and insufficient intelligence of the Harris algorithm in spacecraft on-orbit missions are solved, and efficient and accurate corner detection is achieved.
Patent Information
- Application Number
- CN202210086304.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-01-25
AI Technical Summary
The existing Harris corner detection algorithm has problems such as large computational load, slow computing speed and insufficient intelligence in spacecraft on-orbit missions, and cannot meet the high requirements for detection speed and accuracy in the space environment.
Combining the Harris algorithm and decision tree, a multi-scale differential convolution function is constructed through the Gaussian operator, and the decision tree is established using the ID3 algorithm to achieve corner detection in the image, reducing the calculation of the eigenvalues and traces of the autocorrelation matrix. The introduction of the intelligent algorithm does not require setting a threshold.
The speed and accuracy of corner detection are improved, the dependence on prior values is reduced, the process is simplified, and the detection accuracy depends on the validity of the input samples, overcoming the limitations of existing technologies.
Smart Images

Figure CN114529567B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image measurement, and in particular to a corner detection method and system based on Harris and decision tree. Background Art
[0002] Binocular measurement is a suitable tool for measuring the surface deformation of large, highly flexible components during on-orbit spacecraft missions. Binocular measurement offers advantages unattainable by other tools. However, due to environmental and operating system limitations, on-orbit spacecraft pose many new requirements for accuracy and reliability that are not present in ground-based measurement. Measurements in space environments typically involve setting specific target points, similar to corner detection. Corner detection in space imposes new requirements on detection speed, which must not exceed the operating range of the selected system. Furthermore, the degree of human intervention is significantly reduced, and the reliance on machine intelligence is increased.
[0003] Corner detection is widely used in applications such as machine vision, pattern recognition, and 3D reconstruction. The accuracy of corner detection directly determines the quality of subsequent tasks such as image registration, image stitching, and image recognition. The so-called corner point refers to the point with the most dramatic change in a local area of the image or the intersection of two or more edges in the image. Corner points are very important features of the image and play an important role in the understanding and analysis of the image. Existing corner detection methods are mainly divided into two categories: (1) Based on image boundary information, by first obtaining the boundary information in the image and then finding the corner points. (2) Based on the pixel grayscale in the image to obtain corner points. The Harris algorithm is a method that uses pixel grayscale to extract corner points.
[0004] The Harris corner detection algorithm, proposed by Harris et al. in 1988, detects corners based on the rate of change of grayscale values in different directions. The Harris method calculates eigenvalues to obtain the two eigenvalues and the trace of the autocorrelation matrix, which then yields an empirical formula. If the value exceeds a set threshold, the corner is considered a corner; otherwise, it is not. The Harris corner detection algorithm is highly stable and robust. However, the Harris operator has some limitations for image corner detection, primarily manifested in the following points:
[0005] (1) Harris method cannot overcome the problem of corner clustering;
[0006] (2) Each operation requires the calculation of the eigenvalues and traces of the autocorrelation matrix, which is computationally intensive and slow for large-size images.
[0007] (3) The setting of the prior value affects the calculation results. The level of intelligence is not enough and the threshold needs to be set manually. Summary of the Invention
[0008] In view of the defects in the prior art, the present invention aims to provide a corner detection method and system based on Harris and decision tree.
[0009] According to the present invention, a corner detection method based on Harris and decision tree is provided, comprising:
[0010] Step S1: pre-process the image according to the image grayscale value information to obtain image pre-processing information;
[0011] Step S2: constructing a multi-scale differential convolution function based on a Gaussian operator according to the image preprocessing information, and obtaining construction information of the multi-scale differential convolution function based on the Gaussian operator;
[0012] Step S3: constructing information based on the multi-scale differential convolution function based on the Gaussian operator to obtain the gradient change of the known corner point and non-corner point function, and obtaining the gradient change information of the known corner point and non-corner point function;
[0013] The gradient change of the known corner point and non-corner point functions is obtained as the characteristic function (which is the gradient change in each direction in the matrix).
[0014] Step S4: Based on the gradient change information of the known corner points and non-corner point functions, the ID3 algorithm is used to construct a training set for the known corner points, and information about the training set constructed by the known corner points is obtained;
[0015] Step S5: Building training set information based on known corner points, training the functions of all points in the image, obtaining the corner points of the image, and acquiring the corner point information of the image;
[0016] The feature function ΔM of all points in the image to be identified is used as the decision tree created in step S4 for training to obtain the corner points of the image.
[0017] Step S6: According to the corner point information of the image, obtain the corner point detection information based on Harris and decision tree.
[0018] Preferably, the step S1 includes:
[0019] Step S1.1: Preprocess the image and perform illumination correction. The calculation formula is as follows:
[0020]
[0021] in, represents the normalized image grayscale, i(x,y) represents the original grayscale, μ represents the mean of the image grayscale, c is a constant, and σ is the standard deviation.
[0022] Preferably, step S2 includes:
[0023] Step S2.1: Select Gaussian kernel as the scale transformation and use Harris algorithm to calculate the autocorrelation matrix; calculate the gradient I of the pixel in the x and y directions x , I y , convolve with the Gaussian kernel function and get the correlation matrix:
[0024]
[0025] Among them, G(σ) is the convolution function and M is the new matrix.
[0026] Preferably, step S4 includes:
[0027] Step S4.1: Create a set of decision trees using the characteristic functions ΔM of corner points and non-corner points. The entropy of the set S for each state classification is defined as:
[0028]
[0029] Among them, Entropy(S) is a Boolean set, c is a state classification, P i is the proportion of the number of samples of the i-th attribute value in the subset; the information gain is calculated using the following formula:
[0030]
[0031] Among them, V(A) is the value range of attribute A; S V It is the subset of set S whose value on attribute A is equal to V.
[0032] Preferably, the step S4 further includes:
[0033] Step S4.2: Create the root node N of the decision tree. If the sample belongs to category C, return N as a leaf node and mark it as category C.
[0034] Calculate the information gain of each attribute in the attribute table, select the largest one as the root node N, generate branches from the root node according to each value in the attribute value range, and recursively create a tree.
[0035] According to the present invention, a corner detection system based on Harris and decision tree is provided, comprising:
[0036] Module M1: pre-processes the image according to the image grayscale value information and obtains the image pre-processing information;
[0037] Module M2: Constructs a multi-scale differential convolution function based on the Gaussian operator according to the image preprocessing information, and obtains the construction information of the multi-scale differential convolution function based on the Gaussian operator;
[0038] Module M3: constructs information based on the multi-scale differential convolution function based on the Gaussian operator, obtains the gradient change of the known corner and non-corner point functions, and obtains the gradient change information of the known corner and non-corner point functions;
[0039] The gradient change of the known corner point and non-corner point functions is obtained as the characteristic function (which is the gradient change in each direction in the matrix).
[0040] Module M4: Based on the gradient change information of the known corner points and non-corner point functions, the ID3 algorithm is used to build a training set for the known corner points, and the information of the known corner points building the training set is obtained;
[0041] Module M5: Build training set information based on known corner points, train the functions of all points in the image, obtain the corner points of the image, and obtain the corner point information of the image;
[0042] The feature function ΔM of all points in the image to be identified is used as the decision tree created in the module M4 for training to obtain the corner points of the image.
[0043] Module M6: According to the corner information of the image, obtain the corner detection information based on Harris and decision tree.
[0044] Preferably, the module M1 includes:
[0045] Module M1.1: Preprocess the image and perform illumination correction. The calculation formula is as follows:
[0046]
[0047] in, represents the normalized image grayscale, i(x,y) represents the original grayscale, μ represents the mean of the image grayscale, c is a constant, and σ is the standard deviation.
[0048] Preferably, the module M2 includes:
[0049] Module M2.1: Select Gaussian kernel as the scale transformation and use Harris algorithm to calculate the autocorrelation matrix; calculate the gradient I of the pixel in the x and y directions x , I y , convolve with the Gaussian kernel function and get the correlation matrix:
[0050]
[0051] Among them, G(σ) is the convolution function and M is the new matrix.
[0052] Preferably, the module M4 includes:
[0053] Module M4.1: Create a set of decision trees using the characteristic functions ΔM of corner points and non-corner points. The entropy of the set S for each state classification is defined as:
[0054]
[0055] Among them, Entropy(S) is a Boolean set, c is a state classification, P i is the proportion of the number of samples of the i-th attribute value in the subset; the information gain is calculated using the following formula:
[0056]
[0057] Among them, V(A) is the value range of attribute A; S V It is the subset of set S whose value on attribute A is equal to V.
[0058] Preferably, the module M4 further includes:
[0059] Module M4.2: Create the root node N of the decision tree. If the sample belongs to category C, return N as a leaf node and mark it as category C.
[0060] Calculate the information gain of each attribute in the attribute table, select the largest one as the root node N, generate branches from the root node according to each value in the attribute value range, and recursively create a tree.
[0061] Compared with the prior art, the present invention has the following beneficial effects:
[0062] 1. The Harris algorithm used in the present invention does not need to calculate the eigenvalues and traces of the autocorrelation matrix, but only needs to obtain the gradient after Gaussian convolution, which speeds up the calculation;
[0063] 2. The present invention introduces an intelligent algorithm based on a decision tree, which does not require setting a threshold. The detection accuracy is only related to the validity of the input sample and does not rely on a priori empirical values.
[0064] 3. The process structure of the present invention is reasonable and easy to use, which can overcome the defects of the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Other features, objects and advantages of the present invention will become more apparent upon reading the detailed description of non-limiting embodiments with reference to the following drawings:
[0066] Figure 1 Schematic diagram of the process of the corner detection method based on Harris and decision tree of the present invention. DETAILED DESCRIPTION
[0067] The present invention will be described in detail below with reference to specific embodiments. The following examples will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those skilled in the art, several changes and improvements can be made without departing from the scope of the present invention. These all fall within the scope of protection of the present invention.
[0068] This invention provides a corner detection method and system based on Harris and decision trees. This method is based on the traditional Harris algorithm and a decision tree of a machine intelligence algorithm. The method includes the following steps: First, based on Harris corner detection, different scale spaces are established using a Gaussian operator. A population is established using the characteristic scales of known corners. A top-down recursive algorithm is applied to the image where corners are to be detected, starting from the root node of the tree. Attribute values are tested and compared at its internal nodes. The corresponding branch is determined based on the attribute values of a given instance. Finally, a conclusion is drawn at the leaf nodes of the decision tree. The invention utilizes a Gaussian operator to construct a scaling function and the ID3 (Iterative Dichotomic version 3) algorithm to detect image corners.
[0069] A corner detection method based on Harris and decision trees. Based on Harris corner detection, a Gaussian operator is used to establish different scale spaces. A population is established using the characteristic scales of known corners. A top-down recursive algorithm is used for the image where corners need to be detected, starting from the root node of the tree. Attribute values are tested and compared on its internal nodes. The corresponding branch is determined based on the attribute values of a given instance. Finally, a conclusion is drawn at the leaf nodes of the decision tree. This method specifically includes:
[0070] (1) Obtain the grayscale value of the image and preprocess the image;
[0071] (2) Construct a multi-scale differential convolution function based on Gaussian operator;
[0072] (3) Obtain the gradient changes of the known corner and non-corner point functions;
[0073] (4) Use the ID3 algorithm to build a training set of known corner points;
[0074] (5) Train the functions of all points in the image to obtain the corner points of the image.
[0075] The aforementioned corner detection method based on Harris and decision tree is characterized by performing image preprocessing and illumination correction.
[0076]
[0077] in, represents the normalized image grayscale, i(x,y) represents the original grayscale, μ represents the mean of the image grayscale, c is a constant, and σ is the standard deviation.
[0078] The aforementioned corner detection method based on Harris and decision tree is characterized by selecting Gaussian kernel as scale transformation and using Harris algorithm to calculate autocorrelation matrix. Calculate the gradient I of pixel point in x and y direction. x , I y , convolve with the Gaussian kernel function and get the correlation matrix:
[0079]
[0080] Among them, G(σ) is the convolution function and M is the new matrix.
[0081] The aforementioned corner detection method based on Harris and decision tree is characterized in that the gradient change ΔM of the known corner point and non-corner point function is obtained as the feature function (ΔM is the gradient change in each direction in the matrix M).
[0082] The aforementioned corner detection method based on Harris and decision tree is characterized in that a set of decision trees is created using the characteristic functions ΔM of corner points and non-corner points. The entropy of the set S for each state classification is defined as:
[0083]
[0084] Among them, Entropy(S) is a Boolean set, c is a state classification, P i Information gain is the proportion of the number of samples of the i-th attribute value in the subset.
[0085]
[0086] Among them, V(A) is the value range of attribute A; S V It is the subset of set S whose value on attribute A is equal to V.
[0087] Create a decision tree with a root node N. If the sample belongs to category C, return N as a leaf node and mark it as category C. Calculate the information gain of each attribute in the attribute table, select the largest one as the root node N, and recursively create a tree by generating branches from the root node based on each value in the attribute value range.
[0088] The aforementioned corner point detection method based on Harris and decision tree is characterized in that the feature function ΔM of all points in the image to be identified is used as the decision tree created in step 4 for training to obtain the corner points of the image.
[0089] Specifically, in one embodiment, a corner detection method based on Harris and decision tree includes the following steps: image preprocessing; constructing a multi-scale differential convolution function based on a Gaussian operator; obtaining the gradient change of the function of known corner points and non-corner points; using the ID3 algorithm to create a training set for known corner points; and training the function of all points in the image to obtain the corner points of the image.
[0090] Step 1: Preprocess all images, including those used as decision trees and those to be trained, and perform illumination correction.
[0091]
[0092] in, represents the normalized image grayscale, i(x,y) represents the original grayscale, μ represents the mean of the image grayscale, c is a constant, and σ is the standard deviation. Correcting multiple images is a normalization process, so c is set to 2 here.
[0093] Step 2: Calculate the gradient I of the pixel in the x and y directions based on the grayscale obtained in the previous step. x , I y , and obtain their autocorrelation function I x 2 , I y 2 , select Gaussian kernel as scale transformation, perform convolution with Gaussian kernel function, and get the correlation matrix:
[0094]
[0095] Here, the window size of the Gaussian kernel is selected as 5×5, and M is the Gaussian weighting function.
[0096] Step 3: Calculate the gradient change ΔM of M as the characteristic function. Here, we need to distinguish the characteristic functions of corner points and non-corner points. The two need to be calculated separately. The accuracy of the corner point position must be precise, and the values of non-corner points should contain as many background patterns as possible, without repeating many non-corner points.
[0097] Step 4: Create a decision tree set using the characteristic function ΔM of corner and non-corner points. Take the same number of corner and non-corner points, setting the corner values to 1 and the non-corner values to 2. Use the same number of corner and non-corner point feature values as sample data to create a decision tree and save the trained model.
[0098] In step 5, the feature function ΔM of all points in the image to be identified is used to train the decision tree created in step 4. If the value obtained is 1, it is considered a corner point, and if the value is 2, it is a non-corner point. To improve accuracy, the window size in step 2 can be changed, and steps 3-5 can be repeated until higher accuracy is achieved.
[0099] In the description of this application, it should be understood that the terms "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on this application.
[0100] The above describes specific embodiments of the present invention. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art may make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. The embodiments of this application and the features in the embodiments may be combined with each other in any manner unless there is a conflict.
Claims
1. A corner detection method based on Harris and decision tree, characterized in that: include: Step S1: pre-process the image according to the image grayscale value information to obtain image pre-processing information; Step S2: constructing a multi-scale differential convolution function based on a Gaussian operator according to the image preprocessing information, and obtaining construction information of the multi-scale differential convolution function based on the Gaussian operator; Step S3: constructing information based on the multi-scale differential convolution function based on the Gaussian operator to obtain the gradient change of the known corner point and non-corner point function, and obtaining the gradient change information of the known corner point and non-corner point function; Step S4: Based on the gradient change information of the known corner points and non-corner point functions, the ID3 algorithm is used to construct a training set for the known corner points, and information about the training set constructed by the known corner points is obtained; Step S5: Building training set information based on known corner points, training the functions of all points in the image, obtaining the corner points of the image, and acquiring the corner point information of the image; Step S6: Obtaining corner point detection information based on Harris and decision tree according to the corner point information of the image; The step S2 comprises: Step S2.1: Select Gaussian kernel as the scale transformation and use Harris algorithm to calculate the autocorrelation matrix; calculate the gradient of the pixel in the x and y directions 、 , convolve with the Gaussian kernel function and get the correlation matrix: ; in, is the convolution function, is the new matrix; The step S4 comprises: Step S4.1: Using the characteristic functions of corner points and non-corner points Create an ensemble of decision trees, is a matrix The gradient changes in all directions in the set S, the entropy of the classification of each state is defined as: ; in, is a Boolean set, For status classification, is the proportion of the number of samples of the i-th attribute value in the subset; the information gain is calculated using the following formula: ; in, is the value range of attribute A; It is the subset of set S whose value on attribute A is equal to V.
2. The corner detection method based on Harris and decision tree according to claim 1, characterized in that: The step S1 comprises: Step S1.1: Preprocess the image and perform illumination correction. The calculation formula is as follows: ; in, represents the normalized image grayscale, represents the original grayscale, represents the mean value of the image grayscale, is a constant, is the standard deviation.
3. The corner detection method based on Harris and decision tree according to claim 1, characterized in that: The step S4 further includes: Step S4.2: Create the root node N of the decision tree. If the sample belongs to category C, return N as a leaf node and mark it as category C. Calculate the information gain of each attribute in the attribute table, select the largest one as the root node N, generate branches from the root node according to each value in the attribute value range, and recursively create a tree.
4. A corner detection system based on Harris and decision tree, characterized in that: include: Module M1: pre-processes the image according to the image grayscale value information and obtains the image pre-processing information; Module M2: Constructs a multi-scale differential convolution function based on the Gaussian operator according to the image preprocessing information, and obtains the construction information of the multi-scale differential convolution function based on the Gaussian operator; Module M3: constructs information based on the multi-scale differential convolution function based on the Gaussian operator, obtains the gradient change of the known corner and non-corner point functions, and obtains the gradient change information of the known corner and non-corner point functions; Module M4: Based on the gradient change information of the known corner points and non-corner point functions, the ID3 algorithm is used to build a training set for the known corner points, and the information of the known corner points building the training set is obtained; Module M5: Build training set information based on known corner points, train the functions of all points in the image, obtain the corner points of the image, and obtain the corner point information of the image; Module M6: Obtain corner detection information based on Harris and decision tree according to the corner information of the image; The module M2 includes: Module M2.1: Select Gaussian kernel as the scale transformation, use Harris algorithm to calculate the autocorrelation matrix; calculate the gradient of the pixel in the x and y directions 、 , convolve with the Gaussian kernel function and get the correlation matrix: ; in, is the convolution function, is the new matrix; The module M4 includes: Module M4.1: Using characteristic functions of corner and non-corner points Create an ensemble of decision trees, is a matrix The gradient changes in all directions in the set S, the entropy of the classification of each state is defined as: ; in, is a Boolean set, For status classification, is the proportion of the number of samples of the i-th attribute value in the subset; the information gain is calculated using the following formula: ; in, is the value range of attribute A; It is the subset of set S whose value on attribute A is equal to V.
5. The corner detection system based on Harris and decision tree according to claim 4, characterized in that: The module M1 includes: Module M1.1: Preprocess the image and perform illumination correction. The calculation formula is as follows: ; in, represents the normalized image grayscale, represents the original grayscale, represents the mean value of the image grayscale, is a constant, is the standard deviation.
6. The corner detection system based on Harris and decision tree according to claim 4, characterized in that: The module M4 further comprises: Module M4.2: Create the root node N of the decision tree. If the sample belongs to category C, return N as a leaf node and mark it as category C. Calculate the information gain of each attribute in the attribute table, select the largest one as the root node N, generate branches from the root node according to each value in the attribute value range, and recursively create a tree.
Citation Information
Patent Citations
Improved ORB-SLAM algorithm for outdoor offline navigation system
CN110309834A