Document correction method, system and medium based on infrared rangefinder
By installing an infrared rangefinder on the camera, the curved and deformed documents captured by the digital camera are automatically corrected using geometric relationships, and the difficulty in document processing caused by distortion in the prior art is solved, and the automated document correction effect is achieved.
Patent Information
- Application Number
- CN202211533467.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-12-02
AI Technical Summary
In the prior art, when processing curved and deformed documents, the document images captured by digital cameras are prone to distortion, which leads to difficulty in OCR recognition and processing of digital documents. Especially when the paper shape is irregular or edge information is missing, edge detection algorithms or manual selection of four points are often required for correction.
Using an infrared rangefinder-based method, by installing three infrared rangefinders on the camera lens plane, the plane distance value and image pixel coordinates are obtained to convert them into physical coordinates, and distortion correction is performed in combination with geometric relationships to achieve automatic correction.
Document correction can be completed without edge detection algorithms or manual selection of points, adapt to irregular paper, and automatically convert oblique views to front views, simplifying the document correction process.
Smart Images

Figure CN115661000B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing technology, and in particular to a document correction method, system and medium based on an infrared rangefinder. Background Art
[0002] In recent years, digitized documents have been widely used in fields such as office automation, digital libraries, and industrial automation. With the advancement of technology, the shortcomings of traditional scanners, such as bulk, low efficiency, and inconvenience, have become increasingly prominent. Digital cameras, on the other hand, are compact and inexpensive, making them easy to carry and integrate with mobile phones, laptops, and various network devices. They can also capture background text and fragile, valuable documents from a distance, making them particularly suitable for digitization operations in unconstrained environments. Consequently, the integration of digital cameras into document image analysis has attracted increasing attention. Over the past 20 years, camera-based document analysis has seen a number of applications, such as automated license reading, book and magazine classification, truck ID recognition, highway sign recognition, and hazard sign recognition. However, document images captured with digital cameras present new challenges that need to be addressed: When the document surface is curved or deformed, the text and graphics captured by the camera will be distorted. In scanners, where the document is pressed against the scanning plate, this problem is less severe. Document image deformation greatly complicates subsequent processing tasks, such as optical character recognition (OCR), layout analysis, and formatting. Therefore, image correction must be used to restore these deformed documents. Conventional document correction requires edge detection algorithms or manual selection of four points on the document. Irregular paper shapes or missing edge information can complicate correction. Summary of the Invention
[0003] The present invention overcomes the deficiencies of the prior art and provides a document correction method, system and medium based on an infrared rangefinder.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is:
[0005] A first aspect of the present invention provides a document correction method based on an infrared rangefinder, comprising the following steps:
[0006] By installing three infrared rangefinders on the plane where the camera lens is located, one infrared rangefinder is installed on the right side of the camera lens and at the same level as the center of the lens, and the other two infrared rangefinders are set perpendicular to the ground and the line connecting the two infrared rangefinders is perpendicular to the ground;
[0007] Obtain a plane in the real world and set the plane to A2B2C2D2, obtain a distance value between the infrared rangefinder and the plane A2B2C2D2 using an infrared rangefinder, and obtain an original image of the plane A2B2C2D2 projected onto a light screen;
[0008] Preprocessing the original image projected by the plane A2B2C2D2 onto the light screen to convert the image pixel coordinate values into image physical coordinate values to obtain a primarily processed image;
[0009] By performing distortion correction processing on the image after the primary processing to obtain a secondary processed image, and obtaining the camera parameter information of the camera, a corrected image projected onto the light screen is obtained based on the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image and the camera parameter information.
[0010] Furthermore, in a preferred embodiment of the present invention, the original image projected by the plane A2B2C2D2 onto the light screen is pre-processed to convert the image pixel coordinate values into image physical coordinate values to obtain the initially processed image, specifically:
[0011] When the image pixel coordinate values are converted to the image physical coordinate values, the following relationship is satisfied:
[0012]
[0013] Among them, u and v are image pixel coordinate values, u0 and v0 are the first image pixel coordinate values in the image pixel coordinate values, and x and y are the physical coordinate values of the image after processing the plane A2B2C2D2. 、 They are all differential integrals of the physical coordinates of the image;
[0014] And by recombining the physical coordinates, the image after initial processing is obtained.
[0015] Furthermore, in a preferred embodiment of the present invention, obtaining a corrected image projected onto a light screen based on the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information specifically includes the following steps:
[0016] Obtaining a camera plane of the current camera according to the camera parameter information, setting the camera plane to A'B'C'D', calculating relevant parameters according to the plane A2B2C2D2 and the camera plane A'B'C'D', and solving an equation for the plane A2B2C2D2;
[0017] Calculate the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' according to the relevant parameters and the equation of the plane A2B2C2D2;
[0018] The points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, and the points projected onto the camera plane are calculated based on the points on the relevant plane;
[0019] Construct a new coordinate system, migrate the points on the camera plane to the new coordinate system to obtain multiple new coordinate values, reconstruct the plane according to the multiple new coordinate values, and complete the plane through an interpolation algorithm to generate an image and save the image.
[0020] Furthermore, in a preferred embodiment of the present invention, the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' is calculated based on the relevant parameters and the equation of the plane A2B2C2D2, and the points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, specifically:
[0021] Let the point on the relevant plane be (X, Y, 0), and let the point on the A2B2C2D2 plane be (x, y, z);
[0022] The points on plane A'B'C'D' are transferred to the points on the relevant plane after two rotations to satisfy the following relationship:
[0023]
[0024]
[0025] Among them, X, Y are the coordinate values of the points on the relevant plane, A, B, and C are the coordinate values of the normal vector of the plane A2B2C2D2, x, y, and z are the physical coordinate values of the image after processing the plane A2B2C2D2, θ is the angle between the plane A2B2C2D2 and the x-axis of the spatial coordinate axis, V is the image distance, α is the angle between the plane A2B2C2D2 and the y-axis of the spatial coordinate axis, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
[0026] Furthermore, in a preferred embodiment of the present invention, calculating the point projected onto the camera plane based on the point on the relevant plane specifically includes:
[0027] Let the point on the camera plane be (X final , Y final , z0), when the point (X, Y, 0) on the relevant plane is projected to the point on the camera plane, the following relationship is satisfied:
[0028]
[0029]
[0030] Among them, X final , Y final are the coordinate values of points on the camera plane, X, Y are the coordinate values of points on the relevant plane, V is the image distance, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
[0031] A second aspect of the present invention provides a document correction system based on an infrared rangefinder. The system includes a memory and a processor. The memory includes a document correction method program based on an infrared rangefinder. When the document correction method program based on an infrared rangefinder is executed by the processor, the following steps are implemented:
[0032] By installing three infrared rangefinders on the plane where the camera lens is located, one infrared rangefinder is installed on the right side of the camera lens and at the same level as the center of the lens, and the other two infrared rangefinders are set perpendicular to the ground and the line connecting the two infrared rangefinders is perpendicular to the ground;
[0033] Obtain a plane in the real world and set the plane to A2B2C2D2, obtain a distance value between the infrared rangefinder and the plane A2B2C2D2 using an infrared rangefinder, and obtain an original image of the plane A2B2C2D2 projected onto a light screen;
[0034] Preprocessing the original image projected by the plane A2B2C2D2 onto the light screen to convert the image pixel coordinate values into image physical coordinate values to obtain a primarily processed image;
[0035] By performing distortion correction processing on the image after the primary processing to obtain a secondary processed image, and obtaining the camera parameter information of the camera, a corrected image projected onto the light screen is obtained based on the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image and the camera parameter information.
[0036] In an embodiment, the original image projected by the plane A2B2C2D2 onto the light screen is pre-processed to convert the image pixel coordinate values into image physical coordinate values to obtain the image after primary processing, specifically:
[0037] When the image pixel coordinate values are converted to the image physical coordinate values, the following relationship is satisfied:
[0038]
[0039] Among them, u and v are image pixel coordinate values, u0 and v0 are the first image pixel coordinate values in the image pixel coordinate values, and x and y are the physical coordinate values of the image after processing the plane A2B2C2D2. 、 They are all differential integrals of the physical coordinates of the image;
[0040] And by recombining the physical coordinates, the image after initial processing is obtained.
[0041] In an embodiment, obtaining a corrected image projected onto a light screen according to the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information specifically includes the following steps:
[0042] Obtaining a camera plane of the current camera according to the camera parameter information, setting the camera plane to A'B'C'D', calculating relevant parameters according to the plane A2B2C2D2 and the camera plane A'B'C'D', and solving an equation for the plane A2B2C2D2;
[0043] Calculate the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' according to the relevant parameters and the equation of the plane A2B2C2D2;
[0044] The points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, and the points projected onto the camera plane are calculated based on the points on the relevant plane;
[0045] Construct a new coordinate system, migrate the points on the camera plane to the new coordinate system to obtain multiple new coordinate values, reconstruct the plane according to the multiple new coordinate values, and complete the plane through an interpolation algorithm to generate an image and save the image.
[0046] In an embodiment, the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' is calculated based on the relevant parameters and the equation of the plane A2B2C2D2, and the points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, specifically:
[0047] Let the point on the relevant plane be (X, Y, 0), and let the point on the A2B2C2D2 plane be (x, y, z);
[0048] The points on plane A'B'C'D' are transferred to the points on the relevant plane after two rotations to satisfy the following relationship:
[0049]
[0050]
[0051] Among them, X, Y are the coordinate values of the points on the relevant plane, A, B, and C are the coordinate values of the normal vector of the plane A2B2C2D2, x, y, and z are the physical coordinate values of the image after processing the plane A2B2C2D2, θ is the angle between the plane A2B2C2D2 and the x-axis of the spatial coordinate axis, V is the image distance, α is the angle between the plane A2B2C2D2 and the y-axis of the spatial coordinate axis, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
[0052] A third aspect of the present invention provides a computer-readable storage medium, which includes a document correction method program based on an infrared rangefinder. When the document correction method program based on an infrared rangefinder is executed by a processor, the steps of any one of the document correction methods based on an infrared rangefinder are implemented.
[0053] The present invention solves the defects existing in the background technology and has the following beneficial effects:
[0054] This method can achieve the goal of correcting the camera document when it is necessary to do so without using an edge detection algorithm or manually selecting four points of the document. This avoids the situation where correction is difficult when the paper shape is irregular or some edge information is missing. By setting up an infrared rangefinder, the camera document can be automatically corrected, and the oblique view captured by the camera can be converted into a straight-on top view using geometric relationships. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, without paying any creative work, they can also obtain drawings of other embodiments based on these drawings.
[0056] Figure 1 Shows a schematic diagram of the installation of an infrared rangefinder;
[0057] Figure 2 A geometric diagram of the image correction process is shown;
[0058] Figure 3 The overall method flow chart of a document correction method based on an infrared rangefinder is shown;
[0059] Figure 4 The system block diagram of a document correction system based on infrared rangefinder is shown. DETAILED DESCRIPTION
[0060] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0061] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.
[0062] A first aspect of the present invention provides a document correction method based on an infrared rangefinder, comprising the following steps:
[0063] S102: Install three infrared rangefinders on the plane where the camera lens is located, wherein one infrared rangefinder is installed on the right side of the camera lens and is at the same level as the center of the lens, and the other two infrared rangefinders are placed perpendicular to the ground and the line connecting the two infrared rangefinders is perpendicular to the ground;
[0064] S104: Acquire a plane in the real world, and set the plane in the real world as A2B2C2D2, obtain a distance value between the infrared rangefinder and the plane A2B2C2D2 through an infrared rangefinder, and obtain an original image of the plane A2B2C2D2 projected onto a light screen;
[0065] S106: Pre-processing the original image projected by the plane A2B2C2D2 onto the light screen to convert the image pixel coordinate values into image physical coordinate values to obtain a primarily processed image;
[0066] S108: Performing distortion correction on the initially processed image to obtain a secondary processed image, and obtaining camera parameter information of the camera, and obtaining a corrected image projected onto the light screen based on the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information.
[0067] It should be noted that, in this embodiment, Figure 1As shown, three infrared rangefinders are installed on the plane where the camera lens is located, one of which is installed on the right side of the camera lens and is at the same level as the center of the lens. The other two infrared rangefinders are set perpendicular to the ground and the line connecting the two infrared rangefinders is perpendicular to the ground. The center point of the infrared rangefinder on the right is marked as point I, and the two infrared rangefinders on the left are marked as points H and G. The rangefinder I on the right is at the same level as the center of the camera receiving screen, and the line connecting the rangefinder G and the rangefinder H on the left is perpendicular to the horizontal line. The three rangefinders are equivalent to points I, H, and G respectively. Let the length of the line connecting GH be b, and the length of the line connecting point I to the center point of GH be a. The camera parameter information includes the camera plane when the camera is shooting, that is, the multiple points (X final , Y final , z0) is the camera plane.
[0068] Among them, the image after the primary processing is subjected to distortion correction processing to obtain the image after secondary processing. In this process, the pixel positions in REC are distorted in sequence to obtain a distorted floating-point pixel position mapping diagram, and then based on the mapping diagram, the corresponding position point of the REC pixel position in DIS is found, and the pixel values of the four neighboring positions of the corresponding position point are bilinearly interpolated to obtain the pixel value of the corresponding position point. In this way, the corresponding pixel value of each position of REC is found from DIS, thereby obtaining a dedistorted image.
[0069] like Figure 2 As shown, suppose a plane in the real world is A2B2C2D2. When the infrared light emitted by the infrared rangefinder hits the plane A2B2C2D2, it can return three corresponding distances, where the distance measured by rangefinder I is recorded as S1, the distance measured by rangefinder H is recorded as S3, and the distance measured by rangefinder G is recorded as S2. That is, the Z-axis coordinate value of the infrared rangefinder in the world coordinate system can be expressed as
[0070]
[0071] Where z0 is the Z-axis coordinate of the infrared rangefinder in the world coordinate system. The distance measured by rangefinder I is recorded as S1, the distance measured by rangefinder H is recorded as S3, and the distance measured by rangefinder G is recorded as S2. The infrared rangefinder is the center point of the camera plane.
[0072] Among them, the coordinates of point I can be expressed as ( ,0,z0),G( , , z0), H ( , , z0).
[0073] Attachment Figure 2In the diagram, A2B2C2D2 is a plane in the real world, and A'B'C'D' is a virtual image that is oriented in the same direction as the object image on the camera screen and is the same size as the image on the receiving screen (that is, the distance from the virtual image to the pinhole is the same as the distance from the receiving screen to the pinhole). Because the image on the receiving screen is inverted, modern cameras automatically invert the image. Therefore, the image captured by the camera can be equated to the virtual image at the hand-drawn red arrow.
[0074] Plane A2B2C2D2 is a real-world plane. Planes A'B'C'D' represent the virtual image formed on the camera screen. They are the same size as the image on the receiving screen, and the distance from the virtual image to the pinhole is the same as the distance from the receiving screen to the pinhole. Based on the principle of pinhole imaging, the virtual image is the image on the receiving screen rotated 180° horizontally. Since the receiving screen receives an inverted image, modern cameras automatically invert it, so the image captured by the camera can be equated to the virtual image in front of the receiving screen.
[0075] Furthermore, in a preferred embodiment of the present invention, the original image projected by the plane A2B2C2D2 onto the light screen is pre-processed to convert the image pixel coordinate values into image physical coordinate values to obtain the initially processed image, specifically:
[0076] When the image pixel coordinate values are converted to the image physical coordinate values, the following relationship is satisfied:
[0077]
[0078] Among them, u and v are image pixel coordinate values, u0 and v0 are the first image pixel coordinate values in the image pixel coordinate values, and x and y are the physical coordinate values of the image after processing the plane A2B2C2D2. 、 They are all differential integrals of the physical coordinates of the image;
[0079] And by recombining the physical coordinates, the image after initial processing is obtained.
[0080] Furthermore, in a preferred embodiment of the present invention, obtaining a corrected image projected onto a light screen based on the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information specifically includes the following steps:
[0081] Obtaining a camera plane of the current camera according to the camera parameter information, setting the camera plane to A'B'C'D', calculating relevant parameters according to the plane A2B2C2D2 and the camera plane A'B'C'D', and solving an equation for the plane A2B2C2D2;
[0082] Calculate the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' according to the relevant parameters and the equation of the plane A2B2C2D2;
[0083] The points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, and the points projected onto the camera plane are calculated based on the points on the relevant plane;
[0084] Construct a new coordinate system, migrate the points on the camera plane to the new coordinate system to obtain multiple new coordinate values, reconstruct the plane according to the multiple new coordinate values, and complete the plane through an interpolation algorithm to generate an image and save the image.
[0085] It should be noted that the relevant parameters include the angle θ between the plane A2B2C2D2 and the x-axis of the spatial coordinate axis, the angle α between the plane A2B2C2D2 and the y-axis of the spatial coordinate axis, and the image distance V. Let the plane normal vector of the plane A2B2C2D2 be P. According to the geometric relationship, the normal vector of the plane A2B2C2D2 can be obtained
[0086]
[0087] Among them, i, j, k are all unit vectors, such as Figure 2 As shown, θ is the angle between the plane A2B2C2D2 and the x-axis of the spatial coordinate axis, and α is the angle between the plane A2B2C2D2 and the y-axis of the spatial coordinate axis.
[0088] Suppose the equation of the plane A2B2C2D2 is Ax+By+Cz=0, that is, the equation of the plane A2B2C2D2 can be obtained according to the plane normal vector.
[0089] Among them, the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' is calculated according to the relevant parameters and the equation of the plane A2B2C2D2, specifically: among them, the points on the plane A2B2C2D2 are the point coordinate values on the image, and the points on the plane A'B'C'D' are the real object coordinate values in the real world.
[0090] like Figure 2 As shown, let the point on plane A2B2C2D2 be (x, y, z), let the point on plane A'B'C'D' be (x', y', z'), the points on plane A2B2C2D2 and the points on plane A'B'C'D' satisfy:
[0091]
[0092]
[0093]
[0094] Among them, x, y, z are the physical coordinate values of the image after processing the plane A2B2C2D2, A, B, C are the coordinate values of the normal vector of the plane A2B2C2D2, V is the image distance, z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system, and x', y', z' are the coordinate values of the real object in the real world.
[0095] The image distance V can be deduced from the Gaussian imaging formula to obtain the following relationship:
[0096]
[0097] in, is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system, is the focal length and V is the image distance.
[0098] Furthermore, in a preferred embodiment of the present invention, the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' is calculated based on the relevant parameters and the equation of the plane A2B2C2D2, and the points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, specifically:
[0099] like Figure 2 As shown, where the relevant plane is the X0Y plane, let the point on the relevant plane be (X, Y, 0), let the point on the A2B2C2D2 plane be (x, y, z);
[0100] The points on plane A'B'C'D' are transferred to the points on the relevant plane after two rotations to satisfy the following relationship:
[0101]
[0102]
[0103] Among them, X, Y are the coordinate values of the points on the relevant plane, A, B, and C are the coordinate values of the normal vector of the plane A2B2C2D2, x, y, and z are the physical coordinate values of the image after processing the plane A2B2C2D2, θ is the angle between the plane A2B2C2D2 and the x-axis of the spatial coordinate axis, V is the image distance, α is the angle between the plane A2B2C2D2 and the y-axis of the spatial coordinate axis, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
[0104] Furthermore, in a preferred embodiment of the present invention, calculating the point projected onto the camera plane based on the point on the relevant plane specifically includes:
[0105] like Figure 2As shown, let the point on the camera plane be (X final , Y final , z0), when the point (X, Y, 0) on the relevant plane is projected to the point on the camera plane, the following relationship is satisfied:
[0106]
[0107]
[0108] Among them, X final , Y final are the coordinate values of points on the camera plane, X, Y are the coordinate values of points on the relevant plane, V is the image distance, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
[0109] Finally, a new coordinate system is constructed by converting the image pixel coordinate value into the image physical coordinate value, and the point on the camera plane is transferred to the new coordinate system to obtain multiple new coordinate values. The plane is reconstructed according to the multiple new coordinate values, and the point on the camera plane is (X final , Y final , z0) is converted into corresponding pixel values, and the plane is completed through the interpolation algorithm to generate an image and save the image.
[0110] Since there are still many elements in the image that are not assigned values (0), an interpolation algorithm is used to complete them. The interpolation method satisfies the following relationship:
[0111]
[0112]
[0113] In the above formula, dstX and dstY are the horizontal and vertical coordinates of a pixel in the destination image, dstWidth and dstHeight are the height and width of the destination image, srcWidth and srcHeight are the width and height of the source image, and srcX and srcY are the coordinates of the source image corresponding to the point (dstX, dstY) in the destination image.
[0114] A second aspect of the present invention provides a document correction system based on an infrared rangefinder. The system includes a memory 41 and a processor 62. The memory 41 contains a program for a document correction method based on an infrared rangefinder. When the program is executed by the processor 62, the following steps are implemented:
[0115] By installing three infrared rangefinders on the plane where the camera lens is located, one infrared rangefinder is installed on the right side of the camera lens and at the same level as the center of the lens, and the other two infrared rangefinders are set perpendicular to the ground and the line connecting the two infrared rangefinders is perpendicular to the ground;
[0116] Obtain a plane in the real world, and set the plane in the real world as A2B2C2D2, obtain a distance value between the infrared rangefinder and the plane A2B2C2D2 through an infrared rangefinder, and obtain an original image of the plane A2B2C2D2 projected onto a light screen;
[0117] Preprocessing the original image projected by the plane A2B2C2D2 onto the light screen to convert the image pixel coordinate values into image physical coordinate values to obtain a primarily processed image;
[0118] By performing distortion correction processing on the image after the primary processing to obtain a secondary processed image, and obtaining the camera parameter information of the camera, a corrected image projected onto the light screen is obtained based on the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image and the camera parameter information.
[0119] In an embodiment, the original image projected by the plane A2B2C2D2 onto the light screen is pre-processed to convert the image pixel coordinate values into image physical coordinate values to obtain the image after primary processing, specifically:
[0120] When the image pixel coordinate values are converted to the image physical coordinate values, the following relationship is satisfied:
[0121]
[0122] Among them, u and v are image pixel coordinate values, u0 and v0 are the first image pixel coordinate values in the image pixel coordinate values, and x and y are the physical coordinate values of the image after processing the plane A2B2C2D2. 、 They are all differential integrals of the physical coordinates of the image;
[0123] And by recombining the physical coordinates, the image after initial processing is obtained.
[0124] In an embodiment, obtaining a corrected image projected onto a light screen according to the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information specifically includes the following steps:
[0125] Obtaining a camera plane of the current camera according to the camera parameter information, setting the camera plane to A'B'C'D', calculating relevant parameters according to the plane A2B2C2D2 and the camera plane A'B'C'D', and solving an equation for the plane A2B2C2D2;
[0126] Calculate the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' according to the relevant parameters and the equation of the plane A2B2C2D2;
[0127] The points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, and the points projected onto the camera plane are calculated based on the points on the relevant plane;
[0128] Construct a new coordinate system, migrate the points on the camera plane to the new coordinate system to obtain multiple new coordinate values, reconstruct the plane according to the multiple new coordinate values, and complete the plane through an interpolation algorithm to generate an image and save the image.
[0129] In an embodiment, the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' is calculated based on the relevant parameters and the equation of the plane A2B2C2D2, and the points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, specifically:
[0130] like Figure 2 As shown, let the point on the relevant plane be (X, Y, 0), and let the point on the A2B2C2D2 plane be (x, y, z);
[0131] The points on plane A'B'C'D' are transferred to the points on the relevant plane after two rotations to satisfy the following relationship:
[0132]
[0133]
[0134] Among them, X, Y are the coordinate values of the points on the relevant plane, A, B, and C are the coordinate values of the normal vector of the plane A2B2C2D2, x, y, and z are the physical coordinate values of the image after processing the plane A2B2C2D2, θ is the angle between the plane A2B2C2D2 and the x-axis of the spatial coordinate axis, V is the image distance, α is the angle between the plane A2B2C2D2 and the y-axis of the spatial coordinate axis, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
[0135] A third aspect of the present invention provides a computer-readable storage medium, which includes a document correction method program based on an infrared rangefinder. When the document correction method program based on an infrared rangefinder is executed by a processor, the steps of any one of the document correction methods based on an infrared rangefinder are implemented.
[0136] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0137] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0138] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0139] Those skilled in the art will appreciate that all or part of the steps of the above-mentioned method embodiments may be implemented by hardware associated with program instructions, and the aforementioned program may be stored in a computer-readable storage medium. When the program is executed, the program executes the steps of the above-mentioned method embodiments. The aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0140] Alternatively, if the integrated units described above are implemented as software modules and sold or used as standalone products, they can also be stored on a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product, stored on a storage medium, includes instructions for enabling a computer device (such as a personal computer, server, or network device) to execute all or part of the methods of the various embodiments of the present invention. The aforementioned storage media include various media capable of storing program code, such as removable storage devices, ROM, RAM, magnetic disks, or optical disks.
[0141] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A document correction method based on infrared rangefinder, characterized in that: The following steps are involved: By installing three infrared rangefinders on the plane where the camera lens is located, one infrared rangefinder is installed on the right side of the camera lens and at the same level as the center of the lens, and the other two infrared rangefinders are set perpendicular to the ground and the line connecting the two infrared rangefinders is perpendicular to the ground; Obtain a plane in the real world, and set the plane in the real world as A2B2C2D2, obtain a distance value between the infrared rangefinder and the plane A2B2C2D2 through an infrared rangefinder, and obtain an original image of the plane A2B2C2D2 projected onto a light screen; Preprocessing the original image projected by the plane A2B2C2D2 onto the light screen to convert the image pixel coordinate values into image physical coordinate values to obtain a primarily processed image; Performing distortion correction on the initially processed image to obtain a secondary processed image, and obtaining camera parameter information of a camera, and obtaining a corrected image projected onto a light screen based on the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information; Obtaining a corrected image projected onto a light screen according to the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information specifically includes the following steps: Obtaining a camera plane of the current camera according to the camera parameter information, setting the camera plane to A'B'C'D', calculating relevant parameters according to the plane A2B2C2D2 and the camera plane A'B'C'D', and solving an equation for the plane A2B2C2D2; Calculate the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' according to the relevant parameters and the equation of the plane A2B2C2D2; The points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, and the points projected onto the camera plane are calculated based on the points on the relevant plane; Constructing a new coordinate system, migrating points on the camera plane to the new coordinate system to obtain a plurality of new coordinate values, reconstructing a plane based on the plurality of new coordinate values, and completing the plane using an interpolation algorithm to generate an image and save the image; The geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' is calculated according to the relevant parameters and the equation of the plane A2B2C2D2, and the points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, specifically: Let the point on the relevant plane be (X, Y, 0), and let the point on the A2B2C2D2 plane be (x, y, z); The points on plane A'B'C'D' are transferred to the points on the relevant plane after two rotations to satisfy the following relationship: , , Among them, X, Y are the coordinate values of the points on the relevant plane, A, B, and C are the coordinate values of the normal vector of the plane A2B2C2D2, x, y, and z are the physical coordinate values of the image after processing the plane A2B2C2D2, θ is the angle between the plane A2B2C2D2 and the x-axis of the spatial coordinate axis, V is the image distance, α is the angle between the plane A2B2C2D2 and the y-axis of the spatial coordinate axis, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
2. The document correction method based on infrared rangefinder according to claim 1, characterized in that: The original image projected by the plane A2B2C2D2 onto the light screen is pre-processed to convert the image pixel coordinate values into image physical coordinate values to obtain the image after primary processing, specifically: When the image pixel coordinate values are converted to the image physical coordinate values, the following relationship is satisfied: , Among them, u and v are image pixel coordinate values, u0 and v0 are the first image pixel coordinate values in the image pixel coordinate values, and x and y are the physical coordinate values of the image after processing the plane A2B2C2D2. 、 They are all differential integrals of the physical coordinates of the image; And by recombining the physical coordinates, the image after initial processing is obtained.
3. The document correction method based on infrared rangefinder according to claim 1, characterized in that: Calculating a point projected onto the camera plane according to the point on the relevant plane specifically includes: Let the point on the camera plane be (X final , Y final , z0), when the point (X, Y, 0) on the relevant plane is projected to the point on the camera plane, the following relationship is satisfied: , , Among them, X final , Y final are the coordinate values of points on the camera plane, X, Y are the coordinate values of points on the relevant plane, V is the image distance, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
4. A document correction system based on infrared rangefinder, characterized in that: The system includes a memory and a processor. The memory contains a document correction method program based on an infrared rangefinder. When the document correction method program based on an infrared rangefinder is executed by the processor, the following steps are implemented: By installing three infrared rangefinders on the plane where the camera lens is located, one infrared rangefinder is installed on the right side of the camera lens and at the same level as the center of the lens, and the other two infrared rangefinders are set perpendicular to the ground and the line connecting the two infrared rangefinders is perpendicular to the ground; Obtain a plane in the real world, and set the plane in the real world as A2B2C2D2, obtain a distance value between the infrared rangefinder and the plane A2B2C2D2 through an infrared rangefinder, and obtain an original image of the plane A2B2C2D2 projected onto a light screen; Preprocessing the original image projected by the plane A2B2C2D2 onto the light screen to convert the image pixel coordinate values into image physical coordinate values to obtain a primarily processed image; Performing distortion correction on the initially processed image to obtain a secondary processed image, and obtaining camera parameter information of a camera, and obtaining a corrected image projected onto a light screen based on the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information; Obtaining a corrected image projected onto a light screen according to the distance value from the infrared rangefinder to the plane A2B2C2D2, the processed secondary image, and the camera parameter information specifically includes the following steps: Obtaining a camera plane of the current camera according to the camera parameter information, setting the camera plane to A'B'C'D', calculating relevant parameters according to the plane A2B2C2D2 and the camera plane A'B'C'D', and solving an equation for the plane A2B2C2D2; Calculate the geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' according to the relevant parameters and the equation of the plane A2B2C2D2; The points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, and the points projected onto the camera plane are calculated based on the points on the relevant plane; Constructing a new coordinate system, migrating points on the camera plane to the new coordinate system to obtain a plurality of new coordinate values, reconstructing a plane based on the plurality of new coordinate values, and completing the plane using an interpolation algorithm to generate an image and save the image; The geometric relationship between the points on the plane A2B2C2D2 and the points on the plane A'B'C'D' is calculated according to the relevant parameters and the equation of the plane A2B2C2D2, and the points on the plane A'B'C'D' are transferred to the points on the relevant plane after two rotations, specifically: Let the point on the relevant plane be (X, Y, 0), and let the point on the A2B2C2D2 plane be (x, y, z); The points on plane A'B'C'D' are transferred to the points on the relevant plane after two rotations to satisfy the following relationship: , , Among them, X, Y are the coordinate values of the points on the relevant plane, A, B, and C are the coordinate values of the normal vector of the plane A2B2C2D2, x, y, and z are the physical coordinate values of the image after processing the plane A2B2C2D2, θ is the angle between the plane A2B2C2D2 and the x-axis of the spatial coordinate axis, V is the image distance, α is the angle between the plane A2B2C2D2 and the y-axis of the spatial coordinate axis, and z0 is the Z-axis coordinate value of the infrared rangefinder in the world coordinate system.
5. The document correction system based on infrared rangefinder according to claim 4, characterized in that: The original image projected by the plane A2B2C2D2 onto the light screen is pre-processed to convert the image pixel coordinate values into image physical coordinate values to obtain the image after primary processing, specifically: When the image pixel coordinate values are converted to the image physical coordinate values, the following relationship is satisfied: , Among them, u and v are image pixel coordinate values, u0 and v0 are the first image pixel coordinate values in the image pixel coordinate values, and x and y are the physical coordinate values of the image after processing the plane A2B2C2D2. 、 They are all differential integrals of the physical coordinates of the image; And by recombining the physical coordinates, the image after initial processing is obtained.
6. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a document correction method program based on an infrared rangefinder. When the document correction method program based on an infrared rangefinder is executed by a processor, the steps of the document correction method based on an infrared rangefinder as described in any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Document image geometric correction method, system and device and medium
CN114418869A
System and method for imaging device modelling and calibration
US20160140713A1