Perspective transformation image acquisition method and system based on binocular data acquisition equipment
Through the perspective transformation image acquisition method of binocular data acquisition equipment, the perspective distortion problem of the monocular camera when acquiring students' desktop images is solved, the accurate coordinate transformation and perspective correction of the image are achieved, and the accuracy and efficiency of image recognition are improved.
Patent Information
- Application Number
- CN202411676188.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-11-22
AI Technical Summary
When a monocular camera captures images of students' desktops, it is difficult to accurately eliminate perspective distortion and lens distortion, resulting in image distortion and difficulty in accurately restoring the actual size and shape of objects.
A perspective transformation image acquisition method based on binocular data acquisition equipment is adopted. By calculating the perspective transformation matrix and its inverse matrix, the focus and zoom of the camera device are adjusted. Combined with the instance segmentation AI model and the minimum enclosing rectangle method, the image boundary is identified and corrected, and the corrected image is output.
Accurate coordinate transformation and perspective correction of images are achieved, the accuracy and efficiency of image recognition are improved, and the output image is suitable for subsequent analysis and processing.
Smart Images

Figure CN119183025B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image acquisition, and in particular to a perspective transformation image acquisition method and system based on a binocular data acquisition device. Background Art
[0002] When using a monocular camera to capture images of objects on students' desks in the classroom, the main drawback is image correction: Because monocular cameras lack stereo vision, they struggle to accurately eliminate perspective and lens distortion during the image correction process. This means that captured images may be distorted, especially around edges, making it difficult to accurately restore the objects' true size and shape. Therefore, improvements are needed. Summary of the Invention
[0003] In order to solve the above problems, the present application provides a perspective transformation image acquisition method and system based on a binocular data acquisition device.
[0004] A perspective transformation image acquisition method based on a binocular data acquisition device comprises the following steps:
[0005] S10: When an image acquisition instruction is received from the teacher terminal, the original image of the object to be identified on the desktop is extracted from the image acquisition instruction;
[0006] S20: Based on the parameters of the camera device, calculate the perspective transformation matrix and its inverse matrix required to transform the original object image in the camera device coordinate system into the final object image in the preset coordinate system, and adjust the focus and zoom of the camera device;
[0007] S30: Based on the preset instance segmentation AI model, identify the boundaries of the original object image and output the boundary coordinates of the original object image;
[0008] S40: Outputting the coordinates of the boundary corner points of the final object image based on the perspective transformation matrix, the boundary coordinates of the original object image, and the minimum bounding rectangle method;
[0009] S50: Outputting a corrected final object image based on a preset perspective transformation processing model and the coordinates of the boundary corner points of the final object image;
[0010] S60: performing image optimization processing on the corrected final object image, and outputting the optimized final object image.
[0011] In a preferred embodiment, the step of calculating the perspective transformation matrix and its inverse matrix required to transform the original object image in the camera coordinate system into the final object image in the preset coordinate system based on the camera device parameters, and adjusting the focus and zoom of the camera device, comprises the following steps:
[0012] S201: Outputting parameters of the camera device, the parameters including built-in parameters and external parameters. The built-in parameters include focal length and built-in parameter matrix, and the external parameters include the position, rotation matrix and translation vector of the camera device in a preset coordinate system;
[0013] S202: Based on the parameters of the camera device and the preset formula , calculate the perspective transformation matrix , represents the built-in parameter matrix of the camera device, represents the rotation matrix, Represents the translation vector.
[0014] In a preferred embodiment, the step of calculating the perspective transformation matrix and its inverse matrix required to transform the original object image in the camera coordinate system into the final object image in the preset coordinate system based on the camera device parameters, and adjusting the focus and zoom of the camera device, further includes the following steps:
[0015] S203: Calculating a focus adjustment amount based on the depth and focal length of the original object image, sending the focus adjustment amount and a focus adjustment instruction to the camera device to adjust the focus of the lens;
[0016] S204: Calculating a zoom adjustment amount based on the size and resolution of the original object image, sending the zoom adjustment amount and a zoom adjustment instruction to the camera device to adjust the zoom of the lens;
[0017] S205: Based on the real-time image feedback model, check whether the image of the original object after focus and zoom adjustment meets the clarity and resolution requirements. If it does not meet the requirements, repeat S203 and S204 until the requirements are met.
[0018] In a preferred embodiment, the step of performing boundary recognition on the original object image and outputting the boundary coordinates of the original object image based on the preset instance segmentation AI model includes the following steps:
[0019] S301: Based on the preset instance segmentation AI model, a rectangular bounding box is selected for the original object image to identify and locate the boundary corner points;
[0020] S302: Optimize the selected boundary corner points and output boundary coordinates, wherein the optimization includes smoothing the corner points, removing outliers, and refining the corner point positions.
[0021] In a preferred embodiment, the step of outputting the coordinates of the boundary corner points of the final object image based on the perspective transformation matrix, the boundary coordinates of the original object image, and the minimum bounding rectangle method comprises the following steps:
[0022] S401: Based on the boundary coordinates of the original object image and the minimum bounding rectangle method, locate the minimum bounding rectangle with the boundary coordinates of the original object image as the boundary, and output the parameters of the minimum bounding rectangle, including the horizontal field of view angle ,width ,high and magnification ;
[0023] S402: Based on 、 、 、 and preset formulas , calculate the virtual pixel distance ;
[0024] S403: Preset the camera device as the origin , the coordinates of each corner point of the minimum bounding rectangle are expressed as ;
[0025] S404: When , the coordinates of the first corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the first corner point of the minimum circumscribed rectangle;
[0026] S405: When , the coordinates of the second corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the second corner point of the minimum circumscribed rectangle;
[0027] S406: When , the coordinates of the third triangle of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle of the minimum circumscribed rectangle;
[0028] S407: When , the coordinates of the fourth corner of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum bounding rectangle.
[0029] In a preferred embodiment, the step of outputting the coordinates of the boundary corner points of the final item image based on the perspective transformation matrix, the boundary coordinates of the original item image, and the minimum bounding rectangle method further includes the steps of:
[0030] S408: The coordinates of each corner point of the minimum circumscribed rectangle are Convert to homogeneous coordinates corner point ;
[0031] S409: Based on the preset formula and the perspective transformation matrix , transform each homogeneous coordinate corner point to obtain the transformed coordinates ;
[0032] S410: Based on preset formula , , for the transformed coordinates Normalize to get the two-dimensional image coordinates ;
[0033] S411: Repeat steps S408-S410 to obtain the two-dimensional image coordinates of all four corner points, and output the two-dimensional image coordinates as the boundary corner coordinates of the final object image.
[0034] The second objective of this application is achieved through the following technical solutions:
[0035] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the perspective transformation image acquisition method based on a binocular data acquisition device are implemented.
[0036] The third objective of this application is achieved through the following technical solutions:
[0037] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned perspective transformation image acquisition method based on a binocular data acquisition device.
[0038] In summary, this application includes at least one of the following beneficial technical effects:
[0039] 1. First, it involves responding to and processing image acquisition commands issued by the teacher's terminal. Upon receiving a command from the teacher's terminal, the command is parsed to determine the specific area of the student's desktop that needs to be imaged, i.e., the desktop to be identified. Next, the camera is activated and properly aligned with the desktop to be identified. Finally, the original object image is extracted from the image data captured by the camera. This refers to the original, unprocessed image of the desktop to be identified, which contains the object to be identified in subsequent steps. This automated process ensures accurate and efficient image acquisition, laying the foundation for subsequent image analysis and object identification. Next, coordinate transformation processing is performed on the image captured by the camera to map the object's position in the image from the camera's two-dimensional coordinate system to the three-dimensional coordinate system of the real world. This process first calculates a perspective transformation matrix based on the camera's parameters. This matrix transforms the original object image in the camera's coordinate system into the final object image in the preset coordinate system, thereby accurately describing the object's position and orientation in the real world. At the same time, the inverse of the perspective transformation matrix is calculated. This allows for reverse conversion from the preset coordinate system to the camera coordinate system. This is necessary in some cases, such as when mapping real-world coordinates back to the image plane. Furthermore, to ensure image clarity, the camera's focus and zoom are adjusted as needed to optimize image quality and provide more accurate data for subsequent image analysis and recognition. The original item image is then processed using a preset instance segmentation AI model to identify the boundaries of each item in the image. This advanced image processing technology can distinguish between different objects in an image and accurately define the boundaries of each object. In this step, the model analyzes the original item image, identifies the outline of each item, and outputs the boundary coordinates of these outlines. These coordinates are the precise location points of the object's boundaries in the image, defining the shape and position of each item in the image. This method accurately separates different items from the image, laying the foundation for further image analysis and object recognition. The perspective transformation matrix and the boundary coordinates of the original item image are then used to calculate the coordinates of the four boundary corner points of the final item image. In this step, the minimum enclosing rectangle method is applied to determine the smallest rectangle that completely encloses the object in the image and calculate the coordinates of the four corner points of this rectangle. A perspective transformation matrix is used during this process to convert the boundary coordinates of the original object image from the camera coordinate system to the preset coordinate system, ensuring coordinate accuracy. Ultimately, the output is the coordinates of the four boundary corner points of the final object image, after perspective transformation and correction. The final corrected object image is then output using the preset perspective transformation processing model and the previously calculated coordinates of the four boundary corner points of the final object image.In this step, the perspective transformation processing model performs a perspective transformation based on the coordinates of the four boundary corner points. This is an image processing technique used to correct for perspective distortion in an image, making it appear as if viewed from the front. This transformation remaps the object in the image to eliminate the perspective effect caused by the camera's position and angle, resulting in a perspective-corrected image. This corrected final object image is more suitable for subsequent analysis and processing because it provides a unified and standardized perspective, helping to improve image recognition accuracy and efficiency. Finally, the perspective-corrected final object image undergoes further image optimization. This step involves a series of image enhancement and improvement techniques, such as enhancing contrast, reducing noise, adjusting brightness and color, and possibly sharpening. These operations aim to improve the overall visual quality of the image, making object details clearer and colors more realistic, thus preparing it for subsequent analysis or presentation. After completing these optimization steps, the system will output the final optimized object image, which is an improved image that will be more suitable for machine learning model training, object detection, feature extraction, or any application scenario that requires high-quality image input. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a flowchart of an implementation of an embodiment of a perspective transformation image acquisition method based on a binocular data acquisition device of the present application;
[0041] Figure 2 This is a first implementation flowchart of S20 in an embodiment of a perspective transformation image acquisition method based on a binocular data acquisition device of the present application;
[0042] Figure 3 This is a second implementation flowchart of S20 in an embodiment of a perspective transformation image acquisition method based on a binocular data acquisition device of the present application;
[0043] Figure 4 This is a flowchart of an implementation of S30 in an embodiment of a perspective transformation image acquisition method based on a binocular data acquisition device of the present application;
[0044] Figure 5 This is a first implementation flow chart of S40 in an embodiment of a perspective transformation image acquisition method based on a binocular data acquisition device of the present application;
[0045] Figure 6 This is a second implementation flow chart of S40 in an embodiment of a perspective transformation image acquisition method based on a binocular data acquisition device of the present application;
[0046] Figure 7 This is a principle block diagram of a computer device of the present application. DETAILED DESCRIPTION
[0047] The following is combined with Figure 1-7 This application is described in further detail.
[0048] In one embodiment, if Figure 1 As shown, the present application discloses a perspective transformation image acquisition method based on a binocular data acquisition device, which specifically includes the following:
[0049] S10: When an image acquisition instruction is received from the teacher terminal, the original image of the object to be identified on the desktop is extracted from the image acquisition instruction;
[0050] In this embodiment, the teacher terminal refers to the device used by the teacher, such as a computer, tablet computer or other control device, for sending instructions; the image acquisition instruction refers to the command issued by the teacher terminal, which contains a series of parameters and is used to capture the image of a specific desktop; the desktop to be identified refers to the desktop area of the target student that needs to perform image recognition; the original object image refers to the original image captured from the desktop to be identified, which contains the object to be identified.
[0051] Specifically, step S10 involves responding to and processing image acquisition instructions issued by the teacher terminal. When a command is received from the teacher terminal, the command is first parsed to determine the specific student desktop area that needs to capture the image, that is, the desktop to be identified. Next, the camera device is activated and ensured to be correctly aligned with the desktop to be identified. Finally, the original object image is extracted from the image data captured by the camera device. This refers to the original, unprocessed image contained on the desktop to be identified, which contains the object to be identified in the subsequent steps. This process is automated, ensuring the accuracy and efficiency of image acquisition, and laying the foundation for subsequent image analysis and object identification.
[0052] S20: Based on the parameters of the camera device, calculate the perspective transformation matrix and its inverse matrix required to transform the original object image in the camera device coordinate system into the final object image in the preset coordinate system, and adjust the focus and zoom of the camera device;
[0053] In this embodiment, the camera device coordinate system refers to the two-dimensional coordinates used by the camera device to define the position of objects in the image; the preset coordinate system refers to a global three-dimensional coordinate system used to describe the position and direction in the real world; the perspective transformation matrix refers to the matrix used to convert the image from the camera device coordinate system to the preset coordinate system; the inverse matrix refers to the inverse of the perspective transformation matrix, which is used for reverse transformation.
[0054] Specifically, step S20 involves performing coordinate transformation processing on the image captured by the camera device so as to map the position of the object in the image from the two-dimensional coordinate system of the camera device to the three-dimensional coordinate system of the real world. In this process, the perspective transformation matrix is first calculated based on the parameters of the camera device. The function of this matrix is to transform the original object image in the camera device coordinate system to the final object image in the preset coordinate system, thereby achieving an accurate description of the object's position and orientation in the real world. At the same time, the inverse matrix of the perspective transformation matrix is also calculated, which allows reverse conversion from the preset coordinate system to the camera device coordinate system. This is necessary in some cases, such as when the coordinates in the real world need to be mapped back to the image plane. In addition, in order to ensure the clarity of the image, the focus and magnification of the camera device will be adjusted as needed to optimize the image quality and provide more accurate data for subsequent image analysis and recognition.
[0055] S30: Based on the preset instance segmentation AI model, identify the boundaries of the original object image and output the boundary coordinates of the original object image;
[0056] In this embodiment, the instance segmentation AI model is used to identify different objects in the image and draw boundaries for them; the original object image boundary coordinates refer to the coordinates of the boundary points of the original object image identified by the instance segmentation AI model.
[0057] Specifically, step S30 uses a preset instance segmentation AI model to process the original object image in order to identify the boundaries of each object in the image. The instance segmentation AI model is an advanced image processing technology that can distinguish different objects in an image and draw precise boundaries for each object. In this step, the model analyzes the original object image, identifies the outline of each object, and outputs the boundary coordinates of these outlines. These coordinates are the precise location points of the object boundaries in the image, and they define the shape and position of each object in the image. In this way, different objects can be accurately separated from the image, laying the foundation for further image analysis and object identification.
[0058] S40: Outputting the coordinates of the boundary corner points of the final object image based on the perspective transformation matrix, the boundary coordinates of the original object image, and the minimum bounding rectangle method;
[0059] In this embodiment, the minimum bounding rectangle method is used to find the minimum rectangle enclosing the object in the image and determine the coordinates of its corner points; the final object image refers to the object image after perspective transformation and correction processing; the four boundary corner point coordinates refer to the coordinates of the four corner points of the minimum bounding rectangle of the final object image.
[0060] Specifically, step S40 involves using the perspective transformation matrix and the boundary coordinates of the original object image to calculate the coordinates of the four corner points of the final object image. In this step, the minimum bounding rectangle method is applied to determine the smallest rectangle that completely encloses the object in the image and calculate the coordinates of the four corner points of this rectangle. The perspective transformation matrix is used to convert the boundary coordinates of the original object image from the camera coordinate system to the preset coordinate system, ensuring coordinate accuracy. Ultimately, the output is the coordinates of the four corner points of the final object image, after perspective transformation and correction.
[0061] S50: Outputting a corrected final object image based on a preset perspective transformation processing model and the coordinates of the boundary corner points of the final object image;
[0062] In this embodiment, the preset perspective transformation processing model is a model for performing perspective transformation to correct the viewing angle of an image; the corrected final object image refers to an image after perspective transformation processing, and its viewing angle has been corrected.
[0063] Specifically, step S50 utilizes a preset perspective transformation processing model and the previously calculated coordinates of the four boundary corner points of the final object image to output a corrected final object image. In this step, the perspective transformation processing model performs perspective transformation based on the coordinates of the four boundary corner points. This is an image processing technique used to correct perspective distortion in an image so that the image appears to be viewed from the front. Through this transformation, the object in the image is remapped to eliminate the perspective effect caused by the position and angle of the camera device, thereby obtaining an image with a corrected perspective. The corrected final object image is more suitable for subsequent analysis and processing because it provides a unified and standard perspective, which helps to improve the accuracy and efficiency of image recognition.
[0064] S60: performing image optimization processing on the corrected final object image, and outputting the optimized final object image.
[0065] In this embodiment, image optimization processing refers to various improvements performed on the image, such as enhancing contrast, reducing noise, etc., to improve image quality; the final object image after optimization processing refers to the final image after image optimization processing, which is ready for further analysis or display.
[0066] Specifically, step S60 is to further optimize the final object image that has been perspective-corrected. In this step, the image optimization process includes a series of image enhancement and improvement techniques, such as enhancing the contrast of the image, reducing the noise in the image, adjusting the brightness and color of the image, and possible sharpening. The purpose of these operations is to improve the overall visual quality of the image, making the details of the objects in the image clearer and the colors more realistic, thereby preparing for subsequent analysis or presentation. After completing these optimization steps, the system will output the optimized final object image, which is an image with improved quality. It will be more suitable for machine learning model training, target detection, feature extraction, or any application scenario that requires high-quality image input.
[0067] Figure 2 , step S20, comprising the steps of:
[0068] S201: Outputting parameters of the camera device, the parameters including built-in parameters and external parameters. The built-in parameters include focal length and built-in parameter matrix, and the external parameters include the position, rotation matrix and translation vector of the camera device in a preset coordinate system;
[0069] S202: Based on the parameters of the camera device and the preset formula , calculate the perspective transformation matrix , represents the built-in parameter matrix of the camera device, represents the rotation matrix, Represents the translation vector.
[0070] In this embodiment, in step S201, the parameters of the camera device are output. These parameters are crucial for correctly understanding and converting the images captured by the camera device. The parameters are divided into two parts: built-in parameters and external parameters: the built-in parameters mainly include the focal length of the camera device and the built-in parameter matrix; the external parameters describe the position of the camera device in the preset coordinate system, including the rotation matrix and the translation vector, which define the orientation and position of the camera device relative to the preset coordinate system. Then, in step S202, these parameters are used to establish the perspective transformation matrix, which is a key matrix that can transform the image from the coordinate system of the camera device to the preset coordinate system. Perspective transformation matrix The calculation is based on a preset formula , which contains the built-in parameter matrix of the camera device , rotation matrix and translation vectors ,These elements work together to ensure that the image can be correctly mapped and rectified in 3D space.
[0071] Figure 3 , step S20 further includes the steps of:
[0072] S203: Calculating a focus adjustment amount based on the depth and focal length of the original object image, sending the focus adjustment amount and a focus adjustment instruction to the camera device to adjust the focus of the lens;
[0073] S204: Calculating a zoom adjustment amount based on the size and resolution of the original object image, sending the zoom adjustment amount and a zoom adjustment instruction to the camera device to adjust the zoom of the lens;
[0074] S205: Based on the real-time image feedback model, check whether the image of the original object after focus and zoom adjustment meets the clarity and resolution requirements. If it does not meet the requirements, repeat S203 and S204 until the requirements are met.
[0075] In this embodiment, in step S203, a focus adjustment is calculated based on the depth of the original object image and the focal length of the camera. This ensures that the object in the image is in sharp focus. Once calculated, the focus adjustment and corresponding adjustment instructions are sent to the camera to adjust the lens's focus for a clearer image. Next, in step S204, a zoom adjustment is calculated based on the size and resolution of the original object image. This adjusts the displayed size of the object in the image to ensure that details are visible. The calculated zoom adjustment and instructions are then sent to the camera to adjust the zoom settings of the lens. Finally, in step S205, a real-time image feedback model is used to check whether the original object image, after focus and zoom adjustments, meets preset clarity and resolution requirements. If the image quality does not meet the requirements, steps S203 and S204 are repeated for further adjustments until the image quality reaches the expected standard.
[0076] Figure 4 , step S30, comprising the steps of:
[0077] S301: Based on the preset instance segmentation AI model, a rectangular bounding box is selected for the original object image to identify and locate the boundary corner points;
[0078] S302: Optimize the selected boundary corner points and output boundary coordinates, wherein the optimization includes smoothing the corner points, removing outliers, and refining the corner point positions.
[0079] In this embodiment, in step S301, a preset instance segmentation AI model is used to process the original object image, with the aim of selecting a rectangular bounding box that can accurately surround the object in the image. This model can identify the position of the object and accurately locate the boundary corners, that is, the four corners of the rectangular bounding box. This step is the key to object recognition and positioning in the image, which ensures that subsequent processing can be performed on the correct area. Next, in step S302, the boundary corners identified by the AI model are further optimized. This may include operations such as smoothing corners, removing outliers, or refining corner position to improve the accuracy of the bounding box and the final effect of image processing. After the optimization is completed, the processed boundary coordinates are output, which will be used for subsequent tasks such as image analysis or object tracking.
[0080] Figure 5 , step S40, comprising the steps of:
[0081] S401: Based on the boundary coordinates of the original object image and the minimum bounding rectangle method, locate the minimum bounding rectangle with the boundary coordinates of the original object image as the boundary, and output the parameters of the minimum bounding rectangle, including the horizontal field of view angle ,width ,high and magnification ;
[0082] S402: Based on 、 、 、 and preset formulas , calculate the virtual pixel distance ;
[0083] S403: Preset the camera device as the origin , the coordinates of each corner point of the minimum bounding rectangle are expressed as ;
[0084] S404: When , the coordinates of the first corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the first corner point of the minimum circumscribed rectangle;
[0085] S405: When , the coordinates of the second corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the second corner point of the minimum circumscribed rectangle;
[0086] S406: When , the coordinates of the third triangle of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle of the minimum circumscribed rectangle;
[0087] S407: When , the coordinates of the fourth corner of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum bounding rectangle.
[0088] In this embodiment, in step S401, the minimum bounding rectangle of the object in the image is determined using the boundary coordinates of the original object image and the minimum bounding rectangle method. This rectangle completely surrounds the object in the image and has the smallest area. The parameters of this minimum bounding rectangle are output, including the horizontal field of view angle. ,width ,high and magnification In step S402, based on 、 、 、 and preset formulas Calculate virtual pixel distance This may be to convert the actual physical size into the pixel size in the image. Then, in step S403, the camera device is preset to the origin The coordinates of each corner point of the minimum bounding rectangle are expressed as their position relative to the camera. In steps S404 through S407, calculations are performed for the coordinates of each of the four corner points of the minimum bounding rectangle. For each corner point, its specific position in the camera coordinate system is calculated based on a preset formula. These calculations ensure the accuracy of the corner point coordinates, providing important geometric information for subsequent image analysis and processing.
[0089] Figure 6 , step S40 further includes the steps of:
[0090] S408: The coordinates of each corner point of the minimum circumscribed rectangle are Convert to homogeneous coordinates corner point ;
[0091] S409: Based on the preset formula and the perspective transformation matrix , transform each homogeneous coordinate corner point to obtain the transformed coordinates ;
[0092] S410: Based on preset formula , , for the transformed coordinates Normalize to get the two-dimensional image coordinates ;
[0093] S411: Repeat steps S408-S410 to obtain the two-dimensional image coordinates of all four corner points, and output the two-dimensional image coordinates as the boundary corner coordinates of the final object image.
[0094] In this embodiment, in step S408, the coordinates of each corner point of the minimum bounding rectangle are first converted to homogeneous coordinates. Homogeneous coordinates simplify matrix operations, especially perspective transformation calculations, by adding an extra dimension. In step S409, the preset formula is used. and the perspective transformation matrix Transform each homogeneous coordinate corner point to obtain the transformed coordinates This transformation process simulates the projection from three-dimensional space to two-dimensional image plane, which is a key step in image correction and perspective transformation. Then, in step S410, based on the preset formula , The transformed coordinates Normalization is performed to ensure that the coordinate values are compatible with the 2D image coordinate system. This means that the converted coordinates correctly represent the position on the image plane. Finally, in step S411, steps S408 to S409 are repeated to obtain the 2D image coordinates of all four corner points. These coordinates are then output as the boundary corner coordinates of the final object image. This accurately defines the boundaries of the final object image on the 2D image plane, providing precise positioning information for further image processing and analysis.
[0095] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0096] In one embodiment, a perspective transformation image acquisition system based on a binocular data acquisition device is provided. The perspective transformation image acquisition system based on a binocular data acquisition device corresponds to the perspective transformation image acquisition method based on a binocular data acquisition device in the above embodiment. The perspective transformation image acquisition system based on a binocular data acquisition device includes:
[0097] Image acquisition instruction module: S10: when receiving the image acquisition instruction sent by the teacher terminal, extract the original object image of the desktop to be identified from the image acquisition instruction;
[0098] Calculate perspective transformation matrix module: S20: Based on the parameters of the camera device, calculate the perspective transformation matrix and its inverse matrix required to transform the original object image in the camera device coordinate system into the final object image in the preset coordinate system, and adjust the focus and zoom of the camera device;
[0099] Boundary recognition module: S30: Based on the preset instance segmentation AI model, the boundary of the original object image is recognized and the boundary coordinates of the original object image are output;
[0100] Boundary corner coordinate module: S40: Based on the perspective transformation matrix, the boundary coordinates of the original object image and the minimum bounding rectangle method, output the boundary corner coordinates of the final object image;
[0101] Final object image module: S50: outputting a corrected final object image based on a preset perspective transformation processing model and the coordinates of the boundary corner points of the final object image;
[0102] Image optimization processing module: S60: performing image optimization processing on the corrected final object image and outputting the optimized final object image.
[0103] Optionally, also include
[0104] Output parameter module: S201: Output the parameters of the camera device, which include built-in parameters and external parameters. The built-in parameters include focal length and built-in parameter matrix, and the external parameters include the position, rotation matrix and translation vector of the camera device in a preset coordinate system;
[0105] Establish perspective transformation matrix module: S202: Based on the parameters of the camera device and the preset formula , calculate the perspective transformation matrix , represents the built-in parameter matrix of the camera device, represents the rotation matrix, Represents the translation vector.
[0106] Optionally, also include
[0107] Focus adjustment module: S203: Based on the depth and focal length of the original object image, calculate the focus adjustment amount, send the focus adjustment amount and focus adjustment instruction to the camera device, and adjust the focus of the lens;
[0108] Adjusting the lens zoom module: S204: Calculating the zoom adjustment amount based on the size and resolution of the original object image, sending the zoom adjustment amount and the zoom adjustment instruction to the camera device to adjust the zoom of the lens;
[0109] Meeting requirements module: S205: Based on the real-time image feedback model, check whether the original object image after focus and zoom adjustment meets the clarity and resolution requirements. If it does not meet the requirements, repeat S203 and S204 until the requirements are met.
[0110] Optionally, also include
[0111] Select rectangular bounding box module: S301: Based on the preset instance segmentation AI model, select a rectangular bounding box for the original object image and identify and locate the boundary corner points;
[0112] Output boundary coordinate module: S302: Optimize the selected boundary corner points and output boundary coordinates, wherein the optimization includes smoothing the corner points, removing outliers, and refining the corner point positions.
[0113] Optionally, also include
[0114] Output minimum bounding rectangle parameter module: S401: Based on the original object image boundary coordinates and the minimum bounding rectangle method, locate the minimum bounding rectangle with the original object image boundary coordinates as the boundary, and output the parameters of the minimum bounding rectangle, including the horizontal field of view angle ,width ,high and magnification ;
[0115] Calculate virtual pixel distance module: S402: based on 、 、 、 and preset formulas , calculate the virtual pixel distance ;
[0116] Corner coordinate representation module: S403: preset the camera device as the origin , the coordinates of each corner point of the minimum bounding rectangle are expressed as ;
[0117] First corner point coordinate module: S404: When , the coordinates of the first corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the first corner point of the minimum circumscribed rectangle;
[0118] Second corner point coordinate module: S405: When , the coordinates of the second corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the second corner point of the minimum circumscribed rectangle;
[0119] The third corner point coordinate module: S406: When , the coordinates of the third triangle of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle of the minimum circumscribed rectangle;
[0120] The fourth corner point coordinate module: S407: When , the coordinates of the fourth corner of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum bounding rectangle.
[0121] Optionally, also include
[0122] Conversion module: S408: The coordinates of each corner point of the minimum bounding rectangle Convert to homogeneous coordinates corner point ;
[0123] Transformation coordinate module: S409: Based on preset formula and the perspective transformation matrix , transform each homogeneous coordinate corner point to obtain the transformed coordinates ;
[0124] 2D image coordinate module: S410: based on preset formula , , for the transformed coordinates Normalize to get the two-dimensional image coordinates ;
[0125] Repeat step module: S411: Repeat steps S408-S410 to obtain the two-dimensional image coordinates of all four corner points, and output the two-dimensional image coordinates as the boundary corner coordinates of the final object image.
[0126] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store corner point coordinates. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a perspective transformation image acquisition method based on a binocular data acquisition device is implemented.
[0127] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, a perspective transformation image acquisition method based on a binocular data acquisition device is implemented.
[0128] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, a perspective transformation image acquisition method based on a binocular data acquisition device is implemented.
[0129] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0130] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
Claims
1. A perspective transformation image acquisition method based on a binocular data acquisition device, characterized in that: Including steps: S10: When an image acquisition instruction is received from the teacher terminal, an original image of the object on the desktop to be identified is extracted based on the image acquisition instruction; S20: Based on the parameters of the camera device, calculate the perspective transformation matrix and its inverse matrix required to transform the original object image in the camera device coordinate system into the final object image in the preset coordinate system, and adjust the focus and zoom of the camera device; S30: Based on the preset instance segmentation AI model, identify the boundaries of the original object image and output the boundary coordinates of the original object image; S40: Outputting the coordinates of the boundary corner points of the final object image based on the perspective transformation matrix, the boundary coordinates of the original object image, and the minimum bounding rectangle method; S401: Based on the boundary coordinates of the original object image and the minimum bounding rectangle method, locate the minimum bounding rectangle with the boundary coordinates of the original object image as the boundary, and output the parameters of the minimum bounding rectangle, including the horizontal field of view angle ,width ,high and magnification ; S402: Based on 、 、 、 and preset formulas , calculate the virtual pixel distance ; S403: Preset the camera device as the origin , the coordinates of each corner point of the minimum bounding rectangle are expressed as ; S404: When , the coordinates of the first corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the first corner point of the minimum circumscribed rectangle; S405: When , the coordinates of the second corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the second corner point of the minimum circumscribed rectangle; S406: When , the coordinates of the third triangle of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle of the minimum circumscribed rectangle; S407: When , the coordinates of the fourth corner of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum circumscribed rectangle; S408: The coordinates of each corner point of the minimum circumscribed rectangle are Convert to homogeneous coordinates corner point ; S409: Based on the preset formula and the perspective transformation matrix , transform each homogeneous coordinate corner point to obtain the transformed coordinates ; S410: Based on preset formula , , for the transformed coordinates Normalize to get the two-dimensional image coordinates ; S411: Repeat steps S408-S410 to obtain the two-dimensional image coordinates of all four corner points, and output the two-dimensional image coordinates as the boundary corner coordinates of the final object image; S50: Outputting a corrected final object image based on a preset perspective transformation processing model and the coordinates of the boundary corner points of the final object image; S60: performing image optimization processing on the corrected final object image, and outputting the optimized final object image.
2. The perspective transformation image acquisition method based on binocular data acquisition equipment according to claim 1, characterized in that: The step of calculating the perspective transformation matrix and its inverse matrix required to transform the original object image in the coordinate system of the camera device into the final object image in the preset coordinate system based on the parameters of the camera device, and adjusting the focus and zoom of the camera device, comprises the following steps: S201: Outputting parameters of the camera device, the parameters including built-in parameters and external parameters. The built-in parameters include focal length and built-in parameter matrix, and the external parameters include the position, rotation matrix and translation vector of the camera device in a preset coordinate system; S202: Based on the parameters of the camera device and the preset formula , calculate the perspective transformation matrix , represents the built-in parameter matrix of the camera device, represents the rotation matrix, Represents the translation vector.
3. The perspective transformation image acquisition method based on binocular data acquisition equipment according to claim 1, characterized in that: The step of calculating the perspective transformation matrix and its inverse matrix required to transform the original object image in the coordinate system of the camera device into the final object image in the preset coordinate system based on the parameters of the camera device, and adjusting the focus and zoom of the camera device, further includes the steps of: S203: Calculating a focus adjustment amount based on the depth and focal length of the original object image, sending the focus adjustment amount and a focus adjustment instruction to the camera device to adjust the focus of the lens; S204: Calculating a zoom adjustment amount based on the size and resolution of the original object image, sending the zoom adjustment amount and a zoom adjustment instruction to the camera device to adjust the zoom of the lens; S205: Based on the real-time image feedback model, check whether the image of the original object after focus and zoom adjustment meets the clarity and resolution requirements. If it does not meet the requirements, repeat S203 and S204 until the requirements are met.
4. The perspective transformation image acquisition method based on binocular data acquisition equipment according to claim 1, characterized in that: The step of performing boundary recognition on the original object image and outputting the boundary coordinates of the original object image based on the preset instance segmentation AI model includes the following steps: S301: Based on the preset instance segmentation AI model, a rectangular bounding box is selected for the original object image to identify and locate the boundary corner points; S302: Optimize the selected boundary corner points and output boundary coordinates, wherein the optimization includes smoothing the corner points, removing outliers, and refining the corner point positions.
5. A perspective transformation image acquisition system based on binocular data acquisition equipment, characterized in that: include: Image acquisition instruction module: when receiving the image acquisition instruction from the teacher terminal, extract the original image of the object to be identified on the desktop based on the image acquisition instruction; Perspective transformation matrix calculation module: Based on the parameters of the camera device, it calculates the perspective transformation matrix and its inverse matrix required to transform the original object image in the camera device coordinate system into the final object image in the preset coordinate system, and adjusts the focus and zoom of the camera device; Boundary recognition module: Based on the preset instance segmentation AI model, it recognizes the boundaries of the original object image and outputs the boundary coordinates of the original object image; Boundary corner coordinate module: outputs the boundary corner coordinates of the final item image based on the perspective transformation matrix, the boundary coordinates of the original item image and the minimum bounding rectangle method; Output minimum bounding rectangle parameter module: Based on the original object image boundary coordinates and the minimum bounding rectangle method, locate the minimum bounding rectangle with the original object image boundary coordinates as the boundary, and output the parameters of the minimum bounding rectangle, including the horizontal field of view angle ,width ,high and magnification ; Calculate virtual pixel distance module: based on 、 、 、 and preset formulas , calculate the virtual pixel distance ; Corner coordinate representation module: preset camera device as origin , the coordinates of each corner point of the minimum bounding rectangle are expressed as ; First corner coordinate module: , the coordinates of the first corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the first corner point of the minimum circumscribed rectangle; The second corner point coordinate module: , the coordinates of the second corner point of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the second corner point of the minimum circumscribed rectangle; The third corner coordinate module: , the coordinates of the third triangle of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle of the minimum circumscribed rectangle; The fourth corner coordinate module: , the coordinates of the fourth corner of the minimum bounding rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum circumscribed rectangle; Conversion module: Convert the coordinates of each corner point of the minimum enclosing rectangle Convert to homogeneous coordinates corner point ; Transformation coordinate module: based on preset formula and the perspective transformation matrix , transform each homogeneous coordinate corner point to obtain the transformed coordinates ; 2D image coordinate module: based on preset formula , , for the transformed coordinates Normalize to get the two-dimensional image coordinates ; Repeat step module: repeatedly obtain the 2D image coordinates of all four corner points through the conversion module, coordinate transformation module and 2D image coordinate module, and output the 2D image coordinates as the boundary corner coordinates of the final object image; Final object image module: outputs a corrected final object image based on a preset perspective transformation processing model and the coordinates of the boundary corner points of the final object image; Image optimization processing module: performs image optimization processing on the corrected final object image and outputs the optimized final object image.
6. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the perspective transformation image acquisition method based on a binocular data acquisition device as described in any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the perspective transformation image acquisition method based on a binocular data acquisition device as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Fast snapshot method, device and system
CN109922251A
Image perspective correction method and device based on camera view angle transformation
CN115115550A
Projection image correction method and device, equipment and storage medium
CN117998065A