Conversion coefficient determination method and device and electronic equipment
By using regular polygons composed of multiple markers in the target object image, the conversion coefficient of the target object is determined, and the error problem caused by fixed conversion coefficient is solved and the measurement accuracy is improved.
Patent Information
- Application Number
- CN202411677719.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-28
AI Technical Summary
When measuring object size or three-dimensional coordinates, the existing visual image processing technology uses fixed conversion coefficients to cause large errors, especially when the accuracy requirements are high.
By obtaining the target object image, which contains multiple marker images of the same figure, the connection lines of the marker image form a regular polygon, and the target object is located in the regular polygon. Based on the conversion coefficients of these markers, the conversion coefficients of the target object are determined, and the distribution characteristics of the conversion coefficients in the image are fully taken into account.
It reduces the conversion coefficient error, improves object size measurement and three-dimensional coordinate accuracy, and is suitable for application scenarios with high accuracy requirements.
Smart Images

Figure CN119722774A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of visual technology, and in particular to a method, device and electronic equipment for determining a conversion coefficient. Background Art
[0002] At present, in visual image processing, the images captured by the camera usually only provide the pixel position of the object and the size information in pixels. In order to obtain the actual size / position, conversion coefficients are often needed. For example, when measuring the actual physical size of an object through images captured by the camera, it is usually necessary to obtain a two-dimensional conversion coefficient between the pixel size and the actual physical size to achieve the actual physical size of the object measured through the images captured by the camera; when transforming the three-dimensional posture, it is usually necessary to use a high-dimensional transformation matrix to transform the coordinate points of interest to an appropriate coordinate system. However, the existing visual image processing technology usually uses the same conversion coefficient for different pixel points in the image screen. Due to the installation error of the camera, the verticality of its optical axis and the plane of the object being measured will be affected by various factors such as the installation accuracy. The conversion coefficients in the captured image show a certain distribution in the plane. When the object size measurement accuracy is high or the three-dimensional coordinate point accuracy requirements are high, the use of fixed conversion coefficients will result in large errors. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a conversion coefficient determination method, device and electronic device, which fully considers the distribution characteristics of the conversion coefficient in the image and reduces the conversion coefficient error compared to the assumption that the conversion coefficients are the same everywhere in the image.
[0004] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0005] In a first aspect, an embodiment of the present invention provides a method for determining a conversion coefficient, comprising:
[0006] Acquire a target object image; wherein the target object image includes a plurality of marker images of the same shape, and the connecting lines of the plurality of marker images form a regular polygon, and the target object is located within the regular polygon;
[0007] Determining a conversion coefficient of each of the markers based on the target object image; wherein the conversion coefficient includes a two-dimensional conversion coefficient and / or a multi-dimensional conversion coefficient;
[0008] The conversion coefficient of the target object is determined based on the conversion coefficient of each of the markers.
[0009] Further, an embodiment of the present invention provides a first possible implementation of the first aspect, wherein the conversion coefficient includes a two-dimensional conversion coefficient, and the step of determining the conversion coefficient of each marker based on the target object image includes:
[0010] Acquire the actual physical size of the marker, and acquire the pixel size of each marker in the target object image;
[0011] The ratios of the actual physical size of the markers to the pixel size of each marker are calculated respectively to obtain the conversion coefficient of each marker.
[0012] Further, an embodiment of the present invention provides a second possible implementation of the first aspect, wherein the conversion coefficient includes a multidimensional conversion coefficient; and the step of determining the conversion coefficient of each marker based on the target object image includes:
[0013] Obtain pixel coordinates of each vertex of each marker in the target object image, and obtain three-dimensional coordinates of each vertex of each marker in a world coordinate system;
[0014] Based on the three-dimensional coordinates of each vertex of the marker in the world coordinate system and the pixel coordinates in the image, the multidimensional conversion coefficients required for coordinate system transformation of the feature point coordinates of each marker are determined; wherein the multidimensional conversion coefficients include a rotation and translation matrix.
[0015] Furthermore, the embodiment of the present invention provides a third possible implementation of the first aspect, wherein the step of determining the conversion coefficient of the target object based on the conversion coefficient of each of the markers comprises:
[0016] Determining the interpolation coefficient corresponding to each of the markers;
[0017] The conversion coefficient of the target object is determined based on the conversion coefficient and the interpolation coefficient of each of the markers.
[0018] Furthermore, the embodiment of the present invention provides a fourth possible implementation of the first aspect, wherein the step of determining the conversion coefficient of the target object based on the conversion coefficient and the interpolation coefficient of each of the markers comprises:
[0019] The interpolation coefficient is used as a weight, and based on the weight, a weighted average calculation is performed on the conversion coefficients of each of the markers to obtain the conversion coefficient of the target object.
[0020] Furthermore, the embodiment of the present invention provides a fifth possible implementation of the first aspect, wherein the step of determining the interpolation coefficient corresponding to each of the markers includes:
[0021] Obtaining the pixel coordinates of the center point of each of the markers, and obtaining the pixel coordinates of the center point of the target object;
[0022] Based on the pixel coordinates of the center point of each of the markers and the pixel coordinates of the center point of the target object, the interpolation coefficients corresponding to each of the markers are determined.
[0023] Furthermore, an embodiment of the present invention provides a sixth possible implementation of the first aspect, wherein the marker includes a two-dimensional code, the regular polygon is a triangle, and the step of determining the interpolation coefficient corresponding to each marker includes:
[0024] Obtaining the pixel coordinates of the center point of each of the two-dimensional codes, and using the pixel coordinates of the center point of each of the two-dimensional codes as the coordinates of three vertices of the triangle;
[0025] The pixel coordinates of the center point of the target object are obtained, and a linear equation group is constructed based on the coordinates of the three vertices of the triangle, the pixel coordinates of the center point of the target object and the interpolation coefficients of each of the markers to calculate the interpolation coefficients corresponding to each of the markers.
[0026] Furthermore, the embodiment of the present invention provides a seventh possible implementation of the first aspect, wherein the marker includes a two-dimensional code, the regular polygon is a triangle, and the step of determining the interpolation coefficient of each marker includes:
[0027] Obtaining the pixel coordinates of the center point of each of the two-dimensional codes, and using the pixel coordinates of the center point of each of the two-dimensional codes as the coordinates of three vertices of the triangle;
[0028] The pixel coordinates of the center point of the target object are obtained, and the interpolation coefficients of each of the markers are determined based on a preset area algorithm, the coordinates of the three vertices of the triangle and the pixel of the center point of the target object.
[0029] In a second aspect, an embodiment of the present invention further provides a conversion coefficient determination device, including:
[0030] An acquisition module, used for acquiring a target object image; wherein the target object image includes a plurality of marker images of the same shape, and the connecting lines of the plurality of marker images form a regular polygon, and the target object is located within the regular polygon;
[0031] A first determination module, configured to determine a conversion coefficient of each of the markers based on the target object image; wherein the conversion coefficient includes a two-dimensional conversion coefficient and / or a multi-dimensional conversion coefficient;
[0032] The second determination module is used to determine the conversion coefficient of the target object based on the conversion coefficient of each of the markers.
[0033] In a third aspect, an embodiment of the present invention provides an electronic device, including: a processor and a storage device;
[0034] The storage device stores a computer program, and when the computer program is executed by the processor, the method according to any one of the first aspects is executed.
[0035] The embodiment of the present invention provides a method, device and electronic device for determining conversion coefficients, the method comprising: acquiring a target object image; wherein the target object image comprises multiple marker images of the same shape, and the lines connecting the multiple marker images form a regular polygon, and the target object is located within the regular polygon; determining the conversion coefficients of each marker based on the target object image; wherein the conversion coefficients comprise two-dimensional conversion coefficients and / or multi-dimensional conversion coefficients; and determining the conversion coefficient of the target object based on the conversion coefficients of each marker. The present invention places the target object within multiple markers to capture an image, first determines the conversion coefficients of multiple markers in the target object image, and then determines the conversion coefficient of the target object based on the conversion coefficients of the multiple markers. Compared with the assumption that the conversion coefficients are the same everywhere in the image, the present invention fully considers the distribution characteristics of the conversion coefficients within the image, and reduces the conversion coefficient error.
[0036] Other features and advantages of the embodiments of the present invention will be described in the following description, or some features and advantages can be inferred or determined without doubt from the description, or can be learned by implementing the above-mentioned techniques of the embodiments of the present invention.
[0037] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flow chart of a conversion coefficient determination method provided by an embodiment of the present invention is shown;
[0040] Figure 2 A schematic diagram of a target object image provided by an embodiment of the present invention is shown;
[0041] Figure 3 A triangular mesh diagram provided by an embodiment of the present invention is shown;
[0042] Figure 4A triangular area partitioning image provided by an embodiment of the present invention is shown;
[0043] Figure 5 A schematic diagram of the structure of a conversion coefficient determination device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be described below in conjunction with the drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.
[0045] At present, in actual application scenarios, there is often a requirement to accurately measure the size, posture and other structural and positional features of the measured object through a monocular camera. This type of measurement is usually performed in a 2D plane. The image captured by the camera can only provide the pixel position of the object and the size information in pixels. In order to obtain the actual size / position, it is necessary to obtain the conversion relationship between the pixel size and the actual size, that is, the conversion coefficient from the pixel size to the physical size, and the object from the pixel coordinate to the world coordinate system or the camera coordinate system. The current method of determining the conversion coefficient usually sets the conversion coefficients at different positions in the image screen to the same value, but due to factors such as installation errors, this assumption is not strictly valid. In particular, when the camera is installed at the end of a moving robotic arm, the verticality of its optical axis to the plane of the object being measured is affected by multiple factors such as the robotic arm motion control accuracy and the camera installation accuracy. In this way, the conversion ratio from pixels to physical size presents a certain distribution in the plane, so when the measurement accuracy is high, using a fixed conversion coefficient will cause errors.
[0046] In order to improve the above problems, an embodiment of the present invention provides a method, device and electronic device for determining a conversion coefficient. The embodiment of the present invention is introduced in detail below.
[0047] This embodiment provides a method for determining a conversion coefficient, which can be applied to electronic devices such as computers. Figure 1 The conversion coefficient determination method flow chart shown in the figure mainly includes the following steps:
[0048] Step S102, obtaining a target object image; wherein the target object image includes a plurality of marker images of the same shape, and the lines connecting the plurality of marker images form a regular polygon, and the target object is located within the regular polygon;
[0049] When the contour of the target object in the image occupies a relatively small area in the picture, it is difficult to segment the contour of the target object when calculating the two-dimensional conversion coefficient of the target object. The target object can be placed in a polygon formed by multiple markers to capture the target object image, so as to determine the conversion coefficient of the target object based on each marker.
[0050] The above-mentioned markers can be regular and easily recognizable graphics, such as ArUco and other two-dimensional codes; the number of the above-mentioned markers is greater than or equal to 3, and the regular polygon formed by the connecting lines of the above-mentioned multiple marker images can be a polygon such as an equilateral triangle or a square.
[0051] For example, see Figure 2 The target object image diagram is shown in Figure 2 As shown, the marker is a QR code, the lines connecting multiple marker images form an equilateral triangle, and the target object is located inside the equilateral triangle.
[0052] In one embodiment, when it is necessary to collect multiple target object images, multiple markers can be arranged at the shooting position to form a Figure 3 As shown in the triangular grid diagram, each marker is placed at the vertex of each triangle in the triangular grid, and the object to be measured is placed inside each grid, so that multiple target object images can be quickly collected.
[0053] Step S104, determining a conversion coefficient of each marker based on the target object image; wherein the conversion coefficient includes a two-dimensional conversion coefficient and / or a multi-dimensional conversion coefficient;
[0054] The actual physical size and three-dimensional world coordinates of the above-mentioned markers are known. The two-dimensional conversion coefficient of each marker can be calculated based on the pixel coordinates of each marker in the target object image and the actual physical size of the marker; the multi-dimensional conversion coefficient of each marker can be calculated based on the pixel coordinates and three-dimensional world coordinates of each marker in the target object image. The multi-dimensional conversion coefficient may include a conversion matrix corresponding to the conversion of the feature points of each marker from the pixel coordinates to the three-dimensional world coordinates, and may also include a conversion matrix corresponding to the conversion of the feature points of each marker from the three-dimensional world coordinates to the three-dimensional coordinates in the camera coordinate system.
[0055] Step S106, determining the conversion coefficient of the target object based on the conversion coefficients of each marker.
[0056] The conversion coefficients of the above-mentioned markers are respectively used as the conversion coefficients of the vertices of the above-mentioned regular polygon, and the pixel position of the target object is obtained. The conversion coefficient of the target object inside the regular polygon can be calculated by an interpolation algorithm or an area algorithm.
[0057] The above-mentioned conversion coefficient determination method provided in the present embodiment, by placing the target object in multiple markers to capture images, first determines the conversion coefficients of multiple markers in the target object image, and then determines the conversion coefficient of the target object based on the conversion coefficients of the multiple markers. Compared with the assumption that the conversion coefficients are the same everywhere in the image, the distribution characteristics of the conversion coefficients in the image are fully considered, and the conversion coefficient error is reduced.
[0058] In one embodiment, the above conversion coefficient includes a two-dimensional conversion coefficient. This embodiment provides a specific implementation method for determining the conversion coefficient of each marker based on the target object image:
[0059] The actual physical size of the marker is obtained, and the pixel size of each marker in the target object image is obtained; the ratio of the actual physical size of the marker to the pixel size of each marker is calculated respectively to obtain the conversion coefficient of each marker.
[0060] The actual physical size of the above-mentioned markers can be the actual circumference of the markers or the actual side length of any side. The pixel size of the above-mentioned markers can be the pixel length corresponding to the actual physical size, which can be the pixel circumference or the pixel side length of any side. The ratio of the actual circumference of each marker to the pixel side length is used as the two-dimensional conversion coefficient of the marker.
[0061] In one embodiment, the above conversion coefficient includes a multi-dimensional conversion coefficient; this embodiment provides a specific implementation method for determining the conversion coefficient of each marker based on the target object image:
[0062] Obtain the pixel coordinates of each vertex of each marker in the target object image, and obtain the three-dimensional coordinates of each vertex of each marker in the world coordinate system;
[0063] Based on the three-dimensional coordinates of each vertex of the marker in the world coordinate system and the pixel coordinates in the image, the multidimensional conversion coefficients required for coordinate system transformation of the feature point coordinates of each marker are determined; wherein the multidimensional conversion coefficients include a rotation and translation matrix.
[0064] In one embodiment, the multi-dimensional conversion coefficients may be a conversion matrix corresponding to the conversion of the feature points of each marker from the three-dimensional world coordinates to the three-dimensional coordinates of the camera. Since the size and position of each marker are known, the three-dimensional coordinates of each vertex of the marker in the world coordinate system are obtained, and the pixel coordinates of each vertex of the marker in the image coordinate system are obtained. The pixel coordinates of each vertex of the marker and the three-dimensional coordinates in the three-dimensional world coordinate system are known, and the intrinsic parameter matrix of the camera is obtained. The linear linear transformation method or the geometric algorithm based on perspective projection (Perspective-n-Point, abbreviated as PnP) can be used to solve the rotation and translation matrix [R, t] corresponding to the conversion of the feature points of the marker from the world coordinate system to the three-dimensional coordinate system of the camera, where R is the rotation matrix and t is the translation matrix.
[0065] In one embodiment, this embodiment provides an implementation method for determining the conversion coefficient of the target object based on the conversion coefficient of each marker, which can be specifically performed with reference to the following steps:
[0066] Step (1): determine the interpolation coefficient corresponding to each marker;
[0067] In a specific implementation, the center pixel coordinates of each marker are obtained, and the center pixel coordinates of the target object are obtained; based on the center pixel coordinates of each marker and the center pixel coordinates of the target object, the interpolation coefficients corresponding to each marker are determined.
[0068] The pixel coordinates of the center point of each marker are the coordinates of each vertex of the polygon. Given the coordinates of each vertex of the polygon and the pixel coordinates of the center point of the internal target object, the interpolation coefficients corresponding to each vertex can be solved using algebraic methods or area algorithms.
[0069] In another specific embodiment, the marker includes a QR code, and the regular polygon is a triangle. The pixel coordinates of the center point of each QR code are obtained, and the pixel coordinates of the center point of each QR code are used as the three vertex coordinates of the triangle; the pixel coordinates of the center point of the target object are obtained, and a group of linear equations is constructed based on the three vertex coordinates of the triangle, the pixel coordinates of the center point of the target object and the interpolation coefficients of each marker, and the interpolation coefficients corresponding to each marker are calculated.
[0070] Assume that the pixel coordinates of the three vertices of the triangle are (x1, y1), (x2, y2), (x3, y3), and the pixel coordinates of the center point of the target object are (x0, y0). Calculate the interpolation coefficients, that is, calculate the three coefficients λ1, λ2 and λ3, so that
[0071] (x0, y0)=λ1(x1, y1)+λ2(x2, y2)+λ3(x3, y3)
[0072] And meet
[0073] λ1+λ2+λ3=1
[0074] Construct a system of linear equations:
[0075]
[0076] By solving the above linear equations, the interpolation coefficients corresponding to each marker can be calculated.
[0077] In another specific embodiment, the marker includes a QR code, and the regular polygon is a triangle. The pixel coordinates of the center point of each QR code are obtained, and the pixel coordinates of the center point of each QR code are used as the three vertex coordinates of the triangle; the pixel coordinates of the center point of the target object are obtained, and the interpolation coefficient corresponding to each marker is determined based on a preset area algorithm, the three vertex coordinates of the triangle and the center point pixel of the target object.
[0078] The pixel coordinates of the center point of each QR code are used as the three vertex coordinates of the triangle to obtain the pixel coordinates of the center point of the target object. Figure 4The triangle area partition image shown in the figure has three vertices ABC. Let point P be the center point of the target object. Let the interpolation coefficients corresponding to the three vertices ABC be α, β and γ respectively. Based on the preset area algorithm, the following set of equations can be obtained:
[0079] P=αA+βB+γC
[0080] α+β+γ=1
[0081] α=S ΔPBC / S ΔABC
[0082] β=S ΔPAC / S ΔABC
[0083] γ=S ΔPAB / S ΔABC
[0084] Among them, S ΔABC is the area of triangle ABC, S ΔPBC is the area of triangle PBC, S ΔPAC is the area of triangle PAC, S ΔPAB is the area of triangle PAB. The area of each triangle can be calculated according to the coordinates of each vertex of the triangle and point P. By solving the above equations, the interpolation coefficients α, β and γ corresponding to each marker can be obtained.
[0085] Step (2): Determine the conversion coefficient of the target object based on the conversion coefficient and interpolation coefficient of each marker.
[0086] The conversion coefficients at the three vertices are weighted averaged using the interpolation coefficients as weights to obtain the conversion coefficient at the object's location.
[0087] The interpolation coefficient is used as a weight, and the conversion coefficient of each marker is weighted averaged based on the weight to obtain the conversion coefficient of the target object.
[0088] When the above polygon is a triangle, let the interpolation coefficients corresponding to each marker be λ1, λ2 and λ3, and the conversion coefficients at the three vertices be S1, S2 and S3 respectively, then the conversion coefficient of the target object is:
[0089] S=λ1S1+λ2S2+λ3S3
[0090] The above-mentioned conversion coefficient determination method provided in this embodiment avoids the influence caused by the camera optical axis being not perpendicular to the measured plane. Since the conversion coefficient used to determine the actual physical size of the object in this embodiment is calculated in real time, and there is no assumption that the conversion coefficients are the same everywhere in the potential picture, the conversion coefficient at the object position is obtained by trigonometric interpolation, which fully considers the distribution characteristics of the conversion coefficient in the plane.
[0091] Based on the above embodiment, this embodiment provides an example of applying the above conversion coefficient determination method, which can be specifically performed with reference to the following steps:
[0092] Step 1, extracting the contour of the target object to be measured from the image, and calculating the pixel coordinates of the center point of the contour;
[0093] Step 2, calculate the conversion coefficients at the three vertices of the triangle where the target object is located, and the pixel coordinates of the center points of the three markers;
[0094] Step 3, calculating three interpolation coefficients based on the pixel coordinates of the center point of the target object and the pixel coordinates of the three vertices of the triangle (i.e., the center points of the three markers);
[0095] Step 4: Using the interpolation coefficient as a weight, perform weighted averaging on the conversion coefficients at the three vertices to obtain the conversion coefficient at the location of the target object.
[0096] Corresponding to the conversion coefficient determination method provided in the above embodiment, the embodiment of the present invention provides a conversion coefficient determination device, see Figure 5 A schematic diagram of the structure of a conversion coefficient determination device is shown, the device includes the following modules:
[0097] An acquisition module 51 is used to acquire a target object image; wherein the target object image includes a plurality of marker images of the same shape, and the lines connecting the plurality of marker images form a regular polygon, and the target object is located inside the regular polygon;
[0098] A first determination module 52 is used to determine the conversion coefficient of each marker based on the target object image; wherein the conversion coefficient includes a two-dimensional conversion coefficient and / or a multi-dimensional conversion coefficient;
[0099] The second determination module 53 is used to determine the conversion coefficient of the target object based on the conversion coefficients of each marker.
[0100] The conversion coefficient determination device provided in the present embodiment places the target object within multiple markers to capture images, first determines the conversion coefficients of the multiple markers in the target object image, and then determines the conversion coefficient of the target object based on the conversion coefficients of the multiple markers. Compared with the assumption that the conversion coefficients are the same everywhere in the image, the distribution characteristics of the conversion coefficients in the image are fully considered, thereby reducing the conversion coefficient error.
[0101] In one embodiment, the conversion coefficient includes a two-dimensional conversion coefficient. The first determination module 52 is used to obtain the actual physical size of the marker and the pixel size of each marker in the target object image; the ratio of the actual physical size of the marker to the pixel size of each marker is calculated to obtain the conversion coefficient of each marker.
[0102] In one embodiment, the conversion coefficient includes a multidimensional conversion coefficient; the first determination module 52 is used to obtain the pixel coordinates of each vertex of each marker in the target object image, and obtain the three-dimensional coordinates of each vertex of each marker in the world coordinate system; based on the three-dimensional coordinates of each vertex of the marker in the world coordinate system and the pixel coordinates in the image, determine the multidimensional conversion coefficient required for the coordinate system transformation of the feature point coordinates of each marker; wherein the multidimensional conversion coefficient includes a rotation and translation matrix.
[0103] In one embodiment, the second determination module 53 is used to determine the interpolation coefficient corresponding to each marker; and determine the conversion coefficient of the target object based on the conversion coefficient of each marker and the interpolation coefficient.
[0104] In one embodiment, the second determination module 53 is configured to use the interpolation coefficient as a weight, and perform weighted average calculation on the conversion coefficients of each marker based on the weight to obtain the conversion coefficient of the target object.
[0105] In one embodiment, the second determination module 53 is used to obtain the center point pixel coordinates of each marker and the center point pixel coordinates of the target object; based on the center point pixel coordinates of each marker and the center point pixel coordinates of the target object, determine the interpolation coefficient corresponding to each marker.
[0106] In one embodiment, the marker includes a QR code, the regular polygon is a triangle, and the second determination module 53 is used to obtain the pixel coordinates of the center point of each QR code, and use the pixel coordinates of the center point of each QR code as the three vertex coordinates of the triangle; obtain the pixel coordinates of the center point of the target object, and construct a group of linear equations based on the three vertex coordinates of the triangle, the pixel coordinates of the center point of the target object and the interpolation coefficients of each marker, and calculate the interpolation coefficients corresponding to each marker.
[0107] In one embodiment, the marker includes a QR code, the regular polygon is a triangle, and the second determination module 53 is used to obtain the center point pixel coordinates of each QR code, and use the center point pixel coordinates of each QR code as the three vertex coordinates of the triangle; obtain the center point pixel coordinates of the target object, and determine the interpolation coefficient of each marker based on a preset area algorithm, the three vertex coordinates of the triangle and the center point pixel of the target object.
[0108] The implementation principle and technical effects of the device provided in this embodiment are the same as those of the aforementioned embodiments. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0109] An embodiment of the present invention provides an electronic device, which includes a processor and a memory. The memory stores a computer program that can be run on the processor. When the processor executes the computer program, the steps of the method provided in the above embodiment are implemented.
[0110] An embodiment of the present invention provides a computer-readable medium, wherein the computer-readable medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described in the above embodiment.
[0111] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned embodiment, and will not be repeated here.
[0112] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0113] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0114] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0115] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for determining a conversion coefficient, characterized in that: include: Acquire a target object image; wherein the target object image includes a plurality of marker images of the same shape, and the connecting lines of the plurality of marker images form a regular polygon, and the target object is located within the regular polygon; Determining a conversion coefficient of each of the markers based on the target object image; wherein the conversion coefficient includes a two-dimensional conversion coefficient and / or a multi-dimensional conversion coefficient; The conversion coefficient of the target object is determined based on the conversion coefficient of each of the markers.
2. The method according to claim 1, characterized in that: The conversion coefficient includes a two-dimensional conversion coefficient, and the step of determining the conversion coefficient of each marker based on the target object image includes: Acquire the actual physical size of the marker, and acquire the pixel size of each marker in the target object image; The ratios of the actual physical size of the markers to the pixel size of each marker are calculated respectively to obtain the conversion coefficient of each marker.
3. The method according to claim 1, characterized in that The conversion coefficient includes a multi-dimensional conversion coefficient; the step of determining the conversion coefficient of each marker based on the target object image includes: Obtain pixel coordinates of each vertex of each marker in the target object image, and obtain three-dimensional coordinates of each vertex of each marker in a world coordinate system; Based on the three-dimensional coordinates of each vertex of the marker in the world coordinate system and the pixel coordinates in the image, the multidimensional conversion coefficients required for coordinate system transformation of the feature point coordinates of each marker are determined; wherein the multidimensional conversion coefficients include a rotation and translation matrix.
4. The method according to claim 1, characterized in that The step of determining the conversion coefficient of the target object based on the conversion coefficient of each of the markers comprises: Determining the interpolation coefficient corresponding to each of the markers; The conversion coefficient of the target object is determined based on the conversion coefficient and the interpolation coefficient of each of the markers.
5. The method according to claim 4, characterized in that The step of determining the conversion coefficient of the target object based on the conversion coefficient and the interpolation coefficient of each of the markers comprises: The interpolation coefficient is used as a weight, and based on the weight, a weighted average calculation is performed on the conversion coefficients of each of the markers to obtain the conversion coefficient of the target object.
6. The method according to claim 4, characterized in that The step of determining the interpolation coefficient corresponding to each of the markers comprises: Obtaining the pixel coordinates of the center point of each of the markers, and obtaining the pixel coordinates of the center point of the target object; Based on the pixel coordinates of the center point of each of the markers and the pixel coordinates of the center point of the target object, the interpolation coefficients corresponding to each of the markers are determined.
7. The method according to claim 4, characterized in that The marker includes a two-dimensional code, the regular polygon is a triangle, and the step of determining the interpolation coefficient corresponding to each marker includes: Obtaining the pixel coordinates of the center point of each of the two-dimensional codes, and using the pixel coordinates of the center point of each of the two-dimensional codes as the coordinates of three vertices of the triangle; The pixel coordinates of the center point of the target object are obtained, and a linear equation group is constructed based on the coordinates of the three vertices of the triangle, the pixel coordinates of the center point of the target object and the interpolation coefficients of each of the markers to calculate the interpolation coefficients corresponding to each of the markers.
8. The method according to claim 4, characterized in that The marker includes a two-dimensional code, the regular polygon is a triangle, and the step of determining the interpolation coefficient of each marker includes: Obtaining the pixel coordinates of the center point of each of the two-dimensional codes, and using the pixel coordinates of the center point of each of the two-dimensional codes as the coordinates of three vertices of the triangle; The pixel coordinates of the center point of the target object are obtained, and the interpolation coefficients of each of the markers are determined based on a preset area algorithm, the coordinates of the three vertices of the triangle and the pixel of the center point of the target object.
9. A conversion coefficient determination device, characterized in that: include: An acquisition module, used for acquiring a target object image; wherein the target object image includes a plurality of marker images of the same shape, and the connecting lines of the plurality of marker images form a regular polygon, and the target object is located within the regular polygon; A first determination module, configured to determine a conversion coefficient of each of the markers based on the target object image; wherein the conversion coefficient includes a two-dimensional conversion coefficient and / or a multi-dimensional conversion coefficient; The second determination module is used to determine the conversion coefficient of the target object based on the conversion coefficient of each of the markers.
10. An electronic device, characterized in that: include: processor and storage device; The storage device stores a computer program, which, when executed by the processor, performs the method according to any one of claims 1 to 8.