Perspective transformation image acquisition method and system based on binocular data acquisition equipment
Through the perspective-transformed image acquisition method based on the binocular data acquisition device, the problem of difficulty in eliminating perspective distortion and lens distortion in image correction of monocular cameras is solved, accurate image correction and optimization are achieved, and recognition efficiency and image quality are improved.
Patent Information
- Application Number
- CN202411676188.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-11-22
AI Technical Summary
It is difficult for a monocular camera to accurately eliminate perspective distortion and lens distortion during image correction, resulting in the collected images that may be distorted, and it is difficult to accurately restore the actual size and shape of the item.
Using the perspective transform image acquisition method based on binocular data acquisition device, by calculating the perspective transform matrix and inverse matrix, the original object image in the camera device coordinate system is converted to the preset coordinate system, the focus and zoom are adjusted, and the AI is divided by combining instances. Model and minimum external rectangle method, output the corrected final item image.
The perspective transformation correction of the image is realized, eliminating the perspective effect caused by the position and angle of the camera device, providing a unified and standard perspective angle, improving the accuracy and efficiency of image recognition, and improving image quality through image optimization processing.
Smart Images

Figure CN119183025A_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] In the classroom, when using a monocular camera to capture images of objects on students' desks, the main shortcomings in image correction are: due to the lack of stereo vision, it is difficult for a monocular camera to accurately eliminate perspective distortion and lens distortion during the image correction process. This means that the captured image may be distorted, especially in the edge area, making it difficult to accurately restore the actual size and shape of the object. Therefore, improvement is 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 steps of: S10: when receiving an image acquisition instruction sent by the teacher terminal, extracting the original object image of the desktop to be identified from 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, the boundary of the original object image is identified and the boundary coordinates of the original object image are output; S40: Based on the perspective transformation matrix, the boundary coordinates of the original object image and the minimum circumscribed rectangle method, outputting 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 boundary corner coordinates of the final object image; S60: performing image optimization processing on the corrected final object image, and outputting the optimized final object image.
[0005] 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 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 steps of: S201: Outputting parameters of the camera device, the parameters including built-in parameters and external parameters, the built-in parameters including focal length and built-in parameter matrix, and the external parameters including 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.
[0006] 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 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: Calculate the focal length adjustment amount based on the depth and focal length of the original object image, send the focal length adjustment amount and focal length adjustment instruction to the camera device, and adjust the focal length of the lens; S204: Calculate the zoom adjustment amount based on the size and image resolution of the original object image, send the zoom adjustment amount and the zoom adjustment instruction to the camera device, and adjust the zoom of the lens; 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.
[0007] 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 comprises the steps of: 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.
[0008] 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 circumscribed rectangle method comprises the steps of: 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, the parameters include the horizontal field of view angle ,width ,high And magnification ; S402: Based on , , , and preset formula , calculate the virtual pixel distance ; S403: Preset the camera device as the origin , the coordinates of each corner point of the minimum enclosing rectangle are expressed as ; S404: When , the coordinates of the first corner point of the minimum enclosing 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 enclosing 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 point of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle point of the minimum circumscribed rectangle; S407: When , the coordinates of the fourth corner point of the minimum enclosing rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum circumscribed rectangle.
[0009] 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 further includes the steps of: S408: The coordinates of each corner point of the minimum circumscribed rectangle are Convert to homogeneous coordinates ; S409: Based on 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 point coordinates of the final object image.
[0010] The above-mentioned second objective of the present application is achieved through the following technical solutions: A computer device comprises 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.
[0011] The third objective of the present application is achieved through the following technical solutions: A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the perspective transformation image acquisition method based on a binocular data acquisition device are implemented.
[0012] In summary, the present application includes at least one of the following beneficial technical effects: 1. First, it involves responding to and processing the image acquisition instructions issued by the teacher terminal. When receiving the instruction from the teacher terminal, the instruction 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, which refers to the unprocessed original 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. Then, it involves coordinate transformation processing of the image captured by the camera device so as to map the object position 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 coordinate system of the camera device to the final object image in the preset coordinate system, thereby realizing the description of the accurate position and direction of the object in the real world. At the same time, the inverse matrix of the perspective transformation matrix is also calculated, which allows the reverse conversion from the preset coordinate system to the camera coordinate system, which 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 zoom of the camera are adjusted as needed to optimize the image quality and provide more accurate data for subsequent image analysis and recognition. Then, the original object image is processed using the preset instance segmentation AI model, with the goal of identifying 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 the 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 recognition. Then, it involves using the perspective transformation matrix and the boundary coordinates of the original object image to calculate the coordinates of the four boundary corners of the final object image. In this step, the minimum enclosing rectangle method is applied to determine the minimum rectangle that can completely enclose the object in the image and calculate the coordinates of the four corner points of the rectangle. The perspective transformation matrix is used in this process to convert the boundary coordinates of the original object image from the camera coordinate system to the preset coordinate system to ensure the accuracy of the coordinates. Finally, the output is the coordinates of the four boundary corner points of the final object image after perspective transformation and correction. Then, the preset perspective transformation processing model and the four boundary corner coordinates of the final object image calculated previously are used to output the corrected final object image.In this step, the perspective transformation processing model performs perspective transformation according to the coordinates of the four boundary corner points. This is an image processing technique used to correct the perspective distortion in the image so that the image presents a perspective from the front. Through this transformation, the objects in the image are remapped to eliminate the perspective effect caused by the position and angle of the camera device, thereby obtaining an image with 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. Finally, the final object image that has been perspective-corrected is further optimized. In this step, the image optimization processing 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 processing. 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, so as to prepare for subsequent analysis or presentation. After completing these optimization steps, the system will output the optimized final 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
[0013] Figure 1 This is a flowchart of an implementation of a perspective transformation image acquisition method based on a binocular data acquisition device according to the present application; Figure 2 This is a first implementation flow chart of S20 in an embodiment of a perspective transformation image acquisition method based on a binocular data acquisition device of the present application; Figure 3 This is a second implementation flow chart of S20 in an embodiment of a perspective transformation image acquisition method based on a binocular data acquisition device of the present application; 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; 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; 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; Figure 7 This is a principle block diagram of a computer device of the present application. DETAILED DESCRIPTION
[0014] The following is combined with Figure 1-7 This application is described in further detail.
[0015] 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: S10: when receiving an image acquisition instruction sent by the teacher terminal, extracting the original object image of the desktop to be identified from the image acquisition instruction; In this embodiment, the teacher terminal refers to a device used by the teacher, such as a computer, tablet computer or other control device, for sending instructions; the image acquisition instruction refers to a command issued by the teacher terminal, which includes a series of parameters and is used to capture an 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.
[0016] Specifically, step S10 involves responding to and processing an image acquisition instruction issued by the teacher terminal. When an instruction is received from the teacher terminal, the instruction is first parsed to determine the specific student desktop area where the image needs to be captured, that is, the desktop to be identified. Next, the camera device is activated and ensured to be correctly aimed at the desktop to be identified. Finally, the original object image is extracted from the image data captured by the camera device, which 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.
[0017] 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; 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 system 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.
[0018] Specifically, step S20 involves coordinate transformation processing of 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, so as to achieve the description of the accurate position and direction of the object in the real world. At the same time, the inverse matrix of the perspective transformation matrix is also calculated, which allows the reverse transformation from the preset coordinate system to the camera device coordinate system, which 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.
[0019] S30: Based on the preset instance segmentation AI model, the boundary of the original object image is identified and the boundary coordinates of the original object image are output; 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.
[0020] 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 boundaries of the objects 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.
[0021] S40: Based on the perspective transformation matrix, the boundary coordinates of the original object image and the minimum circumscribed rectangle method, outputting the boundary corner coordinates of the final object image; In this embodiment, the minimum circumscribed 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 coordinates of the four boundary corner points refer to the coordinates of the four corner points of the minimum circumscribed rectangle of the final object image.
[0022] 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 boundary corner points of the final object image. In this step, the minimum enclosing rectangle method is applied to determine the minimum rectangle that can completely surround the object in the image and calculate the coordinates of the four corner points of the rectangle. The perspective transformation matrix is used in this process to convert the boundary coordinates of the original object image from the camera device coordinate system to the preset coordinate system to ensure the accuracy of the coordinates. Finally, the output is the coordinates of the four boundary corner points of the final object image after perspective transformation and correction processing.
[0023] S50: outputting a corrected final object image based on a preset perspective transformation processing model and the boundary corner coordinates of the final object image; In this embodiment, the preset perspective transformation processing model is a model for executing perspective transformation to correct the viewing angle of an image; the corrected final object image refers to an image processed by perspective transformation, and its viewing angle has been corrected.
[0024] Specifically, step S50 uses a preset perspective transformation processing model and the four boundary corner coordinates of the final object image calculated previously to output the corrected final object image. In this step, the perspective transformation processing model performs perspective transformation according to the four boundary corner coordinates, which is an image processing technology used to correct the perspective distortion in the image so that the image presents a perspective 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.
[0025] S60: performing image optimization processing on the corrected final object image, and outputting the optimized final object image.
[0026] In this embodiment, image optimization processing refers to various improvement processing 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.
[0027] 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, so as to prepare for subsequent analysis or display. After completing these optimization steps, the system will output the optimized final object image, which is a quality-enhanced image that will be more suitable for machine learning model training, target detection, feature extraction, or any application scenario that requires high-quality image input.
[0028] Figure 2 , step S20, comprising the steps of: S201: Outputting parameters of the camera device, the parameters including built-in parameters and external parameters, the built-in parameters including focal length and built-in parameter matrix, and the external parameters including 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.
[0029] In this embodiment, in step S201, the parameters of the camera device are output, and 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 a 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 vector ,These elements work together to ensure that the image can be correctly mapped and rectified in 3D space.
[0030] Figure 3 , step S20 further includes the steps of: S203: Calculate the focal length adjustment amount based on the depth and focal length of the original object image, send the focal length adjustment amount and focal length adjustment instruction to the camera device, and adjust the focal length of the lens; S204: Calculate the zoom adjustment amount based on the size and image resolution of the original object image, send the zoom adjustment amount and the zoom adjustment instruction to the camera device, and adjust the zoom of the lens; 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.
[0031] In this embodiment, in step S203, the focus adjustment amount is calculated based on the depth of the original object image and the focal length of the camera device. This is to ensure that the object in the image can be clearly focused. After the calculation is completed, the focus adjustment amount and the corresponding adjustment instruction are sent to the camera device to adjust the focal length of the lens to make the image clearer. Next, in step S204, the zoom adjustment amount is calculated based on the size of the original object image and the image resolution. This is to adjust the display size of the object in the image to ensure that the details are visible. The calculated zoom adjustment amount and instruction are then sent to the camera device to adjust the zoom setting of the lens. Finally, in step S205, the real-time image feedback model is used to check whether the original object image after focus and zoom adjustment meets the preset clarity and resolution requirements. If the image quality does not meet the requirements, steps S203 and S204 will be repeated for further adjustments until the image quality reaches the expected standard.
[0032] Figure 4 , step S30, comprising the steps of: 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.
[0033] In this embodiment, in step S301, a preset instance segmentation AI model is used to process the original object image, with the goal of selecting a rectangular bounding box that can accurately surround the object in the image. This model can identify the location of the object and accurately locate the boundary corners, i.e., 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 point positions 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.
[0034] Figure 5 , step S40, comprising the steps of: 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, the parameters include the horizontal field of view angle ,width ,high And magnification ; S402: Based on , , , and preset formula , calculate the virtual pixel distance ; S403: Preset the camera device as the origin , the coordinates of each corner point of the minimum enclosing rectangle are expressed as ; S404: When , the coordinates of the first corner point of the minimum enclosing 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 enclosing 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 point of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle point of the minimum circumscribed rectangle; S407: When , the coordinates of the fourth corner point of the minimum enclosing rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum circumscribed rectangle.
[0035] 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 formula 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 as the origin. , and the coordinates of each corner point of the minimum circumscribed rectangle are expressed as positions relative to the camera device. In steps S404 to S407, the coordinates of the four corner points of the minimum circumscribed rectangle are calculated respectively. For each corner point, its specific position in the camera device coordinate system is calculated based on a preset formula. These calculations ensure the accuracy of the corner point coordinates and provide important geometric information for subsequent image analysis and processing.
[0036] Figure 6 , step S40 further includes the steps of: S408: The coordinates of each corner point of the minimum circumscribed rectangle are Convert to homogeneous coordinates ; S409: Based on 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 point coordinates of the final object image.
[0037] In this embodiment, in step S408, the coordinates of each corner point of the minimum circumscribed rectangle are first converted to homogeneous coordinate corner points. Homogeneous coordinates simplify matrix operations, especially perspective transformation calculations, by adding an extra dimension. In step S409, the preset formula is used to convert the coordinates of each corner point of the minimum circumscribed rectangle into homogeneous coordinate corner points. 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 suitable for the two-dimensional image coordinate system, that is, the converted coordinates can correctly represent the position on the image plane. Finally, in step S411, steps S408 to S409 are repeated to obtain the two-dimensional image coordinates of all four corner points, and these coordinates are output as the boundary corner coordinates of the final object image. In this way, the boundary of the final object image is accurately defined on the two-dimensional image plane, providing accurate positioning information for further image processing and analysis.
[0038] 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 the present application.
[0039] In one embodiment, a perspective transformation image acquisition system based on a binocular data acquisition device is provided, and 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: Image acquisition instruction module: S10: when receiving an image acquisition instruction sent by the teacher terminal, extract the original object image of the desktop to be identified from the image acquisition instruction; Module for calculating perspective transformation matrix: 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; 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; Boundary corner point coordinate module: S40: Based on the perspective transformation matrix, the boundary coordinates of the original object image and the minimum circumscribed rectangle method, output the boundary corner point coordinates of the final object image; Final object image module: S50: outputting a corrected final object image based on a preset perspective transformation processing model and the boundary corner coordinates of the final object image; Image optimization processing module: S60: Perform image optimization processing on the corrected final object image and output the final object image after optimization processing.
[0040] Optionally, also include Output parameter module: S201: Output the parameters of the camera device, the parameters include built-in parameters and external parameters, the built-in parameters include focal length and built-in parameter matrix, the external parameters include the position of the camera device in a preset coordinate system, rotation matrix and translation vector; Establishing 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.
[0041] Optionally, also include 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 the focus adjustment instruction to the camera device, and adjust the focus of the lens; Adjusting the lens zoom module: S204: Based on the size and image resolution of the original object image, calculating the zoom adjustment amount, sending the zoom adjustment amount and the zoom adjustment instruction to the camera device, and adjusting the zoom of the lens; Requirements meeting 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.
[0042] Optionally, also include Rectangular bounding box selection module: 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; 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.
[0043] Optionally, also include 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, the parameters include the horizontal field of view angle ,width ,high And magnification ; Module for calculating virtual pixel distance: S402: based on , , , and preset formula , calculate the virtual pixel distance ; Corner point coordinate representation module: S403: preset the camera device as the origin , the coordinates of each corner point of the minimum enclosing rectangle are expressed as ; First corner point coordinate module: S404: When , the coordinates of the first corner point of the minimum enclosing rectangle are expressed as , based on the preset formula , calculate the coordinates of the first corner point of the minimum circumscribed rectangle; Second corner point coordinate module: S405: When , the coordinates of the second corner point of the minimum enclosing 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 point coordinate module: S406: , the coordinates of the third triangle point of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle point of the minimum circumscribed rectangle; Fourth corner point coordinate module: S407: When , the coordinates of the fourth corner point of the minimum enclosing rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum circumscribed rectangle.
[0044] Optionally, also include Conversion module: S408: Convert the coordinates of each corner point of the minimum circumscribed rectangle Convert to homogeneous coordinates ; Transformation coordinate module: S409: Based on preset formula and the perspective transformation matrix , transform each homogeneous coordinate corner point to obtain the transformed coordinates ; 2D image coordinate module: S410: based on preset formula , , for the transformed coordinates Normalize to get the two-dimensional image coordinates ; 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 point coordinates of the final object image.
[0045] 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 through a system bus. Among them, 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 through 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.
[0046] In one embodiment, a computer device is provided, including 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.
[0047] 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.
[0048] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and 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 (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0049] Those skilled in the art can clearly understand that for the convenience and simplicity 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: Includes steps: S10: when receiving an image acquisition instruction sent by the teacher terminal, extracting the original object image of the desktop to be identified from 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, the boundary of the original object image is identified and the boundary coordinates of the original object image are output; S40: Based on the perspective transformation matrix, the boundary coordinates of the original object image and the minimum circumscribed rectangle method, outputting 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 boundary corner coordinates 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 steps of: S201: Outputting parameters of the camera device, the parameters including built-in parameters and external parameters, the built-in parameters including focal length and built-in parameter matrix, and the external parameters including 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: Calculate the focal length adjustment amount based on the depth and focal length of the original object image, send the focal length adjustment amount and focal length adjustment instruction to the camera device, and adjust the focal length of the lens; S204: Calculate the zoom adjustment amount based on the size and image resolution of the original object image, send the zoom adjustment amount and the zoom adjustment instruction to the camera device, and adjust the zoom of the lens; 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.
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 comprises 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. The perspective transformation image acquisition method based on binocular data acquisition equipment according to claim 1, characterized in that: 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 circumscribed rectangle method comprises the following steps: 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, the parameters include the horizontal field of view angle ,width ,high And magnification ; S402: Based on , , , and preset formula , calculate the virtual pixel distance ; S403: Preset the camera device as the origin , the coordinates of each corner point of the minimum enclosing rectangle are expressed as ; S404: When , the coordinates of the first corner point of the minimum enclosing 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 enclosing 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 point of the minimum circumscribed rectangle are expressed as , based on the preset formula , calculate the coordinates of the third triangle point of the minimum circumscribed rectangle; S407: When , the coordinates of the fourth corner point of the minimum enclosing rectangle are expressed as , based on the preset formula , calculate the coordinates of the fourth corner point of the minimum circumscribed rectangle.
6. The perspective transformation image acquisition method based on binocular data acquisition equipment according to claim 1, characterized in that: 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 circumscribed rectangle method further includes the steps of: S408: The coordinates of each corner point of the minimum circumscribed rectangle are Convert to homogeneous coordinates ; S409: Based on 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 point coordinates of the final object image.
7. A perspective transformation image acquisition system based on a binocular data acquisition device, characterized in that: include: Image acquisition instruction module: S10: when receiving an image acquisition instruction sent by the teacher terminal, extract the original object image of the desktop to be identified from the image acquisition instruction; Module for calculating perspective transformation matrix: 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; 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; Boundary corner point coordinate module: S40: Based on the perspective transformation matrix, the boundary coordinates of the original object image and the minimum circumscribed rectangle method, output the boundary corner point coordinates of the final object image; Final object image module: S50: outputting a corrected final object image based on a preset perspective transformation processing model and the boundary corner coordinates of the final object image; Image optimization processing module: S60: Perform image optimization processing on the corrected final object image and output the final object image after optimization processing.
8. 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 a perspective transformation image acquisition method based on a binocular data acquisition device as described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of a perspective transformation image acquisition method based on a binocular data acquisition device as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Fast snapshot method, device and system
CN109922251A
Image perspective transformation method, device and equipment
CN110060200A
Image perspective correction method and device based on camera view angle transformation
CN115115550A
Multi-camera external parameter calibration method and device and electronic equipment
CN115439552A
Document correction method and device and electronic equipment
CN115760620A
