Parameter measurement method and device, electronic equipment and storage medium
By determining the straight line as the coordinate axis in the second image of the workpiece, constructing a reference coordinate system, and measuring the geometric parameters of the geometric figure in the first image, the problem in the existing technology that the reference coordinate system cannot be conveniently set is solved, and the efficiency is improved Convenience and accuracy of workpiece parameter measurement.
Patent Information
- Application Number
- CN202410425621.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-09
- Publication Date
- 2024-08-30
AI Technical Summary
The existing technology cannot conveniently set the reference coordinate system of the workpiece according to the user's needs, resulting in the user being unable to directly set the reference coordinate system in the image, thus complicating the measurement process of the workpiece parameters.
By displaying the second image of the target workpiece, determining the straight line as the coordinate axis in response to the linear axis command, constructing the reference coordinate system, and determining the geometric parameters of the geometric figure in the first image, displaying the geometric parameters in the target reference coordinate system, allowing Users set the reference coordinate system according to their needs.
It improves the convenience for users to measure workpiece parameters. Users can intuitively determine workpiece parameters, simplifying the measurement process and reducing complexity.
Smart Images

Figure CN118565330A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer image technology, and in particular to a parameter measurement method, device, electronic device and storage medium. Background Art
[0002] Measurement and positioning applications are the most widely used applications of machine vision in the industrial field. In order to determine whether the parameters of the workpiece meet the production application requirements, it is usually necessary to measure the parameters of the workpiece through an image containing the workpiece. In the prior art, in order to measure the parameter information of the workpiece, the coordinates of the feature points in the image coordinate system of the image are usually converted to the physical coordinate system or physical quantity through the hand-eye calibration matrix or the single pixel accuracy of the camera, and then the coordinates, distances, position degrees and other information between the feature points are obtained according to the physical quantity or in the physical coordinate system. Among them, the single pixel accuracy of the camera = the camera's single-direction field of view size / the camera's single-direction resolution. This scheme can only realize the conversion from the image coordinate system to the physical coordinate system, but because different reference objects may be required when measuring different parameters of the workpiece, different reference coordinate systems are required to measure different parameters. In the above measurement scheme, only the physical coordinate system can be used as the reference coordinate system to obtain the measurement results. Therefore, the measurement scheme cannot set the reference coordinate system for the image containing the workpiece according to the user's needs to measure the workpiece parameters, so that the user cannot set the reference coordinate system according to his own needs when measuring the parameters, so that the user cannot easily obtain the measurement results of the workpiece parameters. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a parameter measurement method, device, electronic device and storage medium to improve the convenience of users in measuring workpiece parameters. The specific technical solution is as follows:
[0004] The present application provides a parameter measurement method, the method comprising:
[0005] displaying a first image of a target workpiece;
[0006] In response to a graphics instruction input for the first image, determining a geometric figure indicated by the graphics instruction;
[0007] Determine geometric parameters of the geometric figure in a target reference coordinate system, and display the determined geometric parameters;
[0008] The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner:
[0009] displaying a second image of the target workpiece;
[0010] In response to a linear axis instruction inputted with respect to the geometric structure of the target workpiece in the second image, determining a straight line indicated by the linear axis instruction;
[0011] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0012] In a possible embodiment, the method further includes: in response to a parameter input operation for the second image input, determining the numerical value input by the parameter input operation as a scaling factor between the reference coordinate system and the image coordinate system of the second image; constructing a coordinate system with the determined straight line as the coordinate axis as the reference coordinate system, including: constructing a coordinate system with the determined straight line as the coordinate axis and the scaling factor as the scaling scale as the reference coordinate system.
[0013] In a possible embodiment, the method further includes: predetermining a plurality of the reference coordinate systems as alternative reference coordinate systems; and in response to a coordinate system selection instruction input for the first image, determining the alternative reference coordinate system indicated by the coordinate system selection instruction as the target reference coordinate system.
[0014] In a possible embodiment, the method further includes: in response to an information selection operation input for the second image, determining preset coordinate system information selected by the information selection operation as target coordinate system information; and displaying the reference coordinate system and the target coordinate system information in the second image;
[0015] Among them, the preset coordinate system information includes: the origin coordinates of the reference coordinate system, the coordinate system angle of the reference coordinate system, the direction vector coordinates of the X-axis of the reference coordinate system, the direction vector coordinates of the Y-axis of the reference coordinate system, the angle between the X-axis of the reference coordinate system and the positive direction of the X-axis of the image coordinate system of the second image, and the angle between the Y-axis of the reference coordinate system and the positive direction of the Y-axis of the image coordinate system.
[0016] In a possible embodiment, determining the geometric parameters of the geometric figure in the target reference coordinate system includes: projecting the geometric parameters of the geometric figure in the image coordinate system into the target reference coordinate system according to a coordinate transformation relationship between the target reference coordinate system and an image coordinate system of the first image, to obtain the geometric parameters of the geometric figure in the target reference coordinate system;
[0017] The coordinate transformation relationship is determined in advance in the following manner:
[0018] The target reference coordinate system is translated to obtain an offset reference coordinate system, wherein the origin of the offset reference coordinate system coincides with the origin of the image coordinate system;
[0019] Determine the angle between the direction vector of the X-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system as the first angle, and determine the angle between the direction vector of the Y-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system as the second angle;
[0020] According to the first angle and the second angle, determining a basis in the X-axis direction of the offset reference coordinate system as a first basis, and determining a basis in the Y-axis direction of the offset reference coordinate system as a second basis;
[0021] A coordinate transformation relationship is determined according to the first basis and the second basis.
[0022] In a possible embodiment, the target workpiece is a tablet computer;
[0023] The step of determining, in response to a graphics instruction input for the first image, a geometric figure indicated by the graphics instruction, comprises:
[0024] In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, the geometric figure being two end points of a long side or a short side of a screen of the tablet computer;
[0025] The step of determining geometric parameters of the geometric figure in the target reference coordinate system and displaying the determined geometric parameters includes:
[0026] Determine geometric parameters of the geometric figure in a target reference coordinate system, and display the determined geometric parameters, wherein the geometric parameters are the distances between two endpoints of a long side or a short side of the screen of the tablet computer in the target reference coordinate system;
[0027] The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner:
[0028] displaying a second image of the tablet computer;
[0029] In response to a linear axis instruction inputted for the geometric structure of the tablet computer in the second image, determining a straight line indicated by the linear axis instruction, wherein the straight line indicated by the linear axis instruction is a straight line where a long side of the inner screen of the tablet computer screen is located, and a straight line where a short side of the inner screen of the tablet computer screen is located;
[0030] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0031] In a possible embodiment, the target workpiece is a mobile phone;
[0032] The step of determining, in response to a graphics instruction input for the first image, a geometric figure indicated by the graphics instruction, comprises:
[0033] In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, wherein the geometric figure is two endpoints of a long side or a short side of an outer edge of the mobile phone charging hole;
[0034] The step of determining geometric parameters of the geometric figure in the target reference coordinate system and displaying the determined geometric parameters includes:
[0035] Determine the geometric parameters of the geometric figure in the target reference coordinate system, and display the determined geometric parameters, wherein the geometric parameters are the distance between two endpoints of the long side or short side of the outer edge of the mobile phone charging hole in the target reference coordinate system;
[0036] The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner:
[0037] displaying a second image of the mobile phone;
[0038] In response to a linear axis instruction input for the geometric structure of the mobile phone in the second image, determining a straight line indicated by the linear axis instruction, wherein the straight line indicated by the linear axis instruction is a straight line where the long side of the outer edge of the mobile phone charging hole is located, and a straight line where the short side of the outer edge of the mobile phone charging hole is located;
[0039] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0040] The present application also provides a parameter measurement device, the device comprising:
[0041] A first image display module, used to display a first image of a target workpiece;
[0042] a geometric figure determination module, configured to determine, in response to a graphic instruction input for the first image, a geometric figure indicated by the graphic instruction;
[0043] A geometric parameter display module, used to determine the geometric parameters of the geometric figure in the target reference coordinate system and display the determined geometric parameters;
[0044] The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner:
[0045] displaying a second image of the target workpiece;
[0046] In response to a linear axis instruction inputted with respect to the geometric structure of the target workpiece in the second image, determining a straight line indicated by the linear axis instruction;
[0047] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0048] In a possible embodiment, the device also includes: a scaling factor determination module, which is used to determine the numerical value input by the parameter input operation in response to the parameter input operation for the second image input, as the scaling factor between the reference coordinate system and the image coordinate system of the second image; the constructing of a coordinate system with the determined straight line as the coordinate axis as the reference coordinate system includes: constructing a coordinate system with the determined straight line as the coordinate axis and the scaling factor as the scaling scale as the reference coordinate system.
[0049] In a possible embodiment, the device also includes: an alternative reference coordinate system determination module, used to predetermine a plurality of the reference coordinate systems as alternative reference coordinate systems; and a target reference coordinate system determination module, used to respond to a coordinate system selection instruction input for the first image and determine the alternative reference coordinate system indicated by the coordinate system selection instruction as the target reference coordinate system.
[0050] In a possible embodiment, the device further includes: a target coordinate system information determination module, configured to, in response to an information selection operation input for the second image, determine the preset coordinate system information selected by the information selection operation as the target coordinate system information; a target coordinate system information display module, configured to display the reference coordinate system and the target coordinate system information in the second image;
[0051] Among them, the preset coordinate system information includes: the origin coordinates of the reference coordinate system, the coordinate system angle of the reference coordinate system, the direction vector coordinates of the X-axis of the reference coordinate system, the direction vector coordinates of the Y-axis of the reference coordinate system, the angle between the X-axis of the reference coordinate system and the positive direction of the X-axis of the image coordinate system of the second image, and the angle between the Y-axis of the reference coordinate system and the positive direction of the Y-axis of the image coordinate system.
[0052] In a possible embodiment, determining the geometric parameters of the geometric figure in the target reference coordinate system includes: projecting the geometric parameters of the geometric figure in the image coordinate system into the target reference coordinate system according to a coordinate transformation relationship between the target reference coordinate system and an image coordinate system of the first image, to obtain the geometric parameters of the geometric figure in the target reference coordinate system;
[0053] The coordinate transformation relationship is determined in advance in the following manner:
[0054] The target reference coordinate system is translated to obtain an offset reference coordinate system, wherein the origin of the offset reference coordinate system coincides with the origin of the image coordinate system;
[0055] Determine the angle between the direction vector of the X-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system as the first angle, and determine the angle between the direction vector of the Y-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system as the second angle;
[0056] According to the first angle and the second angle, determining a basis in the X-axis direction of the offset reference coordinate system as a first basis, and determining a basis in the Y-axis direction of the offset reference coordinate system as a second basis;
[0057] A coordinate transformation relationship is determined according to the first basis and the second basis.
[0058] In a possible embodiment, the target workpiece is a tablet computer;
[0059] The step of determining, in response to a graphics instruction input for the first image, a geometric figure indicated by the graphics instruction, comprises:
[0060] In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, the geometric figure being two end points of a long side or a short side of a screen of the tablet computer;
[0061] The step of determining geometric parameters of the geometric figure in the target reference coordinate system and displaying the determined geometric parameters includes:
[0062] Determine geometric parameters of the geometric figure in a target reference coordinate system, and display the determined geometric parameters, wherein the geometric parameters are the distances between two endpoints of a long side or a short side of the screen of the tablet computer in the target reference coordinate system;
[0063] The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner:
[0064] displaying a second image of the tablet computer;
[0065] In response to a linear axis instruction inputted for the geometric structure of the tablet computer in the second image, determining a straight line indicated by the linear axis instruction, wherein the straight line indicated by the linear axis instruction is a straight line where a long side of the inner screen of the tablet computer screen is located, and a straight line where a short side of the inner screen of the tablet computer screen is located;
[0066] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0067] In a possible embodiment, the target workpiece is a mobile phone;
[0068] The step of determining, in response to a graphics instruction input for the first image, a geometric figure indicated by the graphics instruction, comprises:
[0069] In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, wherein the geometric figure is two endpoints of a long side or a short side of an outer edge of the mobile phone charging hole;
[0070] The step of determining geometric parameters of the geometric figure in the target reference coordinate system and displaying the determined geometric parameters includes:
[0071] Determine the geometric parameters of the geometric figure in the target reference coordinate system, and display the determined geometric parameters, wherein the geometric parameters are the distance between two endpoints of the long side or short side of the outer edge of the mobile phone charging hole in the target reference coordinate system;
[0072] The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner:
[0073] displaying a second image of the mobile phone;
[0074] In response to a linear axis instruction input for the geometric structure of the mobile phone in the second image, determining a straight line indicated by the linear axis instruction, wherein the straight line indicated by the linear axis instruction is a straight line where the long side of the outer edge of the mobile phone charging hole is located, and a straight line where the short side of the outer edge of the mobile phone charging hole is located;
[0075] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0076] The present application also provides an electronic device, including:
[0077] Memory, used to store computer programs;
[0078] The processor is used to implement any of the above-mentioned parameter measurement methods when executing the program stored in the memory.
[0079] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned parameter measurement methods is implemented.
[0080] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the parameter measurement methods described above.
[0081] Beneficial effects of the embodiments of the present application:
[0082] The parameter measurement method, device, electronic device and storage medium provided in the embodiment of the present application can determine the straight line indicated by the straight line axis instruction through the linear axis instruction input for the geometric structure of the target workpiece in the second image, and construct a coordinate system with the determined straight line as the coordinate axis, and set the reference coordinate system in the second image containing the target workpiece in advance as a reference coordinate system to obtain the target reference coordinate system. In addition, through the graphic instruction input for the first image, the geometric figure indicated by the graphic instruction is determined, the geometric parameters of the geometric figure in the target reference coordinate system are determined, and the determined geometric parameters are displayed. Since the target reference coordinate system is set by the user according to the geometric structure of the workpiece according to his own needs, and the geometric figure is determined by the image instruction input by the user, the geometric parameters of the geometric figure in the target reference coordinate system are the parameters of the target workpiece that the user needs to measure, and the user can intuitively determine the required parameter information of the workpiece through the displayed geometric parameters, thereby improving the convenience of the user in measuring and judging the workpiece parameters.
[0083] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0085] Figure 1 A schematic diagram of an application scenario of the parameter measurement method provided in an embodiment of the present application;
[0086] Figure 2 A schematic diagram of a flow chart of a parameter measurement method provided in an embodiment of the present application;
[0087] Figure 3a A schematic diagram of a measurement interface provided in an embodiment of the present application;
[0088] Figure 3b A schematic diagram showing geometric parameters provided in an embodiment of the present application;
[0089] Figure 3c Another schematic diagram showing geometric parameters provided in an embodiment of the present application;
[0090] Figure 4a A schematic diagram of an image coordinate system provided in an embodiment of the present application;
[0091] Figure 4b A schematic diagram of a target reference coordinate system provided in an embodiment of the present application;
[0092] Figure 4c A schematic diagram of an offset reference coordinate system provided in an embodiment of the present application;
[0093] Figure 5a A schematic diagram of an interface for a coordinate system setting interface provided in an embodiment of the present application;
[0094] Figure 5b A schematic diagram of a straight line indicated by a linear axis instruction provided in an embodiment of the present application;
[0095] Figure 5c Another schematic diagram of a target reference coordinate system provided in an embodiment of the present application;
[0096] Figure 5d Another schematic diagram of a target reference coordinate system provided in an embodiment of the present application;
[0097] Figure 5e A schematic diagram showing the preset coordinate system information provided in an embodiment of the present application;
[0098] Figure 6 A schematic diagram of an interface for inputting a scaling parameter provided in an embodiment of the present application;
[0099] Figure 7 Another schematic diagram of a flow chart of a parameter measurement method provided in an embodiment of the present application;
[0100] Figure 8a A schematic diagram of a first image provided in an embodiment of the present application;
[0101] Figure 8b Another schematic diagram of a target reference coordinate system provided in an embodiment of the present application;
[0102] Figure 8c A schematic diagram showing the measurement results provided in the embodiment of the present application;
[0103] Figure 8d Another schematic diagram showing the measurement results provided in the embodiment of the present application;
[0104] Figure 9a Another schematic diagram of a first image provided in an embodiment of the present application;
[0105] Figure 9b Another schematic diagram of a target reference coordinate system provided in an embodiment of the present application;
[0106] Fig.9cAnother schematic diagram showing the measurement results provided in the embodiment of the present application;
[0107] Figure 9d Another schematic diagram showing the measurement results provided in the embodiment of the present application;
[0108] Fig.10 A schematic diagram of the structure of a parameter measurement device provided in an embodiment of the present application;
[0109] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0110] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0111] In order to more clearly illustrate the parameter measurement method provided in the present application, the possible application scenarios of the parameter measurement method provided in the present application will be exemplified below. It can be understood that the following examples are only possible application scenarios of the parameter measurement method provided in the present application. In other possible embodiments, the parameter measurement method provided in the present application can also be applied to other possible application scenarios, and the following examples do not impose any limitations on this.
[0112] See also Figure 1 , Figure 1 This is a schematic diagram of a possible workpiece. When photographing, the workpiece may not be placed neatly or the angle of the photographing device may be uncertain. Therefore, the image of the workpiece may be a tilted image of the workpiece, such as Figure 1 As shown in . There are two circular elements installed on the workpiece, and the centers of the two circular elements are center A and center B respectively. Then the line segment AB formed by the centers of the two circular elements needs to be parallel to the straight line CD where the outer contour of the workpiece is located, and the length of the line segment AB, that is, the distance between the centers of the two circular elements, also needs to meet the requirements of workpiece production. Therefore, the user needs to measure the two geometric parameters of the angle between the line segment AB formed by the centers of the two circular elements and the straight line CD, and the length of the line segment AB, so as to determine whether the two circular elements installed on the workpiece meet the requirements of workpiece production.
[0113] In the prior art, users can only convert the coordinates of point A and point B in the image coordinate system to the physical coordinate system through the hand-eye calibration matrix, thereby obtaining the coordinates of point A and point B in the physical coordinate system. The distance of line segment AB also needs to be calculated by the coordinates of point A and point B in the physical coordinate system, and the angle between line segment AB and line CD needs to be obtained through more complex calculations. Therefore, the solution of the prior art can only measure the geometric parameters required by the user using the physical coordinate system as the reference coordinate system, and the method of obtaining the measurement results of this solution is relatively complicated. Users cannot directly set the reference coordinate system in the image according to their needs, so that users cannot easily obtain the measurement results of the workpiece parameters.
[0114] Based on this, the present application provides a parameter measurement method, such as Figure 2 As shown, the following steps may be specifically included:
[0115] S201, displaying a first image of a target workpiece.
[0116] S202: In response to a graphics instruction input for a first image, determine a geometric figure indicated by the graphics instruction.
[0117] S203, determining geometric parameters of the geometric figure in the target reference coordinate system, and displaying the determined geometric parameters.
[0118] Among them, the target reference coordinate system is a preconfigured reference coordinate system, and the reference coordinate system is pre-determined in the following manner: displaying a second image of the target workpiece; in response to a linear axis instruction input for the geometric structure of the target workpiece in the second image, determining the straight line indicated by the linear axis instruction; and constructing a coordinate system with the determined straight line as the coordinate axis as the reference coordinate system.
[0119] By selecting this embodiment, the straight line indicated by the straight line axis instruction can be determined by inputting the straight line axis instruction for the geometric structure of the target workpiece in the second image, and a coordinate system with the determined straight line as the coordinate axis can be constructed. As a reference coordinate system, the reference coordinate system is set in advance in the second image containing the target workpiece to obtain the target reference coordinate system. Furthermore, the geometric figure indicated by the graphic instruction can be determined by inputting the graphic instruction for the first image, the geometric parameters of the geometric figure in the target reference coordinate system can be determined, and the determined geometric parameters can be displayed. Since the target reference coordinate system is set by the user according to the geometric structure of the workpiece according to his own needs, and the geometric figure is determined by the image instruction input by the user, the geometric parameters of the geometric figure in the target reference coordinate system are the parameters of the target workpiece that the user needs to measure, and the user can intuitively determine the required parameter information of the workpiece through the displayed geometric parameters, thereby improving the convenience of the user in measuring and judging the workpiece parameters.
[0120] The above S201-S203 will be described below by way of example, wherein:
[0121] In S201, the first image may be obtained by capturing the target workpiece through any image sensor (such as a camera, etc.). The first image may include the entire target workpiece, or only a part of the target workpiece. For example, if the target workpiece is a mobile phone, the first image may be obtained by photographing the front of the entire mobile phone where the screen is located, that is, the first image includes the entire mobile phone. The first image may also be obtained by photographing a certain part of the mobile phone, such as the volume button, power button, charging port, etc., that is, the first image only includes a part of the mobile phone. If the target workpiece is a circuit board, the first image may include the entire circuit board, or may only include components in a certain area of the circuit board.
[0122] In S202, the geometric figure indicated by the graphic instruction may refer to a variety of graphics such as a line, a point, a circle, etc. The user may input the graphic instruction for the first image through the measurement interface, and may select different measurement interfaces according to different graphic instructions input as needed. For example, if the geometric figure indicated by the graphic instruction is a point and a point, that is, the user needs to measure the distance between two points, then the measurement interface may be an interface for point-to-point measurement; if the geometric figure indicated by the graphic instruction is a point and a line, that is, the user needs to measure the distance from a point to a line, then the measurement interface may be an interface for point-to-line measurement.
[0123] For example, see Figure 3a , Figure 3a The measurement interface of point-to-point measurement is shown, in which "0 Image Source 1. Image" displayed after the input source in the image input refers to the identification of the first image, indicating that the first image is the image numbered 1 acquired by the image sensor numbered 0. In this example, the geometric figure refers to the point, and the user can input the graphic instruction by inputting the point or the coordinate input method to determine the point indicated by the graphic instruction. The following will take input point 1 as an example to illustrate the two input methods of inputting points and inputting coordinates. The method of inputting point 2 is the same as the method of inputting point 1 described below, and will not be repeated here.
[0124] In the case where the input method is point input, after the user clicks the link symbol in the input box after "input point 1", the user can directly draw the point to be selected in the first image as the input point 1 through the drawing module, or select the point he needs from the list of points in the first image output by each search module as the input point 1. Among them, the search module can be a circle search module, a rectangle search module, a line search module and other types of search modules, each search module has a corresponding label, and a search module may output multiple results, each result corresponds to a different label, and the results output by each search module correspond to the specific search method of each search module. For example, the results output by the line search module can include a line, and the results output by the circle search module can include a circle, a center of a circle, etc.
[0125] exist Figure 3a In the example shown, point-by-point measurement is required, and the user needs to select the point in the search module whose output result can be a point. And when the input method is input point, the user needs to select the required point from the various types of points output by the search module. Different types of points refer to various types of points such as the center of a circle, the focus of an ellipse, and the center of a rectangle.
[0126] For example, Figure 3a The "7 circle search 2. center of circle" shown in can be used as the identifier corresponding to the point in the first image output by the search module, and the identifier represents the center of the circle numbered 2 in the first image output by the circle search module numbered 7. In other examples, the input point 1 can also be the center point of a rectangle in the first image output by the rectangle search module, that is, the intersection of the diagonal lines of the rectangle. If the rectangle search module is numbered 6 and the center point of the rectangle is numbered 1, the identifier corresponding to the point 1 may be "6 rectangle search 1. center point".
[0127] When the input mode is inputting coordinates, the user can directly input the coordinates of the point to be selected in the image coordinate system of the first image, or can click the link symbol in the input box after "Input point 1" and select the point he needs from the list of points in the first image output by each search module as input point 1. Since the input mode is inputting coordinates, the points output by the search module are displayed in the form of the X coordinate of the point and the Y coordinate of the point.
[0128] In S203, if the geometric figure indicated by the graphic instruction is a point, the geometric parameter may refer to the coordinates of the point in the target reference coordinate system. If the geometric figure indicated by the graphic instruction is two points, the geometric parameter may refer to the distance between the two points in the target reference coordinate system, or the distance between the two points in the X direction in the target reference coordinate system, or the distance between the two points in the Y direction in the target reference coordinate system. If the geometric figure indicated by the graphic instruction is a point and a line, the geometric parameter may refer to the shortest distance, the farthest distance, the average distance and the perpendicular point coordinates between the point and the line in the target reference coordinate system. If the geometric figure indicated by the graphic instruction is two lines, the geometric parameter may refer to the distance between the two lines in the target reference coordinate system, or the distance between the two lines in the X direction in the target reference coordinate system, or the distance between the two lines in the Y direction in the target reference coordinate system, or the angle and intersection coordinates of the two lines.
[0129] If the target workpiece is Figure 1 The first image can be Figure 3b As shown above Figure 1 According to the description, the user needs to measure the angle between the line segment AB connecting the centers of the two circular components and the straight line CD, as well as the length of the line segment AB, two geometric parameters, to determine whether the two circular components installed on the target workpiece meet the production requirements of the target workpiece. Therefore, the target reference coordinate system can be set with the straight line where the outer contour of the target workpiece is located as the X-axis and Y-axis respectively. The specific setting of the target reference coordinate system will be explained below and will not be repeated here. In this example, the target reference coordinate system can be as follows Figure 3b The coordinate system is shown in .
[0130] because Figure 3b The Y axis of the target reference coordinate system shown is on the same straight line as the straight line CD where the outer contour of the target workpiece is located. Therefore, if the distance between point A and point B in the X direction of the target reference coordinate system is 0, it can be considered that the line connecting point A and point B is parallel to the Y axis of the target reference coordinate system, that is, parallel to the straight line CD where the outer contour of the target workpiece is located. Therefore, the user only needs to measure the distance between point A and point B in the X direction of the target reference coordinate system to determine whether the line segment AB connecting the centers of the two circular components on the target workpiece is parallel to the straight line CD where the outer contour of the target workpiece is located, and through the distance between point A and point B in the target reference coordinate system, it can be determined whether the distance between the centers of the two circular components on the target workpiece meets the requirements for the production of the target workpiece.
[0131] Therefore, the user needs to obtain the distance between geometric point A and point B in the X direction of the target reference coordinate system, and the distance between the two points. This allows the user to intuitively determine whether the two circular components installed on the target workpiece meet the production requirements of the target workpiece. Figure 3a After determining the geometric figure points A and B in the measurement interface shown in the figure, click the execute button in the measurement interface to obtain the measured geometric parameters, which will be displayed in the first image. The measured geometric parameters are as follows: Figure 3b The value shown above. Figure 3b In the target reference coordinate system shown in Figure 3b From the “Output distance between two points in X direction: 2.016602” displayed above, we can know that the distance between point A and point B in X direction is 2.016602mm. Figure 3b From the “Output distance between two points in Y direction: 538.769” displayed above, we can know that the distance between point A and point B in the Y direction is 538.769mm. Figure 3b From the “Absolute distance: 538.7728” displayed above, we can see that the distance between point A and point B is 538.7728mm.
[0132] The target reference coordinate system can also be Figure 3c As shown in Figure 3b The only difference is that the directions of the Y axis are opposite, so the distances of the corresponding measured points A and B in the Y direction of the target reference coordinate system are also opposite. Figure 3b The distance between point A and point B in the Y direction in the target reference coordinate system shown is 538.769 mm. Figure 3c The pixel distance between point A and point B in the Y direction in the target reference coordinate system shown is -538.7701 mm. Figure 3c In the target reference coordinate system shown in Figure 3c From the “Output distance between two points in X direction: 0.6304932” displayed above, we can know that the distance between point A and point B in X direction is 0.6304932mm; according to Figure 3c From the “Output the Y distance between two points: -538.7701” displayed above, we can see that the distance between point A and point B in the Y direction is -538.7701mm; according to Figure 3c From the “Absolute distance: 538.7704” displayed above, we can see that the distance between point A and point B is 538.7704mm.
[0133] Regarding the method of obtaining the geometric parameters of the geometric figure in the target reference coordinate system, in a possible embodiment, the geometric parameters of the geometric figure in the image coordinate system can be projected into the target reference coordinate system according to the coordinate transformation relationship between the target reference coordinate system and the image coordinate system of the first image to obtain the geometric parameters of the geometric figure in the target reference coordinate system.
[0134] The coordinate transformation relationship is determined in advance in the following manner: the target reference coordinate system is translated to obtain an offset reference coordinate system, and the origin of the offset reference coordinate system coincides with the origin of the image coordinate system; the angle between the direction vector of the X-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system is determined as the first angle, and the angle between the direction vector of the Y-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system is determined as the second angle; according to the first angle and the second angle, the basis of the X-axis direction of the offset reference coordinate system is determined as the first basis, and the basis of the Y-axis direction of the offset reference coordinate system is determined as the second basis; according to the first basis and the second basis, the coordinate transformation relationship is determined.
[0135] The following will take the geometric figure as a point and the geometric parameter as the coordinates of the point as an example to exemplify how to determine the geometric parameters of the geometric figure in the target reference coordinate system.
[0136] See also Figure 4a , Figure 4a The figure shows a schematic diagram of the image coordinate system of the first image. The origin O(0, 0) of the image coordinate system XOY is the upper left corner of the first image. The positive direction of the X axis is horizontally to the right, and the positive direction of the Y axis is vertically downward. The coordinates of the geometric point P in the image coordinate system are (P x , P y ).
[0137] See also Figure 4b , Figure 4b The coordinate system X'O'Y' shown in is the target reference coordinate system. The coordinates of the origin O' of the target reference coordinate system X'O'Y' in the image coordinate system are (T x , T y ), that is, the offset of the origin coordinate of the target reference coordinate system relative to the origin of the image coordinate system is (T x , T y ). The two X-axis and Y-axis of the target reference coordinate system are X' and Y' respectively, and the directions are as follows Figure 4b as shown in .
[0138] If you need to determine the coordinates of the geometric point P in the target reference coordinate system (P x ',P y'), it is necessary to determine the coordinate transformation relationship between the target reference coordinate system X'O'Y' and the image coordinate system XOY of the first image in advance, and project the coordinates of the geometric point P in the image coordinate system XOY to the target reference coordinate system X'O'Y' according to the coordinate transformation relationship, so as to obtain the coordinates of the geometric point P in the target reference coordinate system X'O'Y'. The following is an exemplary description of the method for determining the coordinate transformation relationship.
[0139] The target reference coordinate system X'O'Y' is translated to obtain the offset reference coordinate system X"OY", so that the origin of the offset reference coordinate system X"OY" coincides with the origin of the image coordinate system XOY. The offset reference coordinate system X"OY" is as follows Figure 4c As shown in . The direction vector of the X axis of the offset base coordinate system X"OY" The angle θ between the positive direction of the X axis of the image coordinate system XOY is used as the first angle, and the direction vector of the Y axis of the offset reference coordinate system X"OY" is used as the first angle. The angle between the positive direction of the X axis of the image coordinate system XOY As the second angle, the first angle θ and the second angle like Figure 4c as shown in .
[0140] Then, the base of the image coordinate system XOY in the X-axis direction is The base in the Y direction And offset the base of the X-axis direction of the reference coordinate system X"OY" As the first base, the base in the Y-axis direction of the offset reference coordinate system X"OY" As the second basis. The coordinate transformation relationship can be described in many ways. The following will take the coordinate transformation relationship as a matrix as an example. Assume that the coordinate transformation relationship is Then the coordinate transformation relationship M can be obtained by the following formula (1):
[0141]
[0142] By applying Gaussian elimination method to formula (1), the coordinate transformation relationship M can be obtained, as shown in the following formula (2):
[0143]
[0144] According to the coordinate transformation relationship, the coordinates of the geometric point P in the image coordinate system XOY are projected into the target reference coordinate system X'O'Y', and the coordinates of the geometric point P in the target reference coordinate system X'O'Y' can be obtained. Specifically, the coordinates of point P in the offset reference coordinate system X"OY" can be obtained by the following formula (3):
[0145]
[0146] Then, the offset of the origin coordinate of the target reference coordinate system relative to the origin of the image coordinate system is (T x , T y ) and the above formula (3), the coordinates of point P in the target reference coordinate system X'O'Y' can be obtained by the following formula (4):
[0147]
[0148] If you need to calculate the geometric parameters of geometric figure points P and Q in the target reference coordinate system, the X-direction distance, Y-direction distance and distance between the two points of the geometric parameter point Q to point P in the target reference coordinate system, and assume that the coordinates of point Q in the target reference coordinate system X'O'Y' are The distance between point Q and point P in the target reference coordinate system in the X direction is dx, the distance in the Y direction is dy, and the distance between the two points is distance. The geometric parameters can be calculated using the following formulas (5) and (6):
[0149]
[0150]
[0151] By selecting this embodiment, the geometric parameters of the geometric figure in the target reference coordinate system can be determined only through the coordinate conversion relationship between the target reference coordinate system and the image coordinate system of the first image, and the user can intuitively judge whether the target workpiece meets the production requirements based on the geometric parameters of the geometric figure in the target reference coordinate system, thereby avoiding the extensive use of coordinate conversion tools, reducing the complexity of the parameter measurement solution, effectively improving the debugging efficiency, reducing the development and maintenance costs, and improving the convenience of users in measuring and judging the workpiece parameters.
[0152] In the above embodiment, if the target reference coordinate system is a world coordinate system, then when calculating the geometric parameters of the geometric figure in the target reference coordinate system, the scaling between the image coordinate system of the first image and the target reference coordinate system also needs to be considered, wherein the world coordinate system may refer to the physical coordinate system of the motion mechanism, or may refer to a fixed reference physical coordinate system, and this application does not make any limitation on this. Assuming that there are s pixels within 1 mm in the X direction or Y direction of the target reference coordinate system, that is, the scaling is s, then the coordinate transformation relationship M is as shown in the following formula (7):
[0153]
[0154] Since the target reference coordinate system is the world coordinate system, the first angle θ and the second angle It can be obtained by decomposing the hand-eye calibration matrix. The hand-eye calibration matrix refers to the coordinate system transformation matrix obtained by calibrating the camera and the motion mechanism. Assume that the hand-eye calibration matrix is a 3×3 matrix If the angle between the X-axis and the Y-axis of the target reference coordinate system is 90°, the first angle θ can be calculated by the following formula (8):
[0155]
[0156] The second angle It can be calculated by the following formula (9):
[0157]
[0158] Corresponding to the coordinate transformation relationship M calculated by the above formula (7), the coordinates of point P in the offset reference coordinate system X"OY" can be obtained by the following formula (10):
[0159]
[0160] Correspondingly, the calculation formula (4) for the coordinates of point P in the target reference coordinate system X'O'Y' changes according to the change of the coordinate transformation relationship M.
[0161] In addition, the scaling scales of the target reference coordinate system in the X and Y directions can be different. For example, the scaling scale in the X direction is s x , the Y-direction scaling is s y , and then the coordinate transformation relationship M is as shown in the following formula (11):
[0162]
[0163] Among them, s x and y It can be obtained by decomposing the hand-eye calibration matrix. Assume that the hand-eye calibration matrix is a 3×3 matrix Then the scaling scale s of the target reference coordinate system in the X direction is x It can be calculated by the following formula (12):
[0164]
[0165] The scaling scale s of the target reference coordinate system in the Y direction y It can be calculated by the following formula (13):
[0166]
[0167] Corresponding to the coordinate transformation relationship M calculated by the above formula (11), the coordinates of point P in the offset reference coordinate system X"OY" can be obtained by the following formula (14):
[0168]
[0169] Correspondingly, the calculation formula (4) for the coordinates of point P in the target reference coordinate system X'O'Y' changes according to the change of the coordinate transformation relationship M.
[0170] The target reference coordinate system is a pre-configured reference coordinate system, and therefore, the description of the specific setting method of the reference coordinate system is the description of the specific setting method of the target reference coordinate system. The specific setting method of the reference coordinate system will be exemplarily described below. The reference coordinate system can be determined in advance by: displaying a second image of the target workpiece; in response to a linear axis instruction input for the geometric structure of the target workpiece in the second image, determining the straight line indicated by the linear axis instruction; and constructing a coordinate system with the determined straight line as the coordinate axis as the reference coordinate system.
[0171] The first image and the second image may be the same image of the target workpiece, or may be different images of the target workpiece. For example, if the target workpiece is a relatively large device such as a circuit board of a television, one image may not be able to capture the entire target workpiece. Therefore, multiple images containing the target workpiece may be captured. In this case, the first image and the second image may be different images of the target workpiece. A reference coordinate system is set in the second image as a target reference coordinate system. When measuring the first image, the first image and the second image may be jigsawed so that the target reference coordinate system set in the second image can be used in the first image.
[0172] In another possible example, the first image and the second image may be images of the target workpiece captured by different image sensors. Assuming that the first image is captured by image sensor 1 and the second image is captured by image sensor 2, the reference coordinate system set in the second image can be used as the target reference coordinate system, and based on the mapping relationship between image sensor 1 and image sensor 2, the target reference coordinate system set in the second image can be mapped to the first image, so that the target reference coordinate system set in the second image can be used in the first image.
[0173] The linear axis instructions entered by the user can be Figure 5a The coordinate system setting interface of the coordinate system module shown is input, see Figure 5a , where "0 Image Source 1. Image" displayed after the input source in the image input refers to the identifier of the second image, indicating that the second image is the image with the label 1 captured by the image sensor with the label 0. Figure 5a The examples shown are similar to Figure 3aIn the example shown, the first image and the second image are images of the same target workpiece. In this example, the user can input the linear axis instruction by line, point or coordinate input, thereby determining the straight line indicated by the linear axis instruction. The following will take the input of the X-axis straight line as an example to illustrate the input method by line. The method of inputting the Y-axis straight line is the same as the method of inputting the X-axis straight line described below, and will not be repeated here.
[0174] After the user clicks the link symbol in the input box after "Line", the user can directly draw the required straight line as the input X-axis straight line in the second image according to the geometric structure of the target workpiece through the drawing module, or select the straight line he needs as the input X-axis straight line from the list of straight lines in the second image output by each search module. Among them, the search module can be a straight line search module, a line-to-line measurement module and other types of search modules, and as described above, each search module has a corresponding label, and a search module may output multiple results, each result corresponds to a different label, and the results output by each search module correspond to the specific search method of each search module.
[0175] For example, Figure 5a The “3 Line Measurement 1. Measure Line 1” shown in the figure can be used as the mark corresponding to the line in the second image output by the search module, and the mark indicates the measured line 1 with the mark 1 in the first image output by the line measurement module with the mark 3. The “3 Line Measurement 1. Measure Line 2” displayed after the line in the Y-axis input indicates the measured line 2 with the mark 1 in the first image output by the line measurement module with the mark 3.
[0176] For example, if the target workpiece is the aforementioned Figure 1 as well as Figure 3b , Figure 3c If the workpiece is shown in FIG. 1 , the straight line indicated by the linear axis instruction input by the user according to the geometric structure of the target workpiece can be as follows Figure 5b As shown in this example, the linear axis command is input according to the outer contour of the target workpiece. Figure 5b The angle between the two straight lines shown is 90.0°.
[0177] After completing the input of the linear axis command, the user can click Figure 5a The coordinate system setting interface shown in FIG. 1 is executed to construct a coordinate system with the straight line determined by the linear axis instruction as the coordinate axis as the reference coordinate system. In addition, the reference coordinate system can be displayed in the second image. Figure 5b The reference coordinate system constructed by the straight line shown can be Figure 5c As shown, it can also be Figure 5d As shown, Figure 5c and Figure 5d The reference coordinate systems shown differ only in that the direction of the Y axis is opposite.
[0178] By selecting this embodiment, the setting process of the reference coordinate system can be made interactive through the coordinate system setting interface, and the position and direction of the reference coordinate system can be intuitively displayed in the second image, so as to help users determine a more accurate reference coordinate system as the target reference coordinate system, thereby improving the accuracy of the geometric parameters obtained in the target reference coordinate system.
[0179] And, in Figure 5c In the example shown, the information of the reference coordinate system can be displayed in the second image. Figure 5c The information of the reference coordinate system displayed in the figure includes: the X coordinate of the origin of the reference coordinate system, the Y coordinate of the origin, and the angle of the coordinate system. Figure 5c The information displayed shows Figure 5c The X coordinate of the origin of the reference coordinate system is 108.9481, the Y coordinate of the origin is 300.6497, and the angle of the coordinate system is 90.0296°; according to Figure 5d The information displayed shows Figure 5d The X coordinate of the origin of the reference coordinate system is 112.1188, the Y coordinate of the origin is 323.0335, and the angle of the coordinate system is 90.11784°. Figure 5c In addition to the information displayed in the example, a lot of other information is also included, such as: the X-axis angle and Y-axis angle of the reference coordinate system. Therefore, the user may also need to view other information of the reference coordinate system in the second image, or the user does not want to view the information of the reference coordinate system in the second image and only needs to display the reference coordinate system.
[0180] Based on this, in a possible embodiment, the parameter measurement method provided by the present application also includes: in response to an information selection operation input for the second image, determining the preset coordinate system information selected by the information selection operation as the target coordinate system information; displaying the reference coordinate system and the target coordinate system information in the second image; wherein the preset coordinate system information includes: the origin coordinates of the reference coordinate system, the coordinate system angle of the reference coordinate system, the direction vector coordinates of the X-axis of the reference coordinate system, the direction vector coordinates of the Y-axis of the reference coordinate system, the angle between the X-axis of the reference coordinate system and the positive direction of the X-axis of the image coordinate system of the second image, and the angle between the Y-axis of the reference coordinate system and the positive direction of the Y-axis of the image coordinate system.
[0181] Users can use the aforementioned Figure 5aThe "Result Display" input information selection operation in the coordinate system setting interface shown, and the preset coordinate system information selected by the information selection operation input by the user is used as the target coordinate system information, and the reference coordinate system and the target coordinate system information are displayed in the second image. In addition, the user can also select whether the reference coordinate system is displayed in the second image through "Result Display". In actual applications, in order to facilitate users to determine whether the created reference coordinate system is accurate, the reference coordinate system is generally displayed in the second image by default.
[0182] By selecting this embodiment, the user can choose the reference coordinate system information displayed in the second image, thereby making it easier for the user to understand the set reference coordinate system and helping the user to determine a more accurate reference coordinate system as the target reference coordinate system, thereby improving the accuracy of the geometric parameters obtained under the target reference coordinate system.
[0183] Regarding the display of the preset coordinate system information of the reference coordinate system, in a possible embodiment, it can be displayed below the second image, see Figure 5e shown.
[0184] The user can set the coordinate system module through the coordinate system setting interface so that the coordinate system module constructs a reference coordinate system. Similar to the aforementioned search module, there can also be multiple coordinate system modules, and multiple different reference coordinate systems can be constructed based on multiple coordinate system modules. In this embodiment, multiple reference coordinate systems can be pre-determined as alternative reference coordinate systems; in response to the coordinate system selection instruction for the first image input, the alternative reference coordinate system indicated by the coordinate system selection instruction is determined as the target reference coordinate system.
[0185] Among them, the alternative reference coordinate system can be constructed by multiple different coordinate system modules, each coordinate system module has a corresponding label, and the reference coordinate system constructed by a certain coordinate system module is generally one, and the label of the reference coordinate system constructed by the coordinate system module is the same as the label of the coordinate system module.
[0186] When determining the target reference coordinate system based on which the first image is measured, the Figure 3a A coordinate system selection instruction is input in the measurement interface shown, and the alternative reference coordinate system indicated by the coordinate system selection instruction is determined as the target reference coordinate system. Figure 3a The new coordinate system in the measurement interface shown here refers to the reference coordinate system constructed by the user through the coordinate system module. Figure 3a The target reference coordinate system selected in the measurement interface shown is identified as “1 coordinate system module 1. coordinate system module”, which means that the target reference coordinate system is a reference coordinate system with a label 1 generated by a coordinate system module with a label 1.
[0187] In practical applications, there are usually many geometric parameters that need to be measured, and the target reference coordinate systems used to measure each geometric parameter may be different. Therefore, multiple measurement modules are generally set up. The measurement module can display the above Figure 3a The measurement interface shown enables the measurement module to measure and display geometric parameters. Each measurement module may correspond to a coordinate system module to prevent frequent changes in the target reference coordinate system due to the different target reference coordinate systems used when measuring geometric parameters.
[0188] By selecting this embodiment, multiple reference coordinate systems can be pre-set as alternative reference coordinate systems, and during measurement, the target reference coordinate system can be determined in the alternative reference coordinate systems according to the coordinate system selection instructions input by the user, so that the setting of the reference coordinate system is decoupled from the measurement of geometric parameters, and the selection of the target reference coordinate system when measuring geometric parameters is more flexible, which can cope with more complex scenarios.
[0189] When setting the reference coordinate system, the reference coordinate system can be a coordinate system specified in the image or a world coordinate system. If the reference coordinate system is a world coordinate system, then in response to the parameter input operation for the second image input, the value input by the parameter input operation can be determined as the scaling factor between the reference coordinate system and the image coordinate system of the second image; a coordinate system with the straight line determined by the straight axis instruction as the coordinate axis and the scaling factor as the scaling scale can be constructed as the reference coordinate system.
[0190] Specifically, users can Figure 5a The "Operation Parameters" input parameter input operation in the coordinate system setting interface shown in the figure, the display interface of the operation parameters can be as follows Figure 6 As shown. The user can enter the value to be set in the input box after the zoom factor as the zoom scale of the reference coordinate system. The user can also click the load file button after the zoom factor input box, and through the file selection interface displayed after clicking the load file button, select the camera calibration file corresponding to the camera that captured the second image as the hand-eye calibration file, so that the hand-eye calibration file can be loaded and parsed to calculate the required zoom factor as the zoom scale of the reference coordinate system. The method of calculating the zoom scale through the hand-eye calibration file can be shown in the above formulas (12) and (13).
[0191] After completing the linear axis command and parameter input operations, the user can click Figure 6 The execution in the coordinate system setting interface shown in the figure constructs a coordinate system with the straight line determined by the linear axis instruction as the coordinate axis and the scaling factor as the scaling scale as the base coordinate system.
[0192] By selecting this embodiment, the user can create a coordinate system in the image according to the geometric structure of the target workpiece, and can also create a world coordinate system as a reference coordinate system, thereby making the parameter measurement method of the present application more widely applicable.
[0193] In practical applications, when the first image and the second image are the same image, the flow chart of the parameter measurement method provided in the present application can be as follows: Figure 7 As shown, the following steps may be included:
[0194] Step 1: Input an image. This image is the first image of the target workpiece.
[0195] Step 2: Select two non-parallel lines (optional scaling) to generate a set coordinate system.
[0196] The coordinate system is set to be the aforementioned reference coordinate system, and the reference coordinate system is used as the target reference coordinate system. Step 2 is consistent with the setting method of the aforementioned reference coordinate system and will not be repeated here.
[0197] Step 3: Generate a coordinate transformation matrix using space basis transformation.
[0198] The coordinate transformation matrix is the coordinate transformation relationship. Step 3 is consistent with the relevant descriptions of the above formulas (1), (2), (7), and (11), and will not be repeated here.
[0199] Step 4: Convert the pixel coordinates to the set coordinate system to obtain the coordinates, distance, direction, etc. to be located or measured.
[0200] The pixel coordinates are the coordinates of the feature points in the image coordinate system of the first image, and the coordinates, distance, direction, position and other information to be located or measured are the geometric parameters. Step 4 is consistent with the description of the above formulas (1)-(14), and will not be repeated here.
[0201] The above steps 2 and 3 can be regarded as setting the coordinate system of the first image, and step 4 can be regarded as coordinate transformation to obtain the geometric parameters of the geometric figure in the target reference coordinate system.
[0202] The parameter measurement method provided in the present application will be exemplified below in conjunction with specific application scenarios. Since in the example shown below, the first image and the second image are the same image, they will be regarded as the first image in the following.
[0203] Example 1:
[0204] The target workpiece is a tablet computer, and the first image is an image obtained by shooting the entire screen of the tablet computer, such as Figure 8aAs shown in FIG. 1 , the length and width of the inner screen of the tablet computer need to be measured in mm, and each pixel size is 0.1 mm, which is the factory nominal parameter value of the camera used to capture the first image. Figure 8a As shown by the dotted line in FIG, the length of the long side of the inner screen of the tablet computer is the length of the inner screen of the tablet computer; the short side of the inner screen of the tablet computer is as shown in FIG. Figure 8a As shown by the solid line in , the length of the short side of the inner screen of the tablet computer is the inner screen width of the tablet computer.
[0205] When setting the reference coordinate system as the target reference coordinate system, it is necessary to establish the target reference coordinate system with the lower left corner of the inner screen of the tablet computer in the first image as the origin of the target reference coordinate system, the short side of the inner screen as the X-axis of the target reference coordinate system, and the long side of the inner screen as the Y-axis of the target reference coordinate system. When inputting the linear axis instruction, as described above, in the coordinate system setting interface of the coordinate system module, you can select a straight line through the straight line search module or manually draw a straight line as the input linear axis instruction, so that the coordinate system module can determine the two intersecting straight lines indicated by the linear axis instruction. Since the unit to be measured is mm and the size of each pixel is 0.1mm, it is necessary to set the scaling factor. The scaling factor can be set to 1 / 0.1=10. The scaling factor can be obtained by the user performing the above calculation, or it can be obtained by the user clicking the load file button, loading and parsing the camera calibration file, and calculating. The interface for setting the scaling factor can be as follows Figure 6 As shown, the only difference is that in this embodiment, the scaling factor should be set to 10. The coordinate system module constructs a target reference coordinate system with the straight line indicated by the linear axis instruction as the coordinate axis and the scaling factor as the scaling scale. The target reference coordinate system construction result is shown in Figure 8b See Figure 8b In the coordinate system information shown in the figure, the X coordinate of the origin of the target reference coordinate system is 1650.884, the Y coordinate of the origin is 2187.113, and the coordinate system angle is 89.80272°.
[0206] Then you can pass Figure 3a The point-to-point measurement module shown selects the above target reference coordinate system, and uses the two end points of the short side of the inner screen of the tablet computer in the first image as input point 1 and input point 2 for measurement, and obtains the distance between input point 1 and input point 2 in the target reference coordinate system, that is, the inner screen width of the tablet computer is obtained. The inner screen width of the tablet computer is 114.2386 mm, and the measurement result is displayed as shown in FIG. Figure 8c As shown. Figure 8b In the target reference coordinate system shown in Figure 8c From the displayed "Output distance between two points in X direction: 114.2386", we can know that the distance between input point 1 and input point 2 in X direction is 114.2386mm; according to Figure 8cThe displayed "Output distance between two points in the Y direction: 1.525879E-05" shows that the distance between input point 1 and input point 2 in the Y direction is 1.525879×10 -5 mm; according to Figure 8c From the displayed “Absolute distance: 114.2386”, we can see that the distance between input point 1 and input point 2, that is, the width of the inner screen of the tablet computer is 114.2386 mm.
[0207] Can be Figure 3a The point-to-point measurement module shown selects the above target reference coordinate system, and uses the two endpoints of the long side of the inner screen of the tablet computer in the first image as input point 1 and input point 2 for measurement, and obtains the distance between input point 1 and input point 2 in the target reference coordinate system, that is, the inner screen length of the tablet computer is obtained. The inner screen length of the tablet computer is 151.3715 mm, and the measurement result is displayed as shown in FIG. Figure 8d As shown. Figure 8b In the target reference coordinate system shown in Figure 8d The displayed "Output distance between two points in X direction: 7.629395E-06" shows that the distance between input point 1 and input point 2 in the X direction is 7.629395×10 -6 mm; according to Figure 8d From the displayed "Output distance between two points in Y direction: 151.3715", it can be seen that the distance between input point 1 and input point 2 in the Y direction is 151.3715mm; according to Figure 8d From the displayed "Absolute distance: 151.3715", it can be seen that the distance between input point 1 and input point 2, that is, the length of the inner screen of the tablet computer is 151.3715mm. At this point, the length and width of the inner screen of the tablet computer are obtained.
[0208] Example 2:
[0209] The target workpiece is a mobile phone, and the first image is an image obtained by photographing the charging port of the mobile phone, such as Figure 9a As shown in the figure, the length and width of the outer edge of the mobile phone charging hole need to be measured in mm, and the size of each pixel is 0.012 mm, which is the factory nominal parameter value of the camera used to capture the first image. Figure 9a As shown by the dotted line in the figure, the length of the long side of the outer edge of the mobile phone charging hole is the length of the outer edge of the mobile phone charging hole; the short side of the outer edge of the mobile phone charging hole is as shown in the figure. Figure 9a As shown by the solid line in , the length of the short side of the outer edge of the mobile phone charging hole is the outer edge width of the mobile phone charging hole.
[0210] When setting the reference coordinate system as the target reference coordinate system, it is necessary to use the upper left corner of the mobile phone charging port in the first image as the origin of the target reference coordinate system, the long side of the charging port as the X-axis of the target reference coordinate system, and the short side of the charging port as the Y-axis of the target reference coordinate system to establish the target reference coordinate system. When inputting the linear axis instruction, as described above, you can select a straight line through the straight line search module or manually draw a straight line as the input linear axis instruction in the coordinate system setting interface of the coordinate system module, so that the coordinate system module can determine the two intersecting straight lines indicated by the linear axis instruction. Since the unit to be measured is mm and the size of each pixel is 0.012mm, it is necessary to set the scaling factor. The scaling factor can be set to 1 / 0.012=83.333. The scaling factor can be obtained by the user performing the above calculation, or it can be obtained by the user clicking the load file button, loading and parsing the camera calibration file, and calculating. The interface for setting the scaling factor can be as follows Figure 6 The only difference is that in this embodiment, the scaling factor should be set to 83.33. The coordinate system module constructs a target reference coordinate system with the straight line indicated by the linear axis instruction as the coordinate axis and the scaling factor as the scaling scale. The target reference coordinate system construction result is shown in Figure 9b See Figure 9b In the coordinate system information displayed in the figure, the X coordinate of the origin of the target reference coordinate system is 201.2584, the Y coordinate of the origin is 327.5075, and the coordinate system angle is 89.67474°.
[0211] Then you can pass Figure 3a The point measurement module shown selects the above target reference coordinate system, and takes the two endpoints of the long side of the outer edge of the mobile phone charging hole in the first image as input point 1 and input point 2 for measurement, and obtains the distance between input point 1 and input point 2 in the target reference coordinate system, that is, the length of the outer edge of the mobile phone charging hole is obtained. The length of the outer edge of the mobile phone charging hole is 9.059507mm, and the measurement result is displayed as shown below. Fig.9c As shown. Figure 9b In the target reference coordinate system shown in Fig.9c From the displayed "Output distance between two points in X direction: 9.059507", we can know that the distance between input point 1 and input point 2 in X direction is 9.059507mm; according to Fig.9c The displayed "Output distance between two points in the Y direction: 4.768372E-07" shows that the distance between input point 1 and input point 2 in the Y direction is 4.768372×10 -7 mm; according to Fig.9c From the displayed “Absolute distance: 9.059507”, we can see that the distance between input point 1 and input point 2, that is, the length of the outer edge of the mobile phone charging port is 9.059507mm.
[0212] Can be Figure 3aThe point measurement module shown selects the above target reference coordinate system, and takes the two endpoints of the short side of the outer edge of the mobile phone charging hole in the first image as input point 1 and input point 2 for measurement, and obtains the distance between input point 1 and input point 2 in the target reference coordinate system, that is, the width of the outer edge of the mobile phone charging hole is obtained. The width of the outer edge of the mobile phone charging hole is 3.425601mm, and the measurement result is displayed as shown below: Figure 9d As shown. Figure 9b In the target reference coordinate system shown in Figure 9d From the "Output distance between two points in X direction: 0" displayed in the figure, we can see that the distance between input point 1 and input point 2 in the X direction is 0mm; according to Figure 9d From the "Output two-point Y direction distance: 3.425601" displayed in the figure, we can see that the distance between input point 1 and input point 2 in the Y direction is 3.425601mm; according to Figure 9d From the "Absolute distance: 3.425601" displayed in the figure, we can know that the distance between input point 1 and input point 2, that is, the width of the outer edge of the mobile phone charging hole is 3.425601mm. So far, the length and width of the outer edge of the mobile phone charging hole are obtained.
[0213] Corresponding to the above parameter measurement method, the present application also provides a parameter measurement device, such as Fig.10 As shown, the device comprises:
[0214] A first image display module 1001 is used to display a first image of a target workpiece;
[0215] A geometric figure determination module 1002 is used to determine the geometric figure indicated by the graphic instruction in response to the graphic instruction input for the first image;
[0216] A geometric parameter display module 1003 is used to determine the geometric parameters of the geometric figure in the target reference coordinate system and display the determined geometric parameters;
[0217] The target reference coordinate system is a pre-configured reference coordinate system, which is determined in advance by the following method:
[0218] displaying a second image of the target workpiece;
[0219] In response to a linear axis instruction input for a geometric structure of a target workpiece in a second image, determining a straight line indicated by the linear axis instruction;
[0220] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0221] In a possible embodiment, the device further includes:
[0222] a scaling factor determination module, for determining, in response to a parameter input operation for a second image input, a numerical value input by the parameter input operation as a scaling factor between a reference coordinate system and an image coordinate system of the second image;
[0223] Construct a coordinate system with the determined straight line as the coordinate axis as the reference coordinate system, including:
[0224] A coordinate system with the determined straight line as the coordinate axis and the scaling factor as the scaling scale is constructed as the reference coordinate system.
[0225] In a possible embodiment, the device further includes:
[0226] An alternative reference coordinate system determination module is used to predetermine multiple reference coordinate systems as alternative reference coordinate systems;
[0227] The target reference coordinate system determination module is used to determine, in response to a coordinate system selection instruction input for the first image, an alternative reference coordinate system indicated by the coordinate system selection instruction as a target reference coordinate system.
[0228] In a possible embodiment, the device further includes:
[0229] a target coordinate system information determination module, configured to determine, in response to an information selection operation for the second image input, preset coordinate system information selected by the information selection operation as target coordinate system information;
[0230] A target coordinate system information display module, used to display the reference coordinate system and the target coordinate system information in the second image;
[0231] Among them, the preset coordinate system information includes: the origin coordinates of the reference coordinate system, the coordinate system angle of the reference coordinate system, the direction vector coordinates of the X-axis of the reference coordinate system, the direction vector coordinates of the Y-axis of the reference coordinate system, the angle between the X-axis of the reference coordinate system and the positive direction of the X-axis of the image coordinate system of the second image, and the angle between the Y-axis of the reference coordinate system and the positive direction of the Y-axis of the image coordinate system.
[0232] In a possible embodiment, determining geometric parameters of a geometric figure in a target reference coordinate system includes:
[0233] According to the coordinate transformation relationship between the target reference coordinate system and the image coordinate system of the first image, the geometric parameters of the geometric figure in the image coordinate system are projected into the target reference coordinate system to obtain the geometric parameters of the geometric figure in the target reference coordinate system;
[0234] The coordinate transformation relationship is determined in advance by the following method:
[0235] The target reference coordinate system is translated to obtain an offset reference coordinate system, and the origin of the offset reference coordinate system coincides with the origin of the image coordinate system;
[0236] Determine the angle between the direction vector of the X axis of the offset reference coordinate system and the positive direction of the X axis of the image coordinate system as the first angle, and determine the angle between the direction vector of the Y axis of the offset reference coordinate system and the positive direction of the X axis of the image coordinate system as the second angle;
[0237] According to the first angle and the second angle, a basis in the X-axis direction of the offset reference coordinate system is determined as the first basis, and a basis in the Y-axis direction of the offset reference coordinate system is determined as the second basis;
[0238] A coordinate transformation relationship is determined according to the first basis and the second basis.
[0239] In one possible embodiment, the target workpiece is a tablet computer;
[0240] In response to a graphics instruction input for a first image, determining a geometric figure indicated by the graphics instruction includes:
[0241] In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, where the geometric figure is two endpoints of a long side or a short side of a screen of the tablet computer;
[0242] Determine the geometric parameters of the geometric figure in the target reference coordinate system and display the determined geometric parameters, including:
[0243] Determine the geometric parameters of the geometric figure in the target reference coordinate system and display the determined geometric parameters, where the geometric parameters are the distances between the two endpoints of the long side or the short side of the screen of the tablet computer in the target reference coordinate system;
[0244] The target reference coordinate system is a pre-configured reference coordinate system, which is determined in advance by the following method:
[0245] presenting a second image of the tablet computer;
[0246] In response to a linear axis instruction inputted for the geometric structure of the tablet computer in the second image, determining the straight line indicated by the linear axis instruction, the straight line indicated by the linear axis instruction being a straight line where the long side of the inner screen of the tablet computer screen is located, and a straight line where the short side of the inner screen of the tablet computer screen is located;
[0247] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0248] In one possible embodiment, the target workpiece is a mobile phone;
[0249] In response to a graphics instruction input for a first image, determining a geometric figure indicated by the graphics instruction includes:
[0250] In response to the graphic instruction input for the first image, determine the geometric figure indicated by the graphic instruction, where the geometric figure is two endpoints of the long side or the short side of the outer edge of the mobile phone charging hole;
[0251] Determine the geometric parameters of the geometric figure in the target reference coordinate system and display the determined geometric parameters, including:
[0252] Determine the geometric parameters of the geometric figure in the target reference coordinate system and display the determined geometric parameters, which are the distances between the two endpoints of the long side or short side of the outer edge of the mobile phone charging hole in the target reference coordinate system;
[0253] The target reference coordinate system is a pre-configured reference coordinate system, which is determined in advance by the following method:
[0254] showing a second image of the mobile phone;
[0255] In response to a linear axis instruction input for the geometric structure of the mobile phone in the second image, determine the straight line indicated by the linear axis instruction, the straight line indicated by the linear axis instruction is a straight line where the long side of the outer edge of the mobile phone charging hole is located, and a straight line where the short side of the outer edge of the mobile phone charging hole is located;
[0256] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0257] The present application also provides an electronic device, such as Fig.11 As shown, including:
[0258] Memory 1101, used for storing computer programs;
[0259] The processor 1102 is used to implement the following steps when executing the program stored in the memory 1101:
[0260] displaying a first image of a target workpiece;
[0261] In response to a graphics instruction input for a first image, determining a geometric figure indicated by the graphics instruction;
[0262] Determine the geometric parameters of the geometric figure in the target reference coordinate system and display the determined geometric parameters;
[0263] The target reference coordinate system is a pre-configured reference coordinate system, which is determined in advance by the following method:
[0264] displaying a second image of the target workpiece;
[0265] In response to a linear axis instruction input for a geometric structure of a target workpiece in a second image, determining a straight line indicated by the linear axis instruction;
[0266] A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
[0267] In addition, the electronic device may further include a communication bus and / or a communication interface, and the processor 1102, the communication interface, and the memory 1101 communicate with each other via the communication bus.
[0268] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0269] The communication interface is used for communication between the above electronic device and other devices.
[0270] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0271] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0272] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above parameter measurement methods are implemented.
[0273] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any parameter measurement method in the above embodiments.
[0274] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0275] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0276] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0277] 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. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A parameter measurement method, characterized in that: The method comprises: displaying a first image of a target workpiece; In response to a graphics instruction input for the first image, determining a geometric figure indicated by the graphics instruction; Determine geometric parameters of the geometric figure in a target reference coordinate system, and display the determined geometric parameters; The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner: displaying a second image of the target workpiece; In response to a linear axis instruction inputted for the geometric structure of the target workpiece in the second image, determining a straight line indicated by the linear axis instruction; A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
2. The method according to claim 1, characterized in that The method further comprises: In response to a parameter input operation for the second image input, determining a value input by the parameter input operation as a scaling factor between the reference coordinate system and an image coordinate system of the second image; The step of constructing a coordinate system with the determined straight line as a coordinate axis as a reference coordinate system includes: A coordinate system with the determined straight line as the coordinate axis and the scaling factor as the scaling scale is constructed as a reference coordinate system.
3. The method according to claim 1, characterized in that The method further comprises: Predetermining a plurality of the reference coordinate systems as candidate reference coordinate systems; In response to a coordinate system selection instruction input for the first image, a candidate reference coordinate system indicated by the coordinate system selection instruction is determined as a target reference coordinate system.
4. The method according to claim 1, characterized in that: The method further comprises: In response to an information selection operation inputted for the second image, determining preset coordinate system information selected by the information selection operation as target coordinate system information; Displaying the reference coordinate system and the target coordinate system information in the second image; Among them, the preset coordinate system information includes: the origin coordinates of the reference coordinate system, the coordinate system angle of the reference coordinate system, the direction vector coordinates of the X-axis of the reference coordinate system, the direction vector coordinates of the Y-axis of the reference coordinate system, the angle between the X-axis of the reference coordinate system and the positive direction of the X-axis of the image coordinate system of the second image, and the angle between the Y-axis of the reference coordinate system and the positive direction of the Y-axis of the image coordinate system.
5. The method according to claim 1, characterized in that Determining the geometric parameters of the geometric figure in the target reference coordinate system includes: According to the coordinate transformation relationship between the target reference coordinate system and the image coordinate system of the first image, the geometric parameters of the geometric figure in the image coordinate system are projected into the target reference coordinate system to obtain the geometric parameters of the geometric figure in the target reference coordinate system; The coordinate transformation relationship is determined in advance in the following manner: The target reference coordinate system is translated to obtain an offset reference coordinate system, wherein the origin of the offset reference coordinate system coincides with the origin of the image coordinate system; Determine the angle between the direction vector of the X-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system as the first angle, and determine the angle between the direction vector of the Y-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system as the second angle; According to the first angle and the second angle, determining a basis in the X-axis direction of the offset reference coordinate system as a first basis, and determining a basis in the Y-axis direction of the offset reference coordinate system as a second basis; A coordinate transformation relationship is determined according to the first basis and the second basis.
6. The method according to claim 1, characterized in that The target workpiece is a tablet computer; The step of determining, in response to a graphics instruction input for the first image, a geometric figure indicated by the graphics instruction, comprises: In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, the geometric figure being two end points of a long side or a short side of a screen of the tablet computer; The step of determining geometric parameters of the geometric figure in the target reference coordinate system and displaying the determined geometric parameters includes: Determine geometric parameters of the geometric figure in a target reference coordinate system, and display the determined geometric parameters, wherein the geometric parameters are the distances between two endpoints of a long side or a short side of the screen of the tablet computer in the target reference coordinate system; The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner: displaying a second image of the tablet computer; In response to a linear axis instruction inputted for the geometric structure of the tablet computer in the second image, determining a straight line indicated by the linear axis instruction, wherein the straight line indicated by the linear axis instruction is a straight line where a long side of the inner screen of the tablet computer screen is located, and a straight line where a short side of the inner screen of the tablet computer screen is located; A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
7. The method according to claim 1, characterized in that The target workpiece is a mobile phone; The step of determining, in response to a graphics instruction input for the first image, a geometric figure indicated by the graphics instruction, comprises: In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, wherein the geometric figure is two endpoints of a long side or a short side of an outer edge of the mobile phone charging hole; The step of determining geometric parameters of the geometric figure in the target reference coordinate system and displaying the determined geometric parameters includes: Determine the geometric parameters of the geometric figure in the target reference coordinate system, and display the determined geometric parameters, wherein the geometric parameters are the distance between two endpoints of the long side or short side of the outer edge of the mobile phone charging hole in the target reference coordinate system; The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner: displaying a second image of the mobile phone; In response to a linear axis instruction input for the geometric structure of the mobile phone in the second image, determining a straight line indicated by the linear axis instruction, wherein the straight line indicated by the linear axis instruction is a straight line where the long side of the outer edge of the mobile phone charging hole is located, and a straight line where the short side of the outer edge of the mobile phone charging hole is located; A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
8. A parameter measuring device, characterized in that: The device comprises: A first image display module, used to display a first image of a target workpiece; a geometric figure determination module, configured to determine, in response to a graphic instruction input for the first image, a geometric figure indicated by the graphic instruction; A geometric parameter display module, used to determine the geometric parameters of the geometric figure in the target reference coordinate system and display the determined geometric parameters; The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner: displaying a second image of the target workpiece; In response to a linear axis instruction inputted for the geometric structure of the target workpiece in the second image, determining a straight line indicated by the linear axis instruction; A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
9. The device according to claim 8, characterized in that The device also includes: a scaling factor determination module, for determining, in response to a parameter input operation for the second image input, a numerical value input by the parameter input operation as a scaling factor between the reference coordinate system and an image coordinate system of the second image; The step of constructing a coordinate system with the determined straight line as a coordinate axis as a reference coordinate system includes: Constructing a coordinate system with the determined straight line as the coordinate axis and the scaling factor as the scaling scale as a reference coordinate system; The device also includes: An alternative reference coordinate system determination module is used to predetermine a plurality of the reference coordinate systems as alternative reference coordinate systems; a target reference coordinate system determination module, configured to, in response to a coordinate system selection instruction input for the first image, determine an alternative reference coordinate system indicated by the coordinate system selection instruction as a target reference coordinate system; The device also includes: a target coordinate system information determination module, configured to, in response to an information selection operation inputted for the second image, determine the preset coordinate system information selected by the information selection operation as the target coordinate system information; a target coordinate system information display module, configured to display the reference coordinate system and the target coordinate system information in the second image; The preset coordinate system information includes: the origin coordinates of the reference coordinate system, the coordinate system angle of the reference coordinate system, the direction vector coordinates of the X-axis of the reference coordinate system, the direction vector coordinates of the Y-axis of the reference coordinate system, the angle between the X-axis of the reference coordinate system and the positive direction of the X-axis of the image coordinate system of the second image, and the angle between the Y-axis of the reference coordinate system and the positive direction of the Y-axis of the image coordinate system; Determining the geometric parameters of the geometric figure in the target reference coordinate system includes: According to the coordinate transformation relationship between the target reference coordinate system and the image coordinate system of the first image, the geometric parameters of the geometric figure in the image coordinate system are projected into the target reference coordinate system to obtain the geometric parameters of the geometric figure in the target reference coordinate system; The coordinate transformation relationship is determined in advance in the following manner: The target reference coordinate system is translated to obtain an offset reference coordinate system, wherein the origin of the offset reference coordinate system coincides with the origin of the image coordinate system; Determine the angle between the direction vector of the X-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system as the first angle, and determine the angle between the direction vector of the Y-axis of the offset reference coordinate system and the positive direction of the X-axis of the image coordinate system as the second angle; According to the first angle and the second angle, determining a basis in the X-axis direction of the offset reference coordinate system as a first basis, and determining a basis in the Y-axis direction of the offset reference coordinate system as a second basis; Determining a coordinate transformation relationship according to the first basis and the second basis; The target workpiece is a tablet computer; The step of determining, in response to a graphics instruction input for the first image, a geometric figure indicated by the graphics instruction, comprises: In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, the geometric figure being two end points of a long side or a short side of a screen of the tablet computer; The step of determining geometric parameters of the geometric figure in the target reference coordinate system and displaying the determined geometric parameters includes: Determine geometric parameters of the geometric figure in a target reference coordinate system, and display the determined geometric parameters, wherein the geometric parameters are the distances between two endpoints of a long side or a short side of the screen of the tablet computer in the target reference coordinate system; The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner: displaying a second image of the tablet computer; In response to a linear axis instruction inputted for the geometric structure of the tablet computer in the second image, determining a straight line indicated by the linear axis instruction, wherein the straight line indicated by the linear axis instruction is a straight line where a long side of the inner screen of the tablet computer screen is located, and a straight line where a short side of the inner screen of the tablet computer screen is located; Construct a coordinate system with the determined straight line as the coordinate axis as the reference coordinate system; The target workpiece is a mobile phone; The step of determining, in response to a graphics instruction input for the first image, a geometric figure indicated by the graphics instruction, comprises: In response to a graphic instruction input for the first image, determining a geometric figure indicated by the graphic instruction, wherein the geometric figure is two endpoints of a long side or a short side of an outer edge of the mobile phone charging hole; The step of determining geometric parameters of the geometric figure in the target reference coordinate system and displaying the determined geometric parameters includes: Determine the geometric parameters of the geometric figure in the target reference coordinate system, and display the determined geometric parameters, wherein the geometric parameters are the distance between two endpoints of the long side or short side of the outer edge of the mobile phone charging hole in the target reference coordinate system; The target reference coordinate system is a pre-configured reference coordinate system, and the reference coordinate system is pre-determined in the following manner: displaying a second image of the mobile phone; In response to a linear axis instruction input for the geometric structure of the mobile phone in the second image, determining a straight line indicated by the linear axis instruction, wherein the straight line indicated by the linear axis instruction is a straight line where the long side of the outer edge of the mobile phone charging hole is located, and a straight line where the short side of the outer edge of the mobile phone charging hole is located; A coordinate system with the determined straight lines as coordinate axes is constructed as a reference coordinate system.
10. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.
