Method, device, medium and terminal for obtaining mapping relationship between object image coordinates
By acquiring sub-pixel level corner coordinates and image coordinates, performing linear and nonlinear transformations, and fitting the mapping relationship between object and image coordinates, the problem of insufficient accuracy in existing high-precision detection equipment is solved, and high-precision object-image coordinate mapping is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI JINGJI SEMICON TECH CO LTD
- Filing Date
- 2022-12-27
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies cannot meet the accuracy requirements of high-precision detection equipment for the mapping relationship between object and image coordinates. The Tsai two-step method and Zhang Zhengyou calibration method are not accurate enough in cases of severe distortion.
By obtaining sub-pixel level corner coordinates, a uniform grid image is established, and linear and nonlinear transformations are performed to obtain the mapping relationship between object and image coordinates. The first and second mapping relationship functions are then used for fitting to obtain a high-precision object and image coordinate mapping relationship.
While ensuring the accuracy of the mapping function, the impact of the image itself on the algorithm accuracy is reduced to meet the requirements of high-precision production equipment.
Smart Images

Figure CN116258776B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to a method and device for obtaining a mapping relationship between object coordinates and image coordinates, a medium and a terminal. BACKGROUND
[0002] In a visual application, the relationship between the image produced by an optical lens and the actual object is not linearly one-to-one, and in this case, in order to restore an image consistent with the actual object, a mapping relationship between object coordinates and image coordinates needs to be given by some method.
[0003] Some existing methods can give such a mapping relationship, such as Tsai's two-step method and Zhang Zhengyou's calibration method, but neither can meet the precision requirements of high-precision detection equipment, as follows:
[0004] Tsai's two-step method: first linearly obtain the parameters of the optical lens, and then obtain the final mapping relationship between object coordinates and image coordinates through nonlinear optimization, but this method has poor precision in the case of severe distortion of the mapping relationship between object coordinates and image coordinates, and cannot meet the precision requirements of high-precision detection equipment;
[0005] Zhang Zhengyou's calibration method: the internal parameters of the optical lens are needed for distortion calibration, but the internal parameters of the optical lens are usually not accurate, which makes Zhang Zhengyou's calibration method also unable to meet the precision requirements of high-precision detection equipment.
[0006] Therefore, the present application proposes a method and device for obtaining a mapping relationship between object coordinates and image coordinates to meet the requirements of high-precision production equipment. SUMMARY
[0007] The present application provides a method and device for obtaining a mapping relationship between object coordinates and image coordinates to solve the technical problem that the mapping relationship function between object coordinates and image coordinates in the prior art cannot meet the requirements of high-precision production equipment.
[0008] In a first aspect, the present application provides a method for obtaining a mapping relationship between object coordinates and image coordinates, comprising: obtaining a sample calibration board image and first corner point coordinates, the first corner point coordinates being corner point coordinates on the sample calibration board image, and the first corner point coordinates being sub-pixel level; establishing a uniform grid image and obtaining second corner point coordinates, the second corner point coordinates being corner point coordinates on the uniform grid image; performing linear transformation processing on the uniform grid image to obtain object coordinates; a linear mapping relationship between the second corner point coordinates and the object coordinates being a first mapping relationship function; performing nonlinear transformation processing on the uniform grid image after the linear transformation processing to obtain image coordinates; a nonlinear mapping relationship between the object coordinates and the image coordinates being a second mapping relationship function; fitting the first corner point coordinates and the image coordinates to obtain parameters of the first mapping relationship function and parameters of the second mapping relationship function between the uniform grid image and the image coordinates; and obtaining the mapping relationship between the object coordinates and the image coordinates according to the second mapping relationship function and the parameters of the second mapping relationship function.
[0009] The method for obtaining a mapping relationship between object coordinates and image coordinates provided by the present application can reduce the influence of the image itself on the algorithm accuracy while ensuring the accuracy of the obtained mapping relationship function, and the first corner point coordinates and the image coordinates at the sub-pixel level are used to train the mapping relationship, so that a high-precision mapping relationship between object coordinates and image coordinates can be obtained without the camera parameters being given in advance, thereby meeting the requirements of high-precision production equipment.
[0010] Optionally, the linear transformation processing on the uniform grid image comprises at least one of scaling processing, translation processing, and rotation processing. The method has the beneficial effect that the linear transformation processing mode can be reasonably selected according to the effect of the final mapping relationship function to be presented.
[0011] Optionally, the nonlinear transformation processing on the uniform grid image after the linear transformation processing comprises radial distortion processing, tangential distortion processing, and thin prism distortion processing.
[0012] Optionally, the second mapping relationship function is ; wherein, is a distortion center, , is a radial distortion parameter, , is a tangential distortion parameter, , is a thin prism distortion parameter, and ) is an image coordinate, ( ) is an object coordinate; the first corner coordinate and the image coordinate ( ) are fitted using the first mapping relationship function and the second mapping relationship function to obtain parameters in the first mapping relationship function and the second mapping relationship function. The beneficial effect is that because the corner points of the uniform grid image are equidistantly distributed, the mapping relationship between the object coordinate and the image coordinate is obtained through the above formula.
[0013] Optionally, before fitting the first corner coordinate and the image coordinate, the method further comprises: obtaining P-1 training calibration board images and corner coordinates on the training calibration board images, the corner coordinates on the training calibration board images being sub-pixel level, P being an integer greater than 2; selecting one of the sample calibration board image and the P-1 training calibration board images as a target image, and obtaining a normalized position difference of the corner coordinates at corresponding positions between the sample calibration board image and the i-th image of the P-1 training calibration board images relative to the target image, i being an integer from 1 to P; taking all the corner coordinates in the sample calibration board image and the P-1 training calibration board images as updated first corner coordinates; establishing uniform grid images corresponding to the sample calibration board image and the P-1 training calibration board images, adding the corresponding normalized position difference to the corner coordinates of the uniform grid images corresponding to the sample calibration board image and the P-1 training calibration board images to obtain updated uniform grid images corresponding to the sample calibration board image and the P-1 training calibration board images, processing the updated uniform grid images corresponding to the sample calibration board image and the P-1 training calibration board images using the first mapping relationship function and the second mapping relationship function to obtain updated image coordinates ( ), fitting the updated first corner coordinates and the updated image coordinates ( ) to obtain parameters in the first mapping relationship function and the second mapping relationship function. The beneficial effect is that when considering that there are multiple calibration boards, the adverse effects of the errors of the calibration boards themselves on the mapping relationship between the calculated object coordinates and image coordinates can be reduced, and the accuracy of the obtained mapping relationship function can be further improved.
[0014] Optionally, the acquiring the normalized position difference of the corner point coordinates at the corresponding positions between the sample calibration board image and the i-th of the P-1 training calibration board images relative to the target image comprises: acquiring an average displacement difference of the corner point coordinates at the corresponding positions between the sample calibration board image and the i-th of the P-1 training calibration board images relative to the target image, the average displacement difference being in units of pixels; acquiring an average interval of all the corner point coordinates of the sample calibration board image and the P-1 training calibration board images, the average interval being in units of pixels, the i = 1, 2, , P; and acquiring the normalized position difference of the corner point coordinates at the corresponding positions between the sample calibration board image and the i-th of the P-1 training calibration board images relative to the target image by calculating a quotient of the relative position difference and the average interval.
[0015] Optionally, a matrix of the same size as the sample calibration board image and of M x N size is established ||, wherein, ) is an object side coordinate of the matrix, = 0, 1, 2… M 1, = 0, 1, 2… N – 1; the object side coordinate ( ) and the parameters in the second mapping relationship function are substituted into the mapping relationship function between the object image coordinates: ; ; ; the image side coordinate ( ) is obtained, wherein the mapping relationship between ( ) and ( ) is the mapping relationship between the object image coordinates.
[0016] In a second aspect, the present application provides an apparatus for obtaining a mapping relationship between object coordinates and image coordinates, which is configured to execute the method for obtaining a mapping relationship between object coordinates and image coordinates according to any one of the first aspect. The apparatus comprises an obtaining module, an establishing module, a processing module, a fitting module and a mapping module. The obtaining module comprises a first obtaining unit, a second obtaining unit, a third obtaining unit and a fourth obtaining unit. The processing module comprises a first processing unit and a second processing unit. The first obtaining unit is configured to obtain a sample calibration board image and first corner point coordinates. The first corner point coordinates are corner point coordinates on the sample calibration board image, and the first corner point coordinates are sub-pixel level. The establishing module is configured to establish a uniform grid image. The second obtaining unit is configured to obtain second corner point coordinates. The second corner point coordinates are corner point coordinates on the uniform grid image. The first processing unit is configured to perform linear transformation processing on the uniform grid image to obtain object coordinates. The third obtaining unit is configured to obtain a linear mapping relationship between the second corner point coordinates and the object coordinates, i.e. a first mapping relationship function. The second processing unit is configured to perform non-linear transformation processing on the uniform grid image after linear transformation processing to obtain image coordinates. The fourth obtaining unit is configured to obtain a non-linear mapping relationship between the object coordinates and the image coordinates, i.e. a second mapping relationship function. The fitting module is configured to fit the first corner point coordinates and the image coordinates to obtain parameters of the first mapping relationship function and parameters of the second mapping relationship function between the uniform grid image and the image coordinates. The mapping module is configured to obtain a mapping relationship between object coordinates and image coordinates according to the second mapping relationship function and the parameters of the second mapping relationship function.
[0017] In a third aspect, the present application provides a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the method for obtaining a mapping relationship between object coordinates and image coordinates according to any one of the first aspect.
[0018] In a fourth aspect, the present application also provides a terminal comprising a memory and a processor, wherein the memory has a computer program stored thereon, the computer program being capable of being executed on the processor, and wherein the processor, when executing the computer program, performs the steps of the method for obtaining a mapping relationship between object coordinates and image coordinates according to any one of the first aspect.
[0019] The beneficial effects of the second aspect to the fourth aspect can be referred to the description of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0020] Figure 1 An embodiment of a sample calibration board provided by the present application is shown in the following figure;
[0021] Figure 2A flowchart embodiment of a method for obtaining a mapping relationship between object images is provided in the present application.
[0022] Figure 3 An image processing situation diagram is provided in the present application. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing the specific embodiments and are not intended to be limiting on the present application. As used in the specification and the appended claims of the present application, the singular forms “a,” “an,” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises,” “comprising,” “includes,” and / or “including,” as used herein, specify the presence of the stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. The term “and / or” used in the present application generally means that three relationships can exist; for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural.
[0024] In the present specification, the reference to “one embodiment” or “some embodiments” etc. means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, the appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in additional embodiments,” etc. in various places in the specification are not necessarily all referring to the same embodiment, unless otherwise specifically stated. The terms “comprise,” “comprising,” “have,” “having,” “include,” “including,” and “contain,” “containing,” or variants thereof, mean “including but not limited to,” unless otherwise specifically indicated. The term “connected” includes both direct and indirect connections unless otherwise specifically indicated. “First,” “second,” etc. are used only to describe one entity from another, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0025] In the embodiments of the present application, the words “exemplary” or “for example” are used to mean serving as an example, instance, or illustration. Any embodiment or design presented as “exemplary” or “for example” in the embodiments of the present application is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the words “exemplary” or “for example” is intended to present concepts in a concrete manner. In the embodiments of the present application, the term “include” is used to indicate that the item included is not exclusive, and other items are not excluded.
[0026] Before obtaining the mapping relationship function between the object image coordinates of the camera, first use the camera to obtain a sample calibration board as shown in Figure 1 The corner points on the sample calibration board are marked by black circles in Figure 1 According to the corner points on the calibration board, a coordinate system is established, and then a sub-pixel level corner point detection method is used to obtain the corner point coordinates, i.e. the first corner point coordinates.
[0027] In some embodiments, the method for obtaining the mapping relationship between the object image coordinates, as shown in Figure 2 , includes:
[0028] S201: Obtain a sample calibration board image and first corner point coordinates, the first corner point coordinates being the corner point coordinates on the sample calibration board image, and the first corner point coordinates being sub-pixel level;
[0029] S202: Establish a uniform grid image and obtain second corner point coordinates, the second corner point coordinates being the corner point coordinates on the uniform grid image;
[0030] S203: Perform linear transformation processing on the uniform grid image to obtain object coordinates; the linear mapping relationship between the uniform grid image coordinates and the object coordinates is a first mapping relationship function;
[0031] S204: Perform non-linear transformation processing on the uniform grid image after linear transformation processing to obtain image coordinates; the non-linear mapping relationship between the object coordinates and the image coordinates is a second mapping relationship function;
[0032] S205: Fit the first corner point coordinates and the image coordinates to obtain the parameters of the first mapping relationship function between the uniform grid image and the image coordinates and the parameters of the second mapping relationship function;
[0033] S206: Obtain the mapping relationship between the object image coordinates according to the second mapping relationship function and the parameters of the second mapping relationship function.
[0034] The shape formed by the lines on the uniform grid image is a checkerboard structure, and the second corner point coordinates refer to the coordinates of the intersection points between the lines.
[0035] Specifically, in S203, the linear transformation includes at least one of scaling, translation, and rotation.
[0036] To further illustrate the method for obtaining the mapping relationship between the object image coordinates provided by the present application, further examples are given:
[0037] Suppose that the uniform grid image has The corner points are defined as follows: the corner points are distributed in an m x n matrix in the uniform grid image. A coordinate system is established, such as... Figure 3 As shown in (a) of the image. Here, assuming the initial coordinates of the corner point in the uniform grid image are (u, v), the distance between adjacent corner points in each column is 1, and the distance between adjacent corner points in each row is 1, then u = 0, 1, 2, m-1; v=0,1,2, The initial coordinates refer to the coordinates before any processing is performed on the uniform grid image. The initial coordinates are n-1; where m and n are both integers greater than 1, and their maximum values are set according to actual conditions.
[0038] The uniform grid image is magnified to obtain the following: Figure 3 In the image shown in (b), the corner coordinates are changed from the initial coordinates to the first coordinates. , , The value of r is a scaling factor. If the process is to be enlarged, then r is greater than 1. The value of r is obtained by fitting calculation based on the actual situation.
[0039] Next, regarding... Figure 3 The image shown in (b) is translated to obtain the following result: Figure 3 The image shown in (c) has corner coordinates determined by the first coordinate system. Transform into the second coordinate , , The For translation parameters, the and The size is set according to the actual situation.
[0040] Next, regarding Figure 3 The image shown in (c) is rotated to obtain the following result: Figure 3 The image shown in (d) has corner coordinates determined by the second coordinate system. Transform into the third coordinate , In this embodiment, the origin in the coordinate system is the center of rotation, and... The rotation angle is used; in practice, the rotation center can be set according to the specific circumstances.
[0041] Of course, depending on the desired effect of the mapping function, a reasonable linear transformation method can be selected. This means choosing any one of the scaling, translation, and rotation methods, or any combination of scaling, translation, and rotation, to obtain the second image.
[0042] Finally, regarding...Figure 3 The third image is obtained by performing distortion processing on the image shown in (d) of FIG. 1, and the third image is shown in (e) of FIG. 1. Figure 3 The corner point coordinates are changed into fourth coordinates by a formula ; ; The fourth coordinates and the third coordinates are mapped, where is a distortion center, , is a radial distortion parameter, , is a tangential distortion parameter, and are parameters of thin prism distortion.
[0043] Specifically, in S203, the linear mapping is a linear mapping operation of scaling, translation, or rotation on a uniform grid image, and the object side coordinates obtained in the fitting process are not distorted, that is, the first coordinates , the second coordinates , or the third coordinates in the above embodiments; then the image side coordinates obtained in the fitting process are distorted, that is, the fourth coordinates The technical problem to be solved by the present application is that the precision of the mapping relationship between the object side coordinates and the image side coordinates cannot meet the actual requirements, so when the image side coordinates are obtained, the parameters for calculating the object side coordinates are not used, that is, the parameters used to obtain the image side coordinates are actually used, including: , , , , , and .
[0044] Therefore, when the sub-pixel level mapping relationship function is obtained, the above object side coordinates can be regarded as constants , that is, =0, 1, 2, , M-1; =0, 1, 2, , N-1;
[0045] Then, the mapping relationship between the image side coordinates and the object side coordinates is adaptively adjusted as follows:
[0046] ;
[0047] ;
[0048] ;
[0049] in, , , , , , and In step S205, the parameters of the second mapping function obtained by fitting are ( () represents the image-side coordinates. The coordinates are the object coordinates; using the second mapping function and parameters mentioned above... , , , , , and Transitive coordinates The image coordinates were calculated. The value of ) from the object coordinates Image coordinates ( The mapping relationship is the mapping relationship between the object and the image coordinates.
[0050] In some other embodiments, before fitting the first corner coordinates and the image coordinates, the method further includes: acquiring P-1 training calibration board images that have a relative positional difference with the sample calibration board image, and the corner coordinates on the training calibration board images, wherein the corner coordinates on the training calibration board images are at the sub-pixel level, and P is an integer greater than 2; selecting one of the sample calibration board images and the P-1 training calibration board images as the target image, and acquiring the normalized positional difference of the corner coordinates at corresponding positions between the i-th image and the target image, wherein the value of i is an integer from 1 to P; and fitting the sample calibration board... The coordinates of all corner points in the image and P-1 training calibration board images are used as the updated first corner point coordinates; a uniform grid image corresponding to the sample calibration board image and P-1 training calibration board images is established; the corner point coordinates of the uniform grid image corresponding to the sample calibration board image and P-1 training calibration board images are added with the corresponding normalized position difference to obtain the updated uniform grid image corresponding to the sample calibration board image and P-1 training calibration board images; the updated uniform grid image corresponding to the sample calibration board image and P-1 training calibration board images is processed using the first mapping function and the second mapping function to obtain the updated image-side coordinates ( ), and the updated first corner coordinates and the updated image coordinates ( The mapping function and the second mapping function are fitted to obtain the parameters. The mapping relationship obtained in this embodiment is more accurate than that obtained in the above embodiment.
[0051] Further, the normalized position difference (NPD) between the i-th image and the target image at corresponding positions in the sample calibration board image and the P-1 training calibration board images is obtained. The process includes: obtaining the average displacement difference of corner coordinates at corresponding positions between the i-th image and the target image in the sample calibration board image and P-1 training calibration board images, wherein the unit of the average displacement difference is pixels; obtaining the average spacing of all corner coordinates in the sample calibration board image and P-1 training calibration board images, wherein the unit of the average spacing is pixels, and i=1, 2, ... P; through the formula , Calculate the quotient of the relative position difference and the average spacing to obtain the normalized position difference ( ) between the i-th image in the sample calibration board image and P-1 training calibration board images and the target image at the corresponding corner coordinates. ).
[0052] wherein pitch is the average displacement difference, is the relative position difference in horizontal direction of the corner point coordinates at corresponding positions between the sample calibration plate image and the i-th one of the P-1 training calibration plate images relative to the target image, is the relative position difference in vertical direction of the corner point coordinates at corresponding positions between the sample calibration plate image and the i-th one of the P-1 training calibration plate images relative to the target image, is the normalized position difference in horizontal direction of the corner point coordinates at corresponding positions between the sample calibration plate image and the i-th one of the P-1 training calibration plate images relative to the target image, is the normalized position difference in vertical direction of the corner point coordinates at corresponding positions between the sample calibration plate image and the i-th one of the P-1 training calibration plate images relative to the target image.
[0053] In some embodiments, a matrix of the same size as the sample calibration plate image and of size M x N is established ||, wherein is the object side coordinate of the matrix, = 0, 1, 2… M 1, = 0, 1, 2… N – 1; the object side coordinate and the parameters in the second mapping relationship function are substituted into the mapping relationship function between object image coordinates:
[0054] ;
[0055] ;
[0056] ;
[0057] to obtain image side coordinate , wherein the mapping relationship between and is the mapping relationship between the object image coordinates.
[0058] Based on the mapping relationship between the object image coordinates provided by any of the above embodiments, the application further provides an acquisition device for the mapping relationship between the object image coordinates, which is used to execute the acquisition method for the mapping relationship between the object image coordinates as described in any of the above embodiments, and comprises an acquisition module, an establishment module, a processing module, a fitting module and a mapping module. The acquisition module comprises a first acquisition unit, a second acquisition unit, a third acquisition unit and a fourth acquisition unit. The processing module comprises a first processing unit and a second processing unit. The first acquisition unit is used to acquire a sample calibration board image and a first corner point coordinate. The first corner point coordinate is a corner point coordinate on the sample calibration board image, and the first corner point coordinate is at a sub-pixel level. The establishment module is used to establish a uniform grid image. The second acquisition unit is used to acquire a second corner point coordinate. The second corner point coordinate is a corner point coordinate on the uniform grid image. The first processing unit is used to perform linear transformation processing on the uniform grid image to acquire an object side coordinate. The third acquisition unit is used to acquire a linear mapping relationship between the uniform grid image coordinate and the object side coordinate, i.e. a first mapping relationship function. The second processing unit is used to perform nonlinear transformation processing on the uniform grid image after linear transformation processing to acquire an image side coordinate. The fourth acquisition unit is used to acquire a nonlinear mapping relationship between the object side coordinate and the image side coordinate, i.e. a second mapping relationship function. The fitting module is used to fit the first corner point coordinate and the image side coordinate to obtain parameters of the first mapping relationship function and parameters of the second mapping relationship function between the uniform grid image and the image side coordinate. The mapping module is used to obtain the mapping relationship between the object image coordinates according to the second mapping relationship function and the parameters of the second mapping relationship function.
[0059] All the related contents of the steps involved in the above method embodiments can be cited to the functional description of the corresponding unit module, which will not be repeated here.
[0060] In some other embodiments of the present application, the terminal can comprise one or more processors, a memory, a display, one or more application programs (not shown) and one or more computer programs. The above devices can be connected through one or more communication buses. The one or more computer programs are stored in the memory and configured to be executed by the one or more processors. The one or more computer programs comprise instructions which can be used to execute the steps in the corresponding embodiments as described above.
[0061] Those skilled in the art can clearly understand the technical solutions of the present application according to the above description of the embodiments, and for the convenience and brevity of description, only the division of the above functional modules is taken as an example, and in actual application, the above functions can be completed by different functional modules according to the needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0062] The functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0063] When the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method of the embodiments of the present application. The foregoing storage medium includes: a flash memory, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk, and various media that can store program codes.
[0064] The above description is only a specific implementation of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any change or replacement within the technical scope disclosed in the embodiments of the present application should be covered in the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application should be subject to the protection scope of the claims.
Claims
1. A method of obtaining a mapping relationship between object image coordinates, characterized by, The method comprises the following steps: obtaining a sample calibration board image and first corner point coordinates, the first corner point coordinates being sub-pixel level corner point coordinates on the sample calibration board image; establishing a uniform grid image and obtaining second corner point coordinates, the second corner point coordinates being corner point coordinates on the uniform grid image; performing linear transformation processing on the uniform grid image to obtain object coordinates; the linear mapping relationship between the second corner point coordinates and the object coordinates is a first mapping relationship function; performing nonlinear transformation processing on the uniform grid image after linear transformation processing to obtain image coordinates; the nonlinear mapping relationship between the object coordinates and the image coordinates is a second mapping relationship function; fitting the first corner point coordinates and the image coordinates to obtain parameters of the first mapping relationship function and parameters of the second mapping relationship function between the uniform grid image and the image coordinates; obtaining a mapping relationship between object coordinates and image coordinates according to the second mapping relationship function and the parameters of the second mapping relationship function.
2. The method of claim 1, wherein The linear transformation processing on the uniform grid image comprises at least one of scaling processing, translation processing and rotation processing on the uniform grid image.
3. The method of claim 2, wherein The nonlinear transformation processing on the uniform grid image after linear transformation processing comprises radial distortion processing, tangential distortion processing and thin prism distortion processing on the uniform grid image after linear transformation processing.
4. The method of claim 3, wherein The second mapping relationship function is ; ; ; wherein is the center of distortion, , is the radial distortion parameter, , is the tangential distortion parameter, , is the parameter of thin prism distortion, is the image coordinate, is the object coordinate; The first mapping function and the second mapping function are used to map the coordinates of the first corner point and the image coordinates. The first mapping function and the second mapping function are fitted to obtain the parameters.
5. The method of claim 1, wherein Before fitting the first corner point coordinates and the image coordinates, the method further comprises the following steps: obtaining P-1 training calibration board images with relative position differences from the sample calibration board image and corner point coordinates on the training calibration board images, the corner point coordinates on the training calibration board images being sub-pixel level, P being an integer greater than 2; selecting one of the sample calibration board image and the P-1 training calibration board images as a target image, and obtaining normalized position differences of corner point coordinates at corresponding positions between the i-th image among the sample calibration board image and the P-1 training calibration board images and the target image, i being an integer from 1 to P; taking all the corner point coordinates in the sample calibration board image and the P-1 training calibration board images as updated first corner point coordinates; corresponding to the sample calibration plate image and the P-1 training calibration plate images are established, and the corner point coordinates of the uniform grid images corresponding to the sample calibration plate image and the P-1 training calibration plate images are added with the corresponding normalized position difference to obtain updated uniform grid images corresponding to the sample calibration plate image and the P-1 training calibration plate images, and the updated uniform grid images corresponding to the sample calibration plate image and the P-1 training calibration plate images are processed using the first mapping relationship function and the second mapping relationship function to obtain updated image coordinates ), and the updated first corner point coordinates and the updated image coordinates ) are fitted to obtain parameters in the first mapping relationship function and the second mapping relationship function.
6. The method of claim 5, wherein obtaining normalized position differences of corner point coordinates at corresponding positions between the i-th image among the sample calibration board image and the P-1 training calibration board images and the target image, comprising: obtaining average displacement differences of corner point coordinates at corresponding positions between the i-th image among the sample calibration board image and the P-1 training calibration board images and the target image, the average displacement differences being in units of pixels; Obtaining the average interval of all corner point coordinates in the sample calibration plate image and P-1 training calibration plate images, the unit of the average interval is pixel, i=1, 2, , P; obtaining normalized position differences of corner point coordinates at corresponding positions between the i-th image among the sample calibration board image and the P-1 training calibration board images and the target image by calculating a quotient of the relative position differences and the average spacing.
7. The method of claim 4 or 6, wherein a matrix of the same size as the sample calibration plate image and of size M x N is created ||, wherein is the object space coordinate of the matrix, = 0, 1, 2... M 1, = 0, 1, 2... N - 1; Object coordinates ( Substitute the parameters from the second mapping function into the object-image coordinate mapping function: ; ; ; obtaining image coordinates (x, y) in the image plane, wherein a mapping relationship between the image coordinates (x, y) and the object coordinates (X, Y, Z) is determined by the following equations: wherein the mapping relationship between the image coordinates (x, y) and the object coordinates (X, Y, Z) is determined by the following equations: wherein is the center of distortion, , is the radial distortion parameter, , is the tangential distortion parameter, , is the parameter of thin prism distortion, is the image coordinate, is the object coordinate.
8. A device for obtaining the mapping relationship between object and image coordinates, characterized in that, The application discloses a method for acquiring a mapping relationship between object image coordinates, and relates to the technical field of image processing. The first acquisition unit is used for acquiring a sample calibration board image and a first corner point coordinate, the first corner point coordinate is a corner point coordinate on the sample calibration board image, and the first corner point coordinate is a sub-pixel level. The second acquisition unit is used for acquiring a second corner point coordinate, the second corner point coordinate is a corner point coordinate on the uniform grid image. The first processing unit is used for performing linear transformation processing on the uniform grid image to acquire an object side coordinate. The second processing unit is used for performing non-linear transformation processing on the uniform grid image after linear transformation processing to acquire an image side coordinate. The fourth acquisition unit is used for acquiring a non-linear mapping relationship between the object side coordinate and the image side coordinate, that is, a second mapping relationship function. The fitting module is used for fitting the first corner point coordinate and the image side coordinate to obtain parameters of the first mapping relationship function and parameters of the second mapping relationship function between the uniform grid image and the image side coordinate.
9. A storage medium having stored thereon a computer program, characterized in that The mapping module is used for acquiring the mapping relationship between the object image coordinates according to the second mapping relationship function and the parameters of the second mapping relationship function.
10. A terminal comprising a memory and a processor, said memory having stored thereon a computer program capable of running on said processor, characterized in that, The computer program is run by the processor to execute the steps of the method for acquiring the mapping relationship between the object image coordinates. The processor runs the computer program to execute the steps of the method for acquiring the mapping relationship between the object image coordinates.
Citation Information
Patent Citations
Space calibration method, electronic equipment and storage medium
CN111899307A
Camera calibration method, calibration device and computer readable storage medium
CN114387353A