Disclosure of Invention
The invention aims to provide a characteristic point extraction method of a door plate framework, which is used for accurately extracting characteristic points of the door plate framework.
According to the invention, the characteristic point extraction method of the door plate skeleton comprises the following steps of:
s100, binarizing the door plate three-dimensional point cloud image P to obtain a corresponding door plate binary image P', P= (P) 1 ,p 2 ,…,p n ,…,p N ),p n N is the number of points P, and the value range of N is 1 to N; p '= (P' 1 ,p’ 2 ,…,p’ n ,…,p’ N ),p’ n Is the nth point in P', if P n Depth value of p or more 0 n Then P' n The pixel value of (2) is a first preset value;if p is n Depth value of less than p 0 n Then P' n The pixel value of (2) is a second preset value; p is p 0 n Is p n A corresponding depth value threshold.
S200, performing contour extraction on the door plate binary image P' to obtain an outer contour A= (ap) of the door plate 1 ,ap 2 ,…,ap m ,…,ap M ) And inner contour b= (bp 1 ,bp 2 ,…,bp q ,…,bp Q );ap m The M is the M outer contour point of the door panel, the value range of M is 1 to M, and M is the number of the outer contour points of the door panel; bp q And Q is the number of inner contour points of the door panel, and the value range of Q is 1 to Q.
S300, traversing A to obtain ap m Corresponding line segmentl m ,l m Is ap m And bp a,m Is connected with bp a,m Distance ap in B m The nearest inner contour point.
S400, traversing A to obtain ap
m Corresponding skeleton contour points
,x
i And y
i Respectively is
l m The x-coordinate and y-coordinate, z, of the upper point i
i Is that
l m Depth value corresponding to upper point i, x
c,m And y
c,m Cp respectively
m X and y coordinates of (c); if cp is
m Response value R of (2)
m =Val
m,min /Val
m,max If the response value is larger than the preset response value threshold value, the cp is added
m Adding C, and initializing C to be Null; val (Val)
m,min And Val
m,max Cp respectively
m Corresponding covariance matrix M
m,cov Minimum and maximum eigenvalues of (2); cp (cp)
m Corresponding covariance matrix M
m,cov According to cp
m X-coordinate, y-coordinate and distance cp in the skeleton contour
m The x-and y-coordinates of the nearest k skeleton contour points are obtained.
S500, acquiring a connected domain T= (T) corresponding to C 1 ,t 2 ,…,t d ,…,t D ),t d To carry out connected domain extraction on CAnd D is the number of the connected domains obtained by extracting the connected domains of C, wherein the value range of D is 1 to D.
S600, traversing T, extracting T d The point of maximum response value.
The invention has at least the following beneficial effects: the method acquires the inner contour and the outer contour of the door plate, and for any outer contour point on the outer contour, the corresponding skeleton contour point is obtained by weighting and summing coordinates of points on a connecting line between the outer contour point and the inner contour point closest to the outer contour point, so that the obtained skeleton contour has a smoothing effect on noise, and the obtained skeleton contour is accurate; on the basis, the accuracy of the feature points of the skeleton outline further extracted according to the covariance matrix corresponding to the skeleton outline points on the skeleton outline is also higher.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
According to the present invention, there is provided a feature point extraction method of a door panel skeleton, as shown in fig. 1, including:
s100, binarizing the door plate three-dimensional point cloud image P to obtain a corresponding door plate binary image P', P= (P) 1 ,p 2 ,…,p n ,…,p N ),p n N is the number of points P, and the value range of N is 1 to N; p '= (P' 1 ,p’ 2 ,…,p’ n ,…,p’ N ),p’ n Is the nth point in P', if P n Depth value of p or more 0 n Then P' n The pixel value of (2) is a first preset value; if p is n Depth value of less than p 0 n Then P' n The pixel value of (2) is a second preset value; p is p 0 n Is p n A corresponding depth value threshold.
According to the invention, the three-dimensional point cloud image P of the door panel consists of N points, and the depth value corresponding to each point is the distance from the point cloud collector to the corresponding point on the surface of the door panel. Because the distance between the position of the groove or the bulge on the door plate and the point cloud collector is far or near compared with the distance between the other positions of the door plate and the point cloud collector, the groove or the bulge on the door plate can be effectively distinguished based on the depth value corresponding to each point in the three-dimensional point cloud image P of the door plate. Those skilled in the art will appreciate that any point cloud acquisition method in the prior art falls within the scope of the present invention.
According to the method, a three-dimensional point cloud image P of the door panel is regarded as a depth image corresponding to the door panel, pixel values corresponding to points in the depth image are depth values corresponding to the corresponding points, a threshold value obtaining method in binarization of the existing image is used for obtaining a depth value threshold value corresponding to each point, and if the depth value corresponding to a certain point is greater than or equal to the corresponding depth value threshold value, the obtained pixel value corresponding to the point in the binarization image is a first preset value; if the depth value corresponding to a certain point is smaller than the corresponding depth value threshold, the pixel value corresponding to the point in the obtained binarized image is a second preset value. Optionally, the first preset value is a pixel value corresponding to black, and the second preset value is a pixel value corresponding to white.
Preferably, a dynamic threshold method (namely a local threshold method) in image binarization is used for obtaining depth value thresholds corresponding to each point, so that the accuracy of the obtained door panel binarized image can be improved.
S200, performing contour extraction on the door plate binary image P' to obtain an outer contour A= (ap) of the door plate 1 ,ap 2 ,…,ap m ,…,ap M ) And inner contour b= (bp 1 ,bp 2 ,…,bp q ,…,bp Q );ap m The M is the M outer contour point of the door panel, the value range of M is 1 to M, and M is the number of the outer contour points of the door panel; bp q And Q is the number of inner contour points of the door panel, and the value range of Q is 1 to Q.
As shown in fig. 2, a groove or a bulge of the door plate is arranged between the outer contour 1 of the door plate and the inner contour 2 of the door plate; it should be noted that the outer contour and the shape of the outer contour of the door panel of the present invention are not limited to the rectangular shape shown in fig. 2, but are related to the actual shape of the grooves or protrusions of the door panel. Those skilled in the art will appreciate that any method of contour extraction of a binary image in the prior art falls within the scope of the present invention. Optionally, performing contour extraction on the door panel binary image P' to obtain an outer contour a and an inner contour B of the door panel, including:
s210, if the pixel value of a certain point in the door panel binary image P' is a first preset value and the pixel values of all adjacent points of the point are all the first preset values, determining the point as an internal point.
S220, setting all the pixel values determined as the internal points in the door panel binary image P 'as second preset values, and obtaining two outlines in the door panel binary image P'.
According to the invention, if the pixel value of a certain point in the door panel binary image P' is a first preset value, but all adjacent points of the point have adjacent points with the pixel value of a second preset value, the point is judged to be a contour point. According to S220, the pixel values of all the internal points in the door panel binary image P ' are set to the second pixel values, and then only the pixel values of the remaining contour points in the door panel binary image P ' are set to the first pixel values, and the points with the first pixel values form two contours in the door panel binary image P ', namely the inner contour and the outer contour.
S230, the contour with the larger area of the two contours is determined as an outer contour a, and the contour with the smaller area of the two contours is determined as an inner contour B.
S300, traversing A to obtain ap m Corresponding line segmentl m ,l m Is ap m And bp a,m Is connected with bp a,m Distance ap in B m The nearest inner contour point.
Preferably, bp a,m The acquisition method of (1) comprises the following steps:
s310, constructing a square bounding box according to the x coordinate and the y coordinate of each inner contour point in B, wherein the square bounding box is used for framing all the inner contour points in B, and the side length L=max (d x,max ,d y,max ) Max () is maximum value, d x,max Is the x-axis distance between the inner contour point with the smallest x coordinate and the inner contour point with the largest x coordinate in B, d y,max Is the y-axis distance between the inner contour point with the smallest y-coordinate and the inner contour point with the largest y-coordinate in B.
According to the present invention, the square bounding box is the largest square in fig. 3, which encloses all of the inner contour points in B, and the black solid dots in fig. 3 represent the inner contour points in B.
S320, dividing the square surrounding frame into 4 first sub-squares S 1 ={s 1,1 ,s 1,2 ,s 1,3 ,s 1,4 },s 1,j J=1, 2,3,4 for the j first sub-square.
According to the present invention, the first sub-square is the second largest square in fig. 3, and 4 first sub-squares are located in the upper left, upper right, lower left and lower right regions of the square bounding box, respectively.
S330, traversing S 1 If s 1,j Including more than 2 inner contour points, s will be 1,j Equally divided into 4 second sub-squares.
As one example, as shown in fig. 3, the first sub-square located in the upper left and lower left regions of the square bounding box includes more than 2 inner contour points, so that only the first sub-square located in the upper left and lower left regions of the square bounding box is equally divided, and the first sub-square located in the upper right and lower right regions of the square bounding box is not equally divided.
And S340, if more than 2 inner contour points are included in a certain second sub-square, repeating the halving operation until each sub-square obtained after the last halving contains at most 1 inner contour point.
As an embodiment, as shown in fig. 3, the first sub-squares located in the upper left and lower left areas of the square surrounding frame are divided into equal parts, and each of the 4 second sub-squares obtained after the dividing of the first sub-squares located in the lower left area of the square surrounding frame includes only one inner contour point, so that the dividing of the 4 second sub-squares is not needed. And one second sub-square of the 4 second sub-squares obtained after the first sub-square positioned in the upper left area of the square surrounding frame is subjected to the halving operation comprises a plurality of inner contour points, so that the second sub-square comprising the plurality of inner contour points is subjected to the halving operation to obtain 4 third sub-squares; and (3) the halving operation is finished because each sub square contains at most 1 inner contour point after the halving operation.
S350, traversing all the sub-squares obtained after the last halving, and if a certain sub-square has a crossing area with a target frame, acquiring inner contour points and ap in the sub-square m And append to E, E is initialized to Null; the target frame is in ap m A side length L as a center 0 Square bounding box of L 0 The side length is preset.
As one example, the target frame is a thicker square in FIG. 3, which has an intersection area with the 4 third sub-squares in FIG. 3, so that only 4 inner contour points and ap included in the 4 third sub-squares need to be calculated m Without calculating other inner contour points and ap m Is a distance of (3). Thus, the present invention reduces the need for and ap m Inner wheel for distance calculationThe number of the profile points can be increased to obtain bp a,m Is a function of the speed of the machine.
According to the invention, L 0 Can be set according to actual requirements, L 0 The smaller the setting, the smaller the calculation amount, but L 0 The settings of (2) should be such that: at least more than one sub-square exists in the crossing area with the target frame.
S360, taking an inner contour point corresponding to min (E) as bp a,m Min () is the minimum value.
S400, traversing A to obtain ap
m Corresponding skeleton contour points
,x
i And y
i Respectively is
l m The x-coordinate and y-coordinate, z, of the upper point i
i Is that
l m Depth value corresponding to upper point i, x
c,m And y
c,m Cp respectively
m X and y coordinates of (c); if cp is
m Response value R of (2)
m =Val
m,min /Val
m,max If the response value is larger than the preset response value threshold value, the cp is added
m Adding C, and initializing C to be Null; val (Val)
m,min And Val
m,max Cp respectively
m Corresponding covariance matrix M
m,cov Minimum and maximum eigenvalues of (2); cp (cp)
m Corresponding covariance matrix M
m,cov According to cp
m X-coordinate, y-coordinate and distance cp in the skeleton contour
m The x-and y-coordinates of the nearest k skeleton contour points are obtained.
According to the invention, traversing A, obtaining skeleton contour points corresponding to all outer contour points in A, and forming skeleton contour 3 of the door panel by the skeleton contour points as shown in figure 2.
According to the invention, cp m Is defined by x-coordinate and y-coordinate of (2)l m The coordinates corresponding to all the points are weighted and summed, so that the obtained skeleton contour has a smoothing effect on noise, and the obtained skeleton contour is accurate.
According to the invention, the distance cp in the skeleton outline is obtained m The nearest k skeleton contour points are combined with cp m As sample points in constructing covariance matrix, the corresponding sample points are usedThe x-coordinate and y-coordinate are used as two variables in constructing covariance matrix, thereby constructing cp m Corresponding covariance matrix M m,cov The method comprises the steps of carrying out a first treatment on the surface of the Then acquire M m,cov Corresponding maximum eigenvalue Val m,max And a minimum feature value Val m,min . The covariance matrix, the corresponding minimum eigenvalue and the maximum eigenvalue are obtained by the method in the prior art, and are not described here again.
Optionally, the preset response value threshold is 0.1.
S500, acquiring a connected domain T= (T) corresponding to C 1 ,t 2 ,…,t d ,…,t D ),t d And D is the number of the connected domains obtained by extracting the connected domains of C, wherein the value range of D is 1 to D.
Optionally, a region growing method is used to obtain the connected domain T corresponding to C. Those skilled in the art will appreciate that any method for obtaining a connected domain in the prior art falls within the scope of the present invention.
S600, traversing T, extracting T d The point of maximum response value.
The invention takes the points with the maximum response values in the communication domains in T as the characteristic points of the door plate frameworks, wherein the characteristic points of the door plate frameworks are key points for positioning the gluing areas on the door plate in the later period.
The method acquires the inner contour and the outer contour of the door plate, and for any outer contour point on the outer contour, the corresponding skeleton contour point is obtained by weighting and summing the coordinates of each point on a connecting line between the outer contour point and the inner contour point closest to the outer contour point, so that the obtained skeleton contour has a smoothing effect on noise, and the obtained skeleton contour is accurate; on the basis, the accuracy of the feature points of the skeleton outline further extracted according to the covariance matrix corresponding to the skeleton outline points on the skeleton outline is also higher.
While certain specific embodiments of the invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the invention. Those skilled in the art will also appreciate that many modifications may be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.