Image recognition method and device, and computer-readable storage medium

By performing geometric shape detection and direction line auxiliary processing on the point cloud data of the target geometry in the image, the accuracy and efficiency problems of target recognition under complex backgrounds are solved, and efficient image recognition is achieved.

CN113033248BActive Publication Date: 2024-09-13GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911252746.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-09
Publication Date
2024-09-13
Estimated Expiration
2039-12-09

AI Technical Summary

Technical Problem

Under the complex background in the image, it is difficult for the existing technology to accurately identify the target geometric shape and cannot distinguish multiple target objects of the same shape, resulting in low recognition efficiency and low accuracy.

Method used

By collecting point cloud data of the target image, perform geometric shape detection, obtain the direction line of the target geometric shape, perform validity detection based on the direction line and the preset detection threshold, iteratively process the target parameters, and finally convert the target geometric shape surface in the target image Plane expansion to obtain recognition results.

Benefits of technology

It improves the efficiency and accuracy of image recognition, reduces the calculation amount of the detection algorithm, and ensures that the recognition result is consistent with the target geometry corresponding to the direction line.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113033248B
    Figure CN113033248B
Patent Text Reader

Abstract

The embodiment of the present application discloses an image recognition method and device, and a computer-readable storage medium, which can improve the efficiency and accuracy of image recognition. The method includes: collecting a target image and obtaining point cloud data of the target image; performing geometric shape detection on the point cloud data to obtain target geometric shape parameters; obtaining direction lines of the target geometric shape on the display interface of the target image; performing validity detection on the target geometric shape parameters based on the direction lines and a preset detection threshold; when the target geometric shape parameters are detected to be valid, performing parameter iteration processing based on the target geometric shape parameters and the point cloud data to obtain the target parameters; based on the target parameters, performing planar expansion on the surface of the target geometric shape in the target image to obtain a recognition result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to an image recognition method and device, and a computer-readable storage medium. Background Art

[0002] At present, when performing target detection and target recognition on image information, there is a lot of interference information when the image contains a complex background, which is prone to misrecognition or recognition failure. The existing technology usually improves the recognition accuracy by adding special situation detection to the algorithm, but increasing the complexity of the algorithm will increase the computing cost, affect power consumption and real-time computing, and reduce recognition efficiency. Furthermore, when there are other graphics with the same shape as the target of interest in the same image, the existing algorithm cannot distinguish the target of interest and misdetection will occur. Summary of the invention

[0003] The embodiments of the present application are intended to provide an image recognition method and device, and a computer-readable storage medium, which can improve the efficiency and accuracy of image recognition.

[0004] The technical solution of this application is implemented as follows:

[0005] The present application provides an image recognition method, including:

[0006] Collect the target image and obtain the point cloud data of the target image;

[0007] Perform geometric shape detection on point cloud data to obtain target geometric shape parameters;

[0008] On the display interface of the target image, obtaining the direction line of the target geometric shape;

[0009] Based on the direction line and the preset detection threshold, the validity of the target geometric shape parameters is checked;

[0010] When it is detected that the target geometric shape parameters are valid, parameter iteration processing is performed based on the target geometric shape parameters and point cloud data to obtain the target parameters;

[0011] Based on the target parameters, the surface of the target geometric shape in the target image is plane-unfolded to obtain the recognition result.

[0012] The embodiment of the present application provides an image recognition device, including a collection unit, a shape detection unit, an interaction unit, a validity detection unit, an iteration unit and a recognition unit, wherein:

[0013] An acquisition unit, used for acquiring a target image and obtaining point cloud data of the target image;

[0014] A shape detection unit is used to perform geometric shape detection on point cloud data to obtain target geometric shape parameters;

[0015] An interaction unit, used for obtaining a direction line of a target geometric shape on a display interface of a target image;

[0016] A validity detection unit, used for performing validity detection on target geometric shape parameters based on the direction line and a preset detection threshold;

[0017] An iteration unit, for performing parameter iteration processing based on the target geometric shape parameters and the point cloud data to obtain the target parameters when it is detected that the target geometric shape parameters are valid;

[0018] The recognition unit is used to perform planar expansion on the surface of the target geometric shape in the target image based on the target parameters to obtain a recognition result.

[0019] An embodiment of the present application provides an image recognition device, a processor, a memory, and a communication bus. The memory communicates with the processor via the communication bus. The memory stores one or more programs executable by the processor. When one or more programs are executed, the processor executes the image recognition method as described in any one of the above items.

[0020] An embodiment of the present application provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the image recognition method as described in any one of the above items.

[0021] The embodiment of the present application provides an image recognition method and device, and a computer-readable storage medium, which can improve the efficiency and accuracy of image recognition. The method includes: collecting a target image and obtaining point cloud data of the target image; performing geometric shape detection on the point cloud data to obtain target geometric shape parameters; obtaining the direction line of the target geometric shape on the display interface of the target image; performing validity detection on the target geometric shape parameters based on the direction line and a preset detection threshold; when the target geometric shape parameters are detected to be valid, performing parameter iteration processing based on the target geometric shape parameters and the point cloud data to obtain the target parameters; based on the target parameters, performing a plane expansion on the surface of the target geometric shape in the target image to obtain a recognition result. By adopting the above method implementation scheme, the target geometric shape parameters can be judged for validity with the aid of the direction lines obtained from the display interface, and the target geometric shape parameters that meet the direction line constraints can be further iterated and calculated, thereby reducing the amount of iterative calculation of the image detection algorithm, improving the recognition efficiency, and ensuring that the target parameters finally obtained are consistent with the target geometric shape corresponding to the direction line, thereby improving the accuracy of image recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1-1 A schematic diagram of a scene for recognizing an image of a geometric shape surface in an image;

[0023] Figure 1-2 A schematic diagram of a scene for recognizing an image of a geometric shape surface in an image;

[0024] Figure 2 This is a schematic diagram of the image recognition effect when the background information of the target image is relatively complex;

[0025] Figure 3 A schematic diagram of the image recognition effect when there are multiple identical geometric shapes in the target image;

[0026] Figure 4 A schematic diagram of an image recognition system provided in an embodiment of the present application;

[0027] Figure 5 A flowchart of an image recognition method provided in an embodiment of the present application;

[0028] Figure 6 A flowchart of an image recognition method provided in an embodiment of the present application;

[0029] Figure 7 A schematic diagram of a method for receiving a trajectory line drawn for a target object in a target image;

[0030] Figure 8 A schematic diagram of a method for obtaining a direction line of a target geometric shape based on a trajectory line;

[0031] Fig. 9 A flowchart of an image recognition method provided in an embodiment of the present application;

[0032] Fig.10 A schematic diagram of a method for obtaining a direction line of a target geometric shape based on a trajectory line;

[0033] Fig.11 A flowchart of an image recognition method provided in an embodiment of the present application;

[0034] Fig.12 is a three-dimensional direction plane schematic diagram corresponding to the direction line in three-dimensional space;

[0035] Fig.13 A flowchart of an image recognition method provided in an embodiment of the present application;

[0036] Fig.14 A schematic diagram of a validity detection method provided in an embodiment of the present application;

[0037] Fig.15 A flowchart of an image recognition method provided in an embodiment of the present application;

[0038] Fig.16 A schematic diagram of the direction line of the target geometric shape obtained by dragging the target line segment;

[0039] Fig.17 A flowchart of an image recognition method provided in an embodiment of the present application;

[0040] Figure 18-1 A schematic diagram of obtaining the direction lines of the target geometry through text detection;

[0041] Figure 18-2 A schematic diagram of obtaining the direction lines of the target geometry through text detection;

[0042] Fig.19 A schematic diagram of the structure of an image recognition device provided by an embodiment of the present invention;

[0043] Fig. 20 A schematic diagram of the structure of an image recognition device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0045] At present, in the scene of recognizing the surface of geometric shapes in the image, for example, Figure 1-1 As shown, the image recognition is performed on the cylindrical outer packaging of the product, or as Figure 1-2 As shown in FIG, when performing image recognition on images and text information posted on cylindrical buildings, it is often encountered that the contour of the target geometric shape cannot be clearly detected due to the complex background information of the target image, resulting in failure in target geometric shape recognition, such as Figure 2 As shown; or there are multiple identical geometric shapes in the target image. Figure 3 As shown, when there are multiple cylinders in the target image, it is impossible to distinguish the target cylinder that needs surface image recognition. The current technical solution needs to increase the complexity of the algorithm to improve the recognition accuracy, and the recognition efficiency is low; and it is impossible to distinguish the target object that needs surface image recognition from multiple identical geometric shapes.

[0046] The image recognition system provided in the embodiment of the present application is as follows: Figure 4As shown, it includes an image acquisition module 10, a geometry detection module 20, an interface interaction module 30, a validity judgment module 40, a graphic transformation module 50 and a display module 60. Among them, the image acquisition module 10 is used to collect point cloud data of the target image, including an image acquisition device that can collect three-dimensional data information. Exemplarily, the image acquisition device can be a camera with a time of flight sensor (TOF, Time Of Fly), a structured light camera, a binocular camera, etc., and an RGB image acquisition device. The geometry detection module 20 is used to use an image detection algorithm to detect the target geometry parameters contained in the point cloud data of the target image according to a preset geometry type. The preset geometry type can be the same geometry type as the shape type of the target object to be identified. Exemplarily, when a cylindrical target object in the target image needs to be identified, the geometry type can be preset as a cylinder, and the geometry detection module 20 is used to detect the cylindrical shape parameters contained in the point cloud data of the target image. The interface interaction module 30 is used to receive external interactive operation information for the target object from the interactive interface of the image recognition system, and obtain the direction line of the target geometry according to the operation information. Exemplarily, a trajectory line drawn by a user on the axis position of a target object of interest, exemplarily a target cylinder, is received on the display screen of the terminal, and then the direction line of the target cylinder is obtained based on the trajectory line. The validity judgment module 40 is used to perform a validity check on the target geometric shape parameters detected by the geometry detection module 20 based on the direction line obtained from the interface interaction module 30, and confirm whether the geometric shape formed by the spatial range defined by the target geometric shape parameters is consistent with the target geometric shape where the direction line is located. If the two are consistent, the validity check passes. The geometry detection module 20 is also used to iterate the target geometric shape parameters that pass the validity check, and exemplarily, a random sampling consensus algorithm is used to optimize and iterate from the target geometric shape parameters that pass the validity check to obtain the best optimized target parameters. The graphic transformation module 50 is used to flatten the target geometric shape in the target image from a curved surface to a plane based on the target parameters, and obtain the recognition result of the target geometric shape. The display module 60 is used to display the recognition result on the display interface.

[0047] Figure 5 An optional flow chart of the image recognition method provided in the embodiment of the present application is combined with Figure 5 The steps shown are explained.

[0048] S101, collecting a target image and obtaining point cloud data of the target image.

[0049] The image recognition method provided in the embodiment of the present application is suitable for scenarios where surface image recognition and extraction of target geometric shapes in an image are performed.

[0050] Exemplarily, a scene in which notices or information on the surface of a building or a commodity is identified through image acquisition, or a scene in which a target obstacle is detected in the acquired image.

[0051] In the embodiment of the present application, the image recognition device first captures the target image through the image acquisition device and obtains the point cloud data of the target image.

[0052] In the embodiment of the present application, the point cloud data is a data set of three-dimensional coordinate points of the target image. The image recognition device needs to obtain the point cloud data of the target image through an image acquisition device that can obtain the three-dimensional information of the target image. For example, the image recognition device obtains the point cloud data through a TOF sensor integrated in the camera, or through a structured light device or a depth camera based on triangulation ranging technology, which is not limited in the embodiment of the present application.

[0053] In an embodiment of the present application, the point cloud data of the target image may be pre-stored point cloud data. For example, when a photo taken with a three-dimensional image acquisition device is scanned, the point cloud data pre-stored in the photo may be obtained. It may also be point cloud data obtained in real time from a distance sensor such as a TOF sensor or a lidar sensor. For example, when a camera viewfinder is used to directly take a photo or scan a physical target in a real environment, point cloud data obtained in real time may be obtained.

[0054] It should be noted that in the embodiment of the present application, when the TOF sensor integrated in the camera is used to obtain point cloud data, it has the characteristics of not being affected by lighting changes and object texture. While meeting the accuracy requirements, it can also reduce the cost of collecting point cloud data.

[0055] S102: Perform geometric shape detection on the point cloud data to obtain target geometric shape parameters.

[0056] In the embodiment of the present application, after acquiring the point cloud data, the image recognition device will perform geometric shape detection based on the point cloud data to obtain the target geometric shape parameters.

[0057] In an embodiment of the present application, when the geometric shape to be detected is a cylinder, the image recognition device can use a random sampling consensus algorithm to randomly select two points from the point cloud data, and perform normal estimation and normal constraint on the two selected points respectively, and calculate the cylinder parameters that can be represented by the two selected points and their corresponding normals as the target geometric shape parameters.

[0058] In the embodiment of the present application, the target geometric shape parameters may include an axis vector and a center point. In some embodiments, the axis vector n=(n x ,n y ,n z ), where nx ,n y ,n z are the three directional components of the axis vector n in three-dimensional space, the center point o=(o x ,o y ,o z ), where o x ,o y ,o z The three-dimensional coordinates of the center point.

[0059] S103: On the display interface of the target image, obtain the direction line of the target geometric shape.

[0060] In the embodiment of the present application, after obtaining the target geometric shape parameters, the image recognition device obtains the direction lines of the target geometric shape on the display interface of the target image.

[0061] In an embodiment of the present application, when the image recognition device turns on the image recognition function, collects the target image, and performs geometric shape detection on the point cloud data of the target image, the image recognition device can display an RGB camera preview image of the target image on the display interface, so that the user or other external interactive object can specify the axis of the target geometric shape in the preview image as the direction line of the target geometric shape.

[0062] In an embodiment of the present application, the image recognition device can obtain the direction lines provided by the external interaction information from the display interface, and use the direction lines as auxiliary information for identifying the target geometric shape, so as to limit the result range of the geometric shape detection, so that the detected target geometric shape parameters conform to the target geometric shape specified by the direction lines selected in the interaction information.

[0063] In the present application embodiment, based on Figure 5 The image recognition device can obtain the direction line of the target geometric shape on the display interface of the target image as follows Figure 6 As shown, including S1031-S1032, as follows:

[0064] S1031. On a display interface of a target image, receiving a trajectory line drawn for a target object in the target image; wherein the target object is an object in the target image that conforms to a target geometric shape.

[0065] In the embodiment of the present application, the image recognition device can adopt a method in which the user draws on the target object in the RGB camera preview image to obtain a trajectory line drawn by the user on the axis of the target object through a touch and drag operation.

[0066] For example, Figure 7As shown in the figure, the user draws a trajectory line P on the axis of the cylinder in the display interface by touching and dragging, where P is composed of {p0, p1, p2, …, p N}, where the coordinates of the i-th trajectory point p i =(u i ,v i ), where u i is the horizontal coordinate of the ith trajectory point, v i is the ordinate of the i-th trajectory point.

[0067] In the embodiment of the present application, the target object is an object in the target image that conforms to the target geometric shape. Exemplarily, when the target image contains a complex background, or the target image contains multiple graphic objects of the same shape, the image recognition device can receive a trajectory line drawn by the user on the target of interest on the display interface of the target image to distinguish the target object from the background image and other graphic objects of the same shape.

[0068] It should be noted that, in order to ensure that the direction line is correct, the trajectory line drawn for the target object in the target image is preferably drawn on the axis of the target object.

[0069] S1032. Obtain a direction line of the target geometric shape based on the cross vector product of the three-dimensional coordinates of the starting position and the three-dimensional coordinates of the end position in the trajectory line.

[0070] In the embodiment of the present application, after the image recognition device obtains the trajectory line, it can obtain the direction line of the target geometric shape based on the start and end points in the trajectory line.

[0071] In the present application embodiment, as mentioned above Figure 7 As shown, the trajectory line drawn on the display interface is an irregular curve composed of multiple continuous trajectory points. In order to extract the direction information and normalization information contained in the trajectory line, the image recognition device will perform a cross product based on the three-dimensional coordinates of the starting position and the three-dimensional coordinates of the end position in the trajectory line, and use the vector product of the cross product as the direction line of the target geometric shape.

[0072] In the embodiment of the present application, the image recognition device can obtain the direction line of the target geometric shape based on the cross product of the three-dimensional coordinates of the starting position and the three-dimensional coordinates of the end position in the trajectory line through formula (1), and the formula (1) is as follows:

[0073] l=p0×p N (1)

[0074] Among them, p0 is the three-dimensional coordinate of the starting point of the trajectory line in homogeneous coordinates, p Nis the three-dimensional coordinate of the end point of the trajectory line in homogeneous coordinates, l is the two-dimensional direction line corresponding to the trajectory line, l can contain the three direction components of the two-dimensional direction line in three-dimensional space l = (l x ,l y ,l z ).

[0075] In formula (1), the image recognition device converts the three-dimensional coordinates of the starting position p0 and the three-dimensional coordinates of the end position p N Perform a cross product to obtain the vector product of the three-dimensional coordinates of the starting position and the end point position as the direction line of the target geometric shape, such as Figure 8 As shown, in Figure 8 The starting position three-dimensional coordinate p0 and the end position three-dimensional coordinate p N The corresponding direction line is the starting position three-dimensional coordinate p0 and the end position three-dimensional coordinate p N The direction line is calculated by the cross-vector product of .

[0076] In the present application embodiment, based on Figure 6 The image recognition device can also obtain the direction line of the target geometric shape on the display interface of the target image as follows Fig. 9 As shown, including S1033-S1034, as follows:

[0077] S1033. Perform principal component analysis based on the trajectory line to obtain the principal component direction and the three-dimensional coordinate mean point of each trajectory point on the trajectory line.

[0078] In the embodiment of the present application, the image recognition device may also perform principal component analysis (PCA) on the drawn trajectory line to obtain the principal component direction of the set of all trajectory points on the trajectory line and the three-dimensional coordinate mean point of each trajectory point.

[0079] In the present application embodiment, Fig.10 As shown, the image recognition device performs PCA analysis on the trajectory line P to obtain the PCA principal component direction v0 of the trajectory line P and the three-dimensional coordinate mean point of each trajectory point on the trajectory line

[0080] S1034. Obtain the direction line of the target geometric shape based on the principal component direction and the three-dimensional coordinate mean point.

[0081] In an embodiment of the present application, the principal component direction of the trajectory line represents the direction information of the trajectory line, and the three-dimensional coordinate mean point of each trajectory point on the trajectory line represents the normalized coordinate information of each trajectory point. The image recognition device can obtain the direction line of the target geometric shape based on the principal component direction and the three-dimensional coordinate mean point.

[0082] In the embodiment of the present application, the image recognition device can obtain the direction line of the target geometric shape based on the principal component direction and the three-dimensional coordinate mean point through formula (2), and formula (2) is as follows:

[0083]

[0084] Among them, based on the three-dimensional coordinate mean point of the principal component direction v0 obtained in S1033 The image recognition device can cross-multiply the sum of the three-dimensional coordinate mean point and the principal component direction with the three-dimensional coordinate mean point to obtain a two-dimensional direction line l corresponding to the trajectory line.

[0085] S104: Perform validity detection on the target geometric shape parameters based on the direction line and the preset detection threshold.

[0086] In the embodiment of the present application, after the image recognition device obtains the direction line, it will perform validity detection on the target geometric shape parameters based on the direction line and the preset detection threshold.

[0087] In the embodiment of the present application, as described in S102, the target geometric shape parameters are target geometric shape parameters obtained by extracting sampling points from the point cloud data by the image recognition device and performing geometric shape detection based on the extracted sampling points. Therefore, the target geometric shape parameters obtained by one detection are not necessarily the parameters of the target geometric shape corresponding to the target object specified by the direction line. Therefore, in order to improve the accuracy of image recognition, it is necessary to perform a validity check on whether the geometric shape constituted by the target geometric shape parameters is the target geometric shape specified by the direction line.

[0088] In the present application embodiment, based on Fig. 9 The method for detecting the validity of the target geometric shape parameters by the image recognition device based on the direction line and the preset detection threshold can be as follows: Fig.11 As shown, including S1041-S1042, as follows:

[0089] S1041. Based on a preset imaging projection matrix, plane fitting processing is performed on the direction line to obtain characteristic parameters of the three-dimensional direction plane; the three-dimensional direction plane is the plane where the direction line is located in the three-dimensional space, and the characteristic parameters include three coordinate components and one normal vector component.

[0090] In an embodiment of the present application, since the direction lines are obtained on the display interface of the image acquisition, the image recognition device can perform plane fitting processing on the direction lines based on the preset imaging projection matrix of the image acquisition device, and find the plane where the direction lines are located in the three-dimensional space of the camera coordinate system as the three-dimensional direction plane, so as to further use the characteristic parameters of the three-dimensional direction plane to perform validity detection on the target geometric shape parameters.

[0091] In the embodiment of the present application, the characteristic parameters of the three-dimensional directional plane include three coordinate components and one normal vector component.

[0092] In the embodiment of the present application, the image recognition device performs a plane fitting process on the direction line based on the preset imaging projection matrix. The three-dimensional direction plane formed by the camera optical axis and the direction line can be calculated by the preset imaging projection matrix. The three-dimensional direction plane formed by the camera optical axis and the direction line can be as follows: Fig.12 As shown, π is a three-dimensional directional plane, which contains four plane feature parameters, π(a, b, c, d), where a, b, c are the three coordinate components of the three-dimensional directional plane, and d is the normal vector component of the three-dimensional directional plane.

[0093] In the embodiment of the present application, the preset imaging projection matrix may be a 3*4 matrix, wherein the values ​​of the matrix elements are known values ​​related to the parameters of the specific camera hardware and lens; the three direction vectors included in the direction line may be a 3*1 matrix, and the image recognition device may perform plane fitting processing on the direction line based on the preset imaging projection matrix by formula (3), as follows:

[0094] π=P T l (3)

[0095] Wherein, P is the preset imaging projection matrix.

[0096] In formula (3), the image recognition device can transpose the preset imaging projection matrix P to obtain a transposed 4*3 matrix P T , and then transpose the 4*3 matrix P T Multiply the 3*1 matrix corresponding to the direction line l, and calculate the four characteristic parameters of the three-dimensional direction plane π according to the equation obtained after the multiplication.

[0097] S1042: Based on the characteristic parameters of the three-dimensional directional plane and a preset detection threshold, the validity of the target geometric shape parameters is detected.

[0098] In the embodiment of the present application, after the image recognition device obtains the three-dimensional direction plane after plane fitting processing of the direction line, it will compare the angle and position of the three-dimensional direction plane with the geometric shape formed by the target geometric shape parameters to verify whether the geometric shape formed by the target geometric shape parameters is on the three-dimensional direction plane specified by the direction line. Specifically, the image recognition device will perform validity detection on the target geometric shape parameters based on the characteristic parameters of the three-dimensional direction plane and the preset detection threshold.

[0099] In the present application embodiment, based on Fig.11 In S1042, based on the characteristic parameters of the three-dimensional directional plane and the preset detection threshold, the validity detection of the target geometric shape parameters can be performed as follows: Fig.13As shown, including S301-S303, as follows:

[0100] S301. Take the absolute value of the dot product of the three coordinate components and the axis vector to obtain a first result.

[0101] In the embodiment of the present application, the image recognition device can calculate the angle between the axis vector of the target geometric shape parameter and the three-dimensional direction plane as the first result.

[0102] In the embodiment of the present application, the image recognition device can use formula (4) to take the absolute value of the dot product of the three coordinate components and the axis vector to obtain a first result, as follows:

[0103] θ=|(a,b,c)·n| (4)

[0104] Wherein, θ is the angle between the axis vector in the target geometric shape parameters and the three-dimensional direction plane, i.e., the first result. The image recognition device multiplies the three coordinate components (a, b, c) in the feature parameters of the three-dimensional direction plane and the axis vector n in the target geometric shape parameters, and takes the absolute value of the dot product to obtain the first result θ, which represents the angle between the axis vector in the target geometric shape parameters and the three-dimensional direction plane.

[0105] S302. Calculate the distance from the center point to the three-dimensional direction plane according to the three-dimensional coordinates of the center point and the characteristic parameters of the three-dimensional direction plane to obtain a second result.

[0106] In the embodiment of the present application, the image recognition device can calculate the distance from the center point to the three-dimensional direction plane according to the three-dimensional coordinates of the center point and the characteristic parameters of the three-dimensional direction plane through formula (5), and obtain the second result as follows:

[0107]

[0108] Among them, x ,o y ,o z The image recognition device converts the three-dimensional coordinates of the center point o into x ,o y ,o z Substitute the three-dimensional plane feature parameters (a, b, c, d) into formula (5) for calculation to obtain the second calculation result D, where D is the distance from the center point o to the three-dimensional direction plane π (a, b, c, d).

[0109] S303: When the first result is less than or equal to a preset angle threshold, and the second result is less than or equal to a preset distance threshold, determine that the target geometric shape parameters are valid.

[0110] In an embodiment of the present application, after the image recognition device obtains the first result and the second result, the validity of the target geometric shape parameters is checked based on the first result and the second result. When the first result is less than or equal to a preset angle threshold and the second result is less than or equal to a preset distance threshold, it is determined that the target geometric shape parameters are valid.

[0111] In the embodiment of the present application, the preset angle threshold may be a set angle tolerance constant θ t In some embodiments of the present application, the preset angle threshold may be 0.1 or other values, which is not limited in the embodiments of the present application.

[0112] In the embodiment of the present application, the preset distance threshold may be a set distance tolerance constant d t The preset distance threshold may also be a variable related to the depth coordinate in the center point coordinate. For example, the preset distance threshold may be set to d t o z .

[0113] In the present application embodiment, Fig.14 As shown, when the first result is less than or equal to the preset angle threshold, that is, θ<θ t ; and the second result is less than or equal to the preset distance threshold, that is, D <d t o z or D <d t This indicates that the angle between the axis vector of the target geometric shape and the three-dimensional direction plane is small, that is, the inclination is consistent, and that the distance between the center point of the target geometric shape and the three-dimensional direction plane is close, that is, the spatial position is close, indicating that the target geometric shape is the target object corresponding to the direction line on the display interface, and the image recognition device determines that the target geometric shape parameters are valid.

[0114] S105 . When it is detected that the target geometric shape parameters are valid, parameter iteration processing is performed based on the target geometric shape parameters and the point cloud data to obtain the target parameters.

[0115] In the embodiment of the present application, when it is detected that the target geometry parameters are valid, for the first iteration, the image recognition device uses the valid target geometry parameters as the initial target geometry parameters, and randomly selects two points from the point cloud data again to calculate and detect the validity of the next target geometry parameters. When the next target geometry parameters also pass the validity test, the image recognition device obtains the current valid target geometry parameters. The image recognition device compares the initial target geometry parameters obtained in the first iteration with the current valid target geometry parameters. If the current valid target geometry parameters have a higher degree of fit, the current valid target geometry parameters are used as the optimal target geometry parameters, and the target geometry parameters are calculated, tested for validity, and updated for the optimal parameters in the same way in subsequent iterations. When the iteration conditions are finally met, the image recognition device can obtain the target parameters.

[0116] S106. Based on the target parameters, the surface of the target geometric shape in the target image is plane-unfolded to obtain a recognition result.

[0117] In the embodiment of the present application, the image recognition device can perform planar expansion on the surface of the target geometric shape in the target image based on the target parameters to obtain a recognition result.

[0118] In an embodiment of the present application, the target parameter is a curved surface parameter of a target geometric shape corresponding to a target image. The image recognition device can unfold the curved surface represented by the target parameter into a plane based on the target parameter, and use the image after the plane is unfolded as the recognition result.

[0119] In the embodiment of the present application, the image recognition device can use existing methods to unfold the curved surface in the space into a flat surface, which will not be described in detail in the embodiment of the present application.

[0120] It can be understood that in the embodiments of the present application, with the aid of direction lines obtained from the display interface, the validity of the target geometric shape parameters can be judged, and the target geometric shape parameters that meet the direction line constraints can be limited for further iterative calculation, thereby reducing the amount of computational iteration of the image detection algorithm, improving recognition efficiency, and ensuring that the target parameters finally obtained are consistent with the target geometric shape corresponding to the direction lines, thereby improving the accuracy of image recognition.

[0121] In the embodiment of the present application, after S105, S107 is further included as follows:

[0122] S107: When it is detected that the target geometry parameters are invalid, the parameter iteration process is not performed, and the target geometry parameters are re-acquired for validity detection.

[0123] In an embodiment of the present application, when it is detected that the target geometric shape parameters are invalid, it means that the target geometric shape represented by the target geometric shape parameters does not match the target object corresponding to the direction line. Therefore, the image recognition device does not use the invalid target geometric shape parameters for iterative optimization, and re-selects image points from the point cloud data to calculate the target geometric shape parameters and performs validity detection.

[0124] It is understandable that when it is detected that the target geometric shape parameters are invalid, the image recognition device does not apply the invalid parameters for further processing, but reselects the point cloud data for a new round of calculation and detection of the target geometric shape parameters, thereby reducing the computational workload and screening the target geometric shape parameters for effectiveness, ultimately improving the efficiency and accuracy of image recognition.

[0125] In the embodiment of the present application, in S103, the method for the image recognition device to obtain the direction line of the target geometric shape on the display interface of the target image can also be as follows: Fig.15 As shown, including S401-S402, as follows:

[0126] S401. On a display interface of a target image, receiving a drag command for a target line segment in a target image; the target line segment is any line segment on a target object in the target image that conforms to a target geometric shape.

[0127] In an embodiment of the present application, the image recognition device may also pre-display, on the display interface of the target image, any line segment on the target object that conforms to the target geometric shape in the target image as a target line segment, and receive a drag command for the target line segment in the target image.

[0128] S402 . Based on the drag command, drag the target line segment to obtain a direction line of the target geometric shape, where the direction line of the target geometric shape is consistent with the axis line of the target object.

[0129] In the embodiment of the present application, the image recognition device can drag the target line segment based on the drag instruction so that the target line segment is consistent with the axis of the target object as the direction line of the target geometric shape.

[0130] In some embodiments of the present application, for example, when the target geometry is a cylinder, Fig.16 As shown, the image recognition device pre-displays the axis corresponding to the cylinder on the screen, and the user drags and rotates the pre-displayed axis to make it consistent with the axis of the cylinder.

[0131] In the embodiment of the present application, in S103, the method for the image recognition device to obtain the direction line of the target geometric shape on the display interface of the target image can also be as follows: Fig.17 As shown, including S501-S504, as follows:

[0132] S501. On a display interface of a target image, perform text detection on a target object in a target image to obtain at least one text box on the target object; wherein the target object is an object in the target image that conforms to a target geometric shape.

[0133] In the embodiment of the present application, the image recognition device can also obtain at least one text box on the target object by performing text detection on the target object on the target image display interface.

[0134] In the embodiment of the present application, compared with the complex pattern shape, at least one text box is a regular shape on the target object, and a direction line corresponding to the target object can be generated based on the at least one text box.

[0135] In an embodiment of the present application, the image recognition device can use a text detection algorithm such as a Seglink model or an Efficient and Accurate Scene Text Detector (EAST) to perform text detection on the target object and extract the direction of the text to obtain at least one text box.

[0136] S502: Receive a trigger instruction for a target object, and obtain a trigger position from the trigger instruction.

[0137] In the present application embodiment, Figure 18-1 As shown, the image recognition device receives a trigger instruction for a target object on a display interface, and obtains the display interface coordinates corresponding to the operation in the trigger instruction as a trigger position.

[0138] In the embodiment of the present application, the trigger instruction may be a click instruction or other forms of screen operation instructions, which is not limited in the embodiment of the present application.

[0139] S503: In at least one text box, determine a target text box within a preset area of ​​the trigger position.

[0140] In the embodiment of the present application, after the image recognition device obtains the trigger position, in at least one text box, a text box within a preset area of ​​the trigger position is determined as a target text box.

[0141] In some embodiments of the present application, the image recognition device may also determine that the text box closest to the trigger position among the at least one text box is the target text box.

[0142] S504: Use the vertical direction of the target text box as the direction line of the target geometric shape.

[0143] In the present application embodiment, Figure 18-2As shown, since the target text box is the text box closest to the trigger position, the target object where the target text box is located is most likely the target object specified by the trigger position, so the image recognition device uses the vertical direction of the target text box as the direction line.

[0144] It can be understood that in the embodiments of the present application, the image recognition device can obtain the direction lines of the target geometric shape through a variety of interactive methods, thereby limiting the image recognition range through interactive methods and improving the efficiency and accuracy of image recognition.

[0145] The present application embodiment provides an image recognition device 5, such as Fig.19 As shown, the image recognition device 5 includes a collection unit 100, a shape detection unit 200, an interaction unit 300, a validity detection unit 400, an iteration unit 500 and a recognition unit 600, wherein:

[0146] The acquisition unit 100 is used to acquire a target image and obtain point cloud data of the target image;

[0147] The shape detection unit 200 is used to perform geometric shape detection on the point cloud data to obtain target geometric shape parameters;

[0148] The interaction unit 300 is used to obtain the direction line of the target geometric shape on the display interface of the target image;

[0149] The validity detection unit 400 is used to perform validity detection on the target geometric shape parameters based on the direction line and a preset detection threshold;

[0150] The iteration unit 500 is used to perform parameter iteration processing based on the target geometric shape parameters and the point cloud data to obtain target parameters when it is detected that the target geometric shape parameters are valid;

[0151] The recognition unit 600 is used to perform planar expansion on the surface of the target geometric shape in the target image based on the target parameters to obtain a recognition result.

[0152] In some embodiments of the present application, the validity detection unit 400 is further used to perform plane fitting processing on the direction line based on a preset imaging projection matrix to obtain characteristic parameters of a three-dimensional direction plane; the three-dimensional direction plane is a plane where the direction line is located in the three-dimensional space, and the characteristic parameters include three coordinate components and one normal vector component;

[0153] Based on the characteristic parameters of the three-dimensional directional plane and the preset detection threshold, the validity of the target geometric shape parameters is detected.

[0154] In some embodiments of the present application, the interaction unit 300 is also used to receive a trajectory line drawn for a target object in the target image on the display interface of the target image; wherein the target object is an object in the target image that conforms to a target geometric shape; and based on the cross product vector product of the three-dimensional coordinates of the starting position and the three-dimensional coordinates of the end position in the trajectory line, obtain a direction line of the target geometric shape; or, based on the trajectory line, perform a principal component analysis to obtain the principal component direction and the mean point of the three-dimensional coordinates of each trajectory point on the trajectory line; and based on the principal component direction and the mean point of the three-dimensional coordinates, obtain the direction line of the target geometric shape.

[0155] In some embodiments of the present application, the interaction unit 300 is also used to receive a drag command for a target line segment in the target image on the display interface of the target image; the target line segment is any line segment on the target object that conforms to the target geometric shape in the target image; and based on the drag command, the target line segment is dragged to obtain a direction line of the target geometric shape, and the direction line of the target geometric shape is consistent with the axis of the target object.

[0156] In some embodiments of the present application, the interaction unit 300 is also used to perform text detection on the target object in the target image on the display interface of the target image to obtain at least one text box on the target object; wherein the target object is an object in the target image that conforms to the target geometric shape; and receive a trigger instruction for the target object and obtain a trigger position from the trigger instruction; and within the at least one text box, determine a target text box within a preset area range of the trigger position; and use the vertical direction of the target text box as the direction line of the target geometric shape.

[0157] In some embodiments of the present application, the validity detection unit 400 is further used to transpose the preset imaging projection matrix, and use the product of the transposed preset imaging projection matrix and the direction vector contained in the direction line as a characteristic parameter of the three-dimensional direction plane.

[0158] In some embodiments of the present application, the target geometric shape parameters include an axis vector and a center point, and the axis vector and the center point correspond one to one; the preset detection threshold includes a preset angle threshold and a preset distance threshold; the validity detection unit 400 is also used to take the absolute value of the dot product of the three coordinate components and the axis vector to obtain a first result; and calculate the distance from the center point to the three-dimensional direction plane based on the three-dimensional coordinates of the center point and the characteristic parameters of the three-dimensional direction plane to obtain a second result; and when the first result is less than or equal to the preset angle threshold, and the second result is less than or equal to the preset distance threshold, it is determined that the target geometric shape parameters are valid.

[0159] In some embodiments of the present application, the validity detection unit 400 is further used to not perform parameter iteration processing and re-acquire the target geometric shape parameters for validity detection when it is detected that the target geometric shape parameters are invalid.

[0160] In some embodiments of the present application, the acquisition unit 100 is further used to acquire point cloud data through a time-of-flight sensor.

[0161] The present application embodiment provides an image recognition device 6, such as Fig. 20 As shown, the image recognition device 6 includes: a processor 125, a memory 126 and a communication bus 127. The memory 126 communicates with the processor 125 via the communication bus 127. The memory 126 stores one or more programs executable by the processor 125. When the one or more programs are executed, the processor 125 executes the image recognition method as described in any one of the above items.

[0162] An embodiment of the present application provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the image recognition method as described in any one of the above items.

[0163] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0164] The present application is described with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0165] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0166] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0167] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. An image recognition method, characterized in that: include: Collecting a target image and obtaining point cloud data of the target image; Performing geometric shape detection on the point cloud data to obtain target geometric shape parameters; On the display interface of the target image, obtaining a direction line of the target geometric shape; Based on the direction line and a preset detection threshold, performing validity detection on the target geometric shape parameters; When it is detected that the target geometric shape parameters are valid, performing parameter iteration processing based on the target geometric shape parameters and the point cloud data to obtain target parameters; Based on the target parameters, plane unfolding is performed on the surface of the target geometric shape in the target image to obtain a recognition result; Wherein, obtaining the direction line of the target geometric shape on the display interface of the target image includes: On the display interface of the target image, receiving a trajectory line drawn for a target object in the target image; wherein the target object is an object in the target image that conforms to a target geometric shape; Obtaining a direction line of the target geometric shape based on a cross product of the three-dimensional coordinates of the starting position and the three-dimensional coordinates of the end position in the trajectory line; Alternatively, based on the trajectory line, a principal component analysis is performed to obtain the principal component direction and the three-dimensional coordinate mean point of each trajectory point on the trajectory line; Based on the principal component directions and the three-dimensional coordinate mean point, the direction line of the target geometric shape is obtained.

2. The method according to claim 1, characterized in that: The performing validity detection on the candidate parameters of the target geometric shape based on the direction line and the preset detection threshold comprises: Based on a preset imaging projection matrix, plane fitting processing is performed on the direction line to obtain characteristic parameters of a three-dimensional direction plane; the three-dimensional direction plane is a plane where the direction line is located in the three-dimensional space, and the characteristic parameters include three coordinate components and one normal vector component; Based on the characteristic parameters of the three-dimensional directional plane and the preset detection threshold, the validity of the target geometric shape parameters is detected.

3. The method according to claim 1 or 2, characterized in that: The step of obtaining a direction line of a target geometric shape on a display interface of the target image includes: On the display interface of the target image, receiving a drag command for a target line segment in the target image; the target line segment is any line segment on a target object that conforms to a target geometric shape in the target image; Based on the drag instruction, the target line segment is dragged to obtain a direction line of the target geometric shape, and the direction line of the target geometric shape is consistent with the axis of the target object.

4. The method according to claim 1 or 2, characterized in that: The step of obtaining a direction line of a target geometric shape on a display interface of the target image includes: On the display interface of the target image, text detection is performed on the target object in the target image to obtain at least one text box on the target object; wherein the target object is an object in the target image that conforms to the target geometric shape; receiving a trigger instruction for the target object, and obtaining a trigger position from the trigger instruction; In the at least one text box, determining a target text box within a preset area of ​​the trigger position; The vertical direction of the target text box is used as the direction line of the target geometric shape.

5. The method according to claim 1, characterized in that The process of performing plane fitting processing on the direction lines based on a preset imaging projection matrix to obtain characteristic parameters of a three-dimensional direction plane includes: The preset imaging projection matrix is ​​transposed, and the product of the transposed preset imaging projection matrix and the direction vector included in the direction line is used as a characteristic parameter of the three-dimensional direction plane.

6. The method according to claim 2, characterized in that The target geometric shape parameters include an axis vector and a center point, and the axis vector and the center point correspond to each other one by one; the preset detection threshold includes a preset angle threshold and a preset distance threshold; The performing validity detection on the target geometric shape parameters based on the characteristic parameters of the three-dimensional directional plane and the preset detection threshold comprises: Taking the absolute value of the dot product of the three coordinate components and the axis vector to obtain a first result; Calculate the distance from the center point to the three-dimensional direction plane according to the three-dimensional coordinates of the center point and the characteristic parameters of the three-dimensional direction plane to obtain a second result; When the first result is less than or equal to the preset angle threshold, and the second result is less than or equal to the preset distance threshold, it is determined that the target geometric shape parameters are valid.

7. The method according to claim 1, characterized in that After performing validity detection on the target geometric shape parameters based on the direction line and the preset detection threshold, the method further includes: When it is detected that the target geometric shape parameters are invalid, parameter iteration processing is not performed, and the target geometric shape parameters are re-acquired for validity detection.

8. The method according to claim 1, characterized in that The step of acquiring the point cloud data of the target image comprises: Acquire point cloud data through time-of-flight sensors.

9. An image recognition device, characterized in that: The image recognition device includes a collection unit, a shape detection unit, an interaction unit, a validity detection unit, an iteration unit and a recognition unit, wherein: The acquisition unit is used to acquire a target image and obtain point cloud data of the target image; The shape detection unit is used to perform geometric shape detection on the point cloud data to obtain target geometric shape parameters; The interaction unit is used to obtain the direction line of the target geometric shape on the display interface of the target image; The validity detection unit is used to perform validity detection on the target geometric shape parameters based on the direction line and a preset detection threshold; The iteration unit is used to perform parameter iteration processing based on the target geometric shape parameters and the point cloud data to obtain target parameters when it is detected that the target geometric shape parameters are valid; The recognition unit is used to perform plane expansion on the surface of the target geometric shape in the target image based on the target parameter to obtain a recognition result; The interaction unit is specifically used to receive a trajectory line drawn for a target object in the target image on a display interface of the target image; wherein the target object is an object in the target image that conforms to a target geometric shape; based on a cross vector product of the three-dimensional coordinates of a starting position and the three-dimensional coordinates of an end position in the trajectory line, obtain a direction line of the target geometric shape; or, based on the trajectory line, perform a principal component analysis to obtain principal component directions and a mean point of the three-dimensional coordinates of each trajectory point on the trajectory line; based on the principal component directions and the mean point of the three-dimensional coordinates, obtain a direction line of the target geometric shape.

10. An image recognition device, characterized in that: include: A processor, a memory and a communication bus, wherein the memory communicates with the processor via the communication bus, the memory stores one or more programs executable by the processor, and when the one or more programs are executed, the processor executes the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method according to any one of claims 1 to 8.