A method and apparatus for processing real-world images in a mixed reality helmet for flight simulation
By using image cropping, color space transformation, distortion correction and scaling processing in the simulated flight mixed reality helmet, the non-standardized image processing problems in the existing technology are solved, the image quality and efficiency are improved, and the display reality is enhanced.
Patent Information
- Application Number
- CN202410842211.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-06-27
AI Technical Summary
The real-scene image processing process of existing simulated flight mixed reality helmets is not standardized, the image quality is reduced, the processing delay is high, and the computing resources are occupied, which affects the visual imaging effect.
Image cropping, color space transformation, distortion correction and scaling processing are used, the field of view angle is measured through marker cropping method, radial and tangential distortion correction is performed using mathematical models, image correction and distortion tables are merged, and FPGA is used to accelerate the processing.
It reduces the difficulty of image processing, improves processing efficiency and quality, enhances display realism, reduces the number of image pixel movements, and reduces latency.
Smart Images

Figure CN118397225B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of simulated flight training, and more specifically, to a method and device for processing real-scene images of a simulated flight mixed reality helmet. Background Art
[0002] The processing of real-scene images for simulated flight mixed reality helmets is a major challenge for mixed reality helmets. After being collected from the camera, the real-scene images need to undergo multiple image processing steps, such as distortion correction, rotation, cropping, and lens anti-distortion correction.
[0003] In the field of simulated flight mixed reality helmets, the processing of real-scene images still has the following problems: a) The existing mixed reality helmet real-scene image processing process is not standardized enough, and each manufacturer has its own processing method. There is a lack of standard processing procedures, which makes real-scene image processing difficult and error-prone, and is not conducive to the healthy and rapid development of the industry; b) The image quality of the real-scene image is seriously degraded after multiple processing, resulting in poor real-scene imaging effect of the helmet; c) The existing real-scene image processing is mainly processed by software, which has high processing delay and occupies a lot of computer resources, affecting the execution efficiency of the visual imaging software and reducing the overall delay of the simulated flight mixed display helmet system. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a method and device for processing real-scene images of a simulated flight mixed reality helmet, which reduces the difficulty of real-scene camera image processing, improves the efficiency and quality of image processing, and enhances the display realism of the simulated flight mixed reality helmet.
[0005] The object of the present invention is achieved through the following solutions:
[0006] A method for processing real-scene images of a simulated flight mixed reality helmet comprises the following steps:
[0007] S1, image cropping: cropping the real-view camera image according to the specified field of view;
[0008] S2, color space conversion: after cropping, color space conversion is performed to convert the YUV pixel format into RGB pixel format;
[0009] S3, image correction: perform distortion correction on the barrel distortion produced by the real-view camera image;
[0010] S4, image distortion processing: performing image distortion processing on the real-scene camera image after the distortion correction in step S3 to offset the distortion caused by the display module in the mixed reality helmet;
[0011] S5, Image Scaling: Scale the real-view camera image to match the helmet display resolution.
[0012] Furthermore, in step S1, the real-scene camera image is cropped according to the specified field of view, which specifically includes the sub-steps of: calculating the rectangular area corresponding to the target field of view FOV, the measuring method uses a marker cropping method, placing a marker at the specified field of view position in the camera shooting scene, and cropping in the image taken by the camera until the marker is just removed from the image.
[0013] Further, in step S2, the color space transformation is performed after the cropping is completed to convert the YUV pixel format into the RGB pixel format, which specifically includes sub-steps: the color space transformation is completed by multiplying the original input YUV component with the conversion matrix and adding the offset vector using the following formula, that is:
[0014]
[0015] In the formula, R, G, B represent the red, green, and blue component values of the output image after color transformation, Y, U, and V represent the grayscale value of the input original image, the chromaticity of the blue projection, and the chromaticity of the red projection, respectively. K 11 , K 12 , K 13 , K 21 , K 22 , K 23 , K 31 , K 32 , K 33 They represent the conversion matrix from YUV image to RGB image, where K 11 Take 1.164, K 12 Take 1.164, K 13 Take 1.164, K 21 Take 0.0000, K 22 Take -0.391, K 23 Take 2.0180, K 31 Take 1.5960, K 32 Take -0.813, K 33 Take 0.0000, O 1 , O 2 , O 3 Respectively represent the offset of the red component, the green component, and the blue component of the output image, O 1 Take 0, O 2 Take 128, O 3 Take 128.
[0016] Furthermore, in step S3, the barrel distortion generated by the real-view camera image is corrected, specifically comprising the sub-steps of generating a pincushion distortion to offset the barrel distortion generated by the real-view camera.
[0017] Further, in step S3, the barrel distortion generated by the real-view camera image is corrected, specifically including the sub-steps of:
[0018] The real-scene camera distortion is abstracted into two distortion mathematical models, namely radial distortion and tangential distortion;
[0019] Among them, the mathematical model of radial distortion is constructed as follows:
[0020]
[0021]
[0022]
[0023] In the formula, represents the X coordinate of the image pixel after distortion correction, represents the pixel X coordinate of the original image, represents the radial distortion coefficient 1, represents the radial distortion coefficient 2, represents the radial distortion coefficient 3, , , According to the actual optical parameters of the real-scene camera, r represents the distance between the pixel point and the center point of the image. represents the Y coordinate of the pixel in the image after distortion correction, and y represents the Y coordinate of the pixel in the original image;
[0024] Among them, the mathematical model of tangential distortion is constructed as follows:
[0025]
[0026]
[0027]
[0028] In the formula, represents the tangential distortion coefficient of 1, represents the tangential distortion coefficient 2, , Derived from the actual real-scene camera optical parameters.
[0029] Further, in step S4, the image distortion processing is performed on the real-view camera image after the distortion correction in step S3 to offset the distortion caused by the display module in the mixed reality helmet, which specifically includes the following sub-steps:
[0030] A barrel distortion is performed to distort the real-life camera image, and its mathematical model is constructed as follows:
[0031]
[0032]
[0033]
[0034] In the formula, represents the X coordinate of the distorted image pixel, represents the pixel X coordinate of the original image, represents the radial distortion coefficient 1, represents the radial distortion coefficient 2, represents the radial distortion coefficient 3, , , According to the optical parameters of the mixed reality helmet lens, r represents the distance between the pixel point and the center point of the image. represents the Y coordinate of the pixel in the distorted image, and y represents the Y coordinate of the pixel in the original image.
[0035] Furthermore, in step S3, the barrel distortion produced by the real-scene camera image is corrected, specifically including the sub-steps of: calibrating the parameters of the two constructed distortion mathematical models using Zhang's calibration method, that is, taking multiple calibration plate pictures and then importing them into the OpenCV graphics tool for parameter calculation.
[0036] Furthermore, in step S5, the real-scene camera image is scaled to match the helmet display resolution, specifically including the sub-step of: using a bilinear interpolation algorithm to enlarge the image.
[0037] Furthermore, before the image correction in step S3, the step is also included: merging the image correction table and the image distortion table used in the image processing in steps S3 and S4 in advance, and mapping the mapping relationship between the two tables into one table through mathematical methods, so as to reduce the number of times the image pixels are moved when performing image processing.
[0038] Furthermore, the image correction table and the image distortion table used in the image processing of step S3 and step S4 are merged in advance, and the mapping relationship between the two tables is mapped into one table by mathematical methods, which specifically includes the following sub-steps: determining whether all pixels have been traversed, if not, obtaining an uncalculated pixel value, and then searching for the corresponding value in the correction table, and then using the corresponding value in the correction table as the existing distortion table for table lookup, and then recording the current value as the fusion table, and jumping to the step of determining whether all pixels have been traversed; if so, ending.
[0039] Furthermore, after the mapping relationship of the two tables is mapped into one table through mathematical methods, the following steps are also included: storing the lookup mapping table relationship in DDR, and initializing the DDR through PS configuration when powering on; the video data and the coordinate mapping table relationship are both stored in DDR, and the image data is read into RAM according to the VESA timing, and the coordinate mapping table is read from DDR into FIFO, and a pixel mapping relationship is read from FIFO each time, and then the corresponding coordinate position is searched from RAM, and the searched pixels are stored in the video output FIFO to complete the image correction work.
[0040] A device for processing real-scene images of a simulated flight mixed reality helmet comprises a processor and a memory. A program is stored in the memory. When the program is loaded by the processor, the method for processing real-scene images of a simulated flight mixed reality helmet as described in any one of the above items is executed.
[0041] The beneficial effects of the present invention include:
[0042] The present invention improves the image processing method, standardizes the real-scene image processing flow of the simulated flight mixed reality helmet, and then merges the key processes by algorithm based on this, so as to merge multiple image processing into one as a whole and further accelerate it through FPGA hardware, thereby reducing the difficulty of real-scene camera image processing, improving the efficiency and quality of image processing, and enhancing the display realism of the simulated flight mixed reality helmet. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0044] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0045] Figure 2 A diagram showing the arrangement of image clipping in the method of an embodiment of the present invention;
[0046] Figure 3 is a schematic diagram of magnifying a distorted real scene image in a method according to an embodiment of the present invention;
[0047] Figure 4 A flowchart of the correction and image distortion algorithm table combination in the method of the embodiment of the present invention;
[0048] Figure 5 A schematic diagram of FPGA acceleration in the method of an embodiment of the present invention;
[0049] Figure 6 It is a logic block diagram of the image processing acceleration method in the embodiment of the present invention;
[0050] Figure 7 These are multiple calibration plate images taken. DETAILED DESCRIPTION
[0051] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.
[0052] Explanation of terms
[0053] DDR: Double data rate synchronous dynamic random access memory
[0054] PS: Processing system
[0055] VESA: Video standards defined by the Video Electronics Standards Association
[0056] FIFO: First In First Out Queue
[0057] RAM: Random Access Memory
[0058] FOV: Field of View
[0059] YUV: A color encoding method that represents color by splitting it into brightness and chromaticity
[0060] RGB: A color encoding method that represents colors by splitting them into three primary colors
[0061] The specific implementation process of the technical solution of the present invention is as follows Figure 1 As shown, the following steps are included:
[0062] Step S1, image cropping: The first step in real-view camera image processing is image cropping. The field of view of the real-view camera image is generally larger than the field of view required by the mixed reality helmet, so the real-view camera image needs to be cropped according to the specified field of view angle.
[0063] Step S2, color space conversion: Because the camera image is in a compressed format, its pixel format is often in YUV format after cropping, which is not conducive to image processing. Therefore, it is necessary to perform color space conversion to convert the YUV pixel format into RGB pixel format.
[0064] Step S3, image correction: The real-view camera has a large field of view, and the camera image it produces has obvious distortion, so the real-view camera image is subjected to distortion correction. The real-view camera will produce barrel distortion, so a pincushion distortion needs to be generated to offset the barrel distortion it produces.
[0065] Step S4, image distortion: The display module in the mixed reality helmet is a lens-type module, which will cause the image observed by the human eye to be distorted. Therefore, the real-scene camera image after distortion correction needs to be distorted to offset the distortion caused by the lens.
[0066] Step S5, image scaling: the resolution of the real-view camera image after processing is inconsistent with the resolution of the mixed reality helmet display, so the real-view camera image needs to be scaled to match the resolution of the helmet display.
[0067] In a further embodiment, the inventors of the present invention believe that the key to image cropping is to measure the rectangular area corresponding to the target FOV. The measurement method uses a marker cropping method, that is, a marker is placed at a specified field of view angle in the camera shooting scene, and cropping is performed in the picture taken by the camera until the marker is just removed from the picture. The arrangement of image cropping in the method of the embodiment of the present invention is as follows: Figure 2 shown. Figure 2 In the example, the optical center of the camera is used as the origin of the coordinate system. Two LED markers are placed on both sides of the camera, namely LED marker 1 and LED marker 2. The LED markers will emit light so that the camera can clearly capture the markers. First, place the LED markers in a position where the camera can observe them, and then gradually move the LED markers in the opposite direction of the camera's optical center until the camera just cannot observe the LED markers. At this time, the angle between the camera's optical center and the line connecting the two LED markers is the camera's FOV (field of view).
[0068] In a further embodiment, the color space transformation is performed using the following formula by multiplying the original input YUV components with the conversion matrix and adding an offset vector.
[0069]
[0070] In the formula, R, G, B represent the red, green, and blue component values of the output image after color transformation, Y, U, and V represent the grayscale value of the input original image, the chromaticity of the blue projection, and the chromaticity of the red projection, respectively. K 11 , K 12 , K 13 , K 21 , K 22 , K 23 , K 31 , K 32 , K 33 They represent the conversion matrix from YUV image to RGB image, where K 11 Take 1.164, K 12 Take 1.164, K 13 Take 1.164, K 21 Take 0.0000, K22 Take -0.391, K 23 Take 2.0180, K 31 Take 1.5960, K 32 Take -0.813, K 33 Take 0.0000, O 1 , O 2 , O 3 Respectively represent the offset of the red component, the green component, and the blue component of the output image, O 1 Take 0, O 2 Take 128, O 3 Take 128.
[0071] In a further implementation, the inventors of the present invention believe that the key to image correction is to correctly mathematically model the real-scene camera and calibrate its various distortion coefficients. The embodiment method of the present invention abstracts the distortion of the real-scene camera into two distortion mathematical models, namely: a) radial distortion; b) tangential distortion.
[0072] Among them, the mathematical model of radial distortion is as follows:
[0073]
[0074]
[0075]
[0076] In the formula, represents the X coordinate of the image pixel after distortion correction, represents the pixel X coordinate of the original image, represents the radial distortion coefficient 1, represents the radial distortion coefficient 2, represents the radial distortion coefficient 3, , , According to the actual optical parameters of the real-scene camera, r represents the distance between the pixel point and the center point of the image. represents the Y coordinate of the pixel in the image after distortion correction, and y represents the Y coordinate of the pixel in the original image.
[0077] Among them, the mathematical model of tangential distortion is as follows:
[0078]
[0079]
[0080]
[0081] In the formula, represents the tangential distortion coefficient of 1, represents the tangential distortion coefficient 2, , Derived from the actual real-scene camera optical parameters.
[0082] The embodiment of the present invention is conceived to use Zhang's calibration method to calibrate the above mathematical model parameters (but not limited to this calibration method), that is, by taking multiple calibration plate pictures and then importing them into the OpenCV graphics tool to perform parameter calculations. Figure 7 The following is a photo of the calibration plate.
[0083] In a further implementation, the image distortion method is similar to the real-view camera image correction method. Specifically, the real-view camera image is distorted by performing a barrel distortion, and its mathematical model is constructed as follows:
[0084]
[0085]
[0086]
[0087] In the formula, represents the X coordinate of the distorted image pixel, represents the pixel X coordinate of the original image, represents the radial distortion coefficient 1, represents the radial distortion coefficient 2, represents the radial distortion coefficient 3, , , According to the optical parameters of the mixed reality helmet lens, r represents the distance between the pixel point and the center point of the image. represents the Y coordinate of the pixel in the distorted image, and y represents the Y coordinate of the pixel in the original image.
[0088] The method of the embodiment of the present invention also performs the following processing: the distorted real scene image is enlarged to the same resolution as the mixed reality helmet display, so that the real scene image can be displayed normally afterwards. Specifically, the method of the embodiment of the present invention uses a bilinear difference algorithm to enlarge the image, that is, the position of the enlarged unknown pixel point p is converted to the original image, and the influence of the four pixel points A, B, C, and D on the point P is calculated. The schematic diagram is shown as follows: Figure 3 shown. Figure 3In the figure, the target pixel point is point P. The pixel values X and Y values of point P in the X and Y directions are rounded down and rounded up to obtain X1, X2, Y1, and Y2 respectively, and four points A, B, C, and D are obtained respectively. The pixel value of point P2 between points C and D is further calculated by interpolation according to the pixel values of points C and D. Similarly, the pixel value of point P1 between points A and B can be calculated. Finally, the final pixel value of point P is calculated by linear interpolation.
[0089] In a further embodiment, the inventor of the present invention believes that the key steps of image processing are image correction and image distortion, and the processing effect will largely determine the realism of the real-life image display. When performing image correction and image distortion, due to the uneven pixel density of the image, the corrected or distorted image will lose some pixel information, resulting in reduced picture clarity. By merging the mathematical formulas of image correction and image distortion, the number of times pixel information is discarded is reduced from two times to one time, avoiding the problem of multiple distortion calculations causing a decrease in the clarity of the real-life image. Specifically, the key processing flow of the real-life image is image correction and image distortion. The traditional process performs two processes, first image correction and then image distortion. Traditional image processing maintains two tables, namely the image correction table and the image distortion table. The software first moves the pixels of the original image according to the image correction table to achieve the image correction function. During this movement process, since the correction is not performed uniformly, pixels in some areas of the original image will be lost, resulting in a decrease in image clarity. After the corrected image is generated, the software will move the pixels of the image again according to the image distortion table. Due to the non-uniform pixel movement, the image clarity will be further reduced. The present invention is conceived to merge the image correction table and the image distortion table in image processing, that is, to map the mapping relationship of the two tables into one table through mathematical methods. When performing image processing, the number of image pixel movements is reduced, the image processing time is reduced, and the problem of decreased image clarity is alleviated. Figure 4 As shown, the correction and image distortion algorithm table merging process in the method of an embodiment of the present invention specifically includes sub-steps: determining whether all pixels have been traversed, if not, obtaining an uncalculated pixel value, then looking up the corresponding value in the correction table, and then using the corresponding value in the correction table as the existing distortion table for table lookup, and then recording the current value as the fusion table, and jumping to the step of determining whether all pixels have been traversed.
[0090] Table 1 below compares the differences between two image processings and one image processing:
[0091] Table 1
[0092]
[0093] In a further implementation manner, the inventor of the present invention has also conceived of further accelerating image processing through FPGA. The idea of the acceleration method in the embodiment of the present invention is to pre-calculate complex calculations, generate a mapping table of input values and output values and write it into the DDR on the FPGA. When performing image processing, the FPGA only needs to query the DDR through the input pixel value to obtain the final output value to complete the image processing. Figure 5 shown. Figure 5 In the present invention, the mapping table of the input image and the output image is calculated according to the correction algorithm and the distortion algorithm described above, and the table is burned into the FLASH for subsequent FPGA to read when performing image processing. This step is calculated offline by the PC and only needs to be calculated once. The subsequent FPGA can repeatedly read the pixel mapping table in the FLASH when performing image processing. During initialization, the FPGA will read the pre-stored pixel mapping table from the FLASH and load it into the DDR memory. After the FPGA acquires the real-scene image, it will read the pixel mapping table in the DDR in real time and move the pixels according to the pixel mapping table.
[0094] The speed at which FPGA queries DDR during operation is extremely fast. The DDR operating frequency used in the method of the embodiment of the present invention is 2400 MHz, and its theoretical operating rate is 143 Gbps. The theoretical table lookup time of FPGA is in the microsecond level, which greatly reduces the delay of image processing. Figure 6 FIG. 1 is a logic block diagram of the image processing acceleration method in the embodiment of the present invention. Figure 6 As shown, the coordinate mapping relationship is a large lookup table, which cannot be directly stored in the software. Therefore, the present invention stores the lookup mapping table relationship in DDR (initialized by PS configuration at power-on). The video data and the coordinate mapping table relationship are both stored in DDR, but the image data is read into RAM according to the VESA timing, and the coordinate mapping table is read from DDR into FIFO. Each time a pixel mapping relationship is read from FIFO, the corresponding coordinate position is searched from RAM, and the pixels found are stored in the video output FIFO, so that high-speed correction can be completed.
[0095] It should be noted that within the scope of protection defined in the claims of the present invention, the following embodiments can be combined and / or expanded or replaced in any logical way from the above specific implementation methods, such as disclosed technical principles, disclosed technical features or implicitly disclosed technical features.
[0096] Example 1
[0097] A method for processing real-scene images of a simulated flight mixed reality helmet comprises the following steps:
[0098] S1, image cropping: cropping the real-view camera image according to the specified field of view;
[0099] S2, color space conversion: after cropping, color space conversion is performed to convert the YUV pixel format into RGB pixel format;
[0100] S3, image correction: perform distortion correction on the barrel distortion produced by the real-view camera image;
[0101] S4, image distortion processing: performing image distortion processing on the real-scene camera image after the distortion correction in step S3 to offset the distortion caused by the display module in the mixed reality helmet;
[0102] S5, Image Scaling: Scale the real-view camera image to match the helmet display resolution.
[0103] Example 2
[0104] Based on Example 1, in step S1, the real-scene camera image is cropped according to the specified field of view angle, which specifically includes the sub-steps of: calculating the rectangular area corresponding to the target field of view angle FOV, the measurement method uses a marker cropping method, placing a marker at the specified field of view angle position in the camera shooting scene, and cropping in the image taken by the camera until the marker is just removed from the image.
[0105] Example 3
[0106] On the basis of Example 1, in step S2, the color space transformation is performed after the cropping is completed to convert the YUV pixel format into the RGB pixel format, which specifically includes sub-steps: the color space transformation is completed by multiplying the original input YUV component with the conversion matrix and adding the offset vector using the following formula, that is:
[0107]
[0108] In the formula, R, G, B represent the red, green, and blue component values of the output image after color transformation, Y, U, and V represent the grayscale value of the input original image, the chromaticity of the blue projection, and the chromaticity of the red projection, respectively. K 11 , K 12 , K 13 , K 21 , K 22 , K 23 , K 31 , K 32 , K 33 They represent the conversion matrix from YUV image to RGB image, where K 11 Take 1.164, K 12 Take 1.164, K 13Take 1.164, K 21 Take 0.0000, K 22 Take -0.391, K 23 Take 2.0180, K 31 Take 1.5960, K 32 Take -0.813, K 33 Take 0.0000, O 1 , O 2 , O 3 Respectively represent the offset of the red component, the green component, and the blue component of the output image, O 1 Take 0, O 2 Take 128, O 3 Take 128.
[0109] Example 4
[0110] On the basis of Example 1, in step S3, the barrel distortion generated by the real-view camera image is corrected, specifically including the sub-steps of generating a pincushion distortion to offset the barrel distortion generated by the real-view camera.
[0111] Example 5
[0112] On the basis of Example 1, in step S3, the distortion correction is performed on the real-view camera image, which specifically includes the following sub-steps:
[0113] The real-scene camera distortion is abstracted into two distortion mathematical models, namely radial distortion and tangential distortion;
[0114] Among them, the mathematical model of radial distortion is constructed as follows:
[0115]
[0116]
[0117]
[0118] In the formula, represents the X coordinate of the image pixel after distortion correction, represents the pixel X coordinate of the original image, represents the radial distortion coefficient 1, represents the radial distortion coefficient 2, represents the radial distortion coefficient 3, , , According to the actual optical parameters of the real-scene camera, r represents the distance between the pixel point and the center point of the image. represents the Y coordinate of the pixel in the image after distortion correction, and y represents the Y coordinate of the pixel in the original image;
[0119] Among them, the mathematical model of tangential distortion is constructed as follows:
[0120]
[0121]
[0122]
[0123] In the formula, represents the tangential distortion coefficient of 1, represents the tangential distortion coefficient 2, , Derived from the actual real-scene camera optical parameters.
[0124] Example 6
[0125] On the basis of Example 1, in step S4, image distortion processing is performed on the real-scene camera image after the distortion correction in step S3 to offset the distortion caused by the display module in the mixed reality helmet, which specifically includes the following sub-steps:
[0126] A barrel distortion is performed to distort the real-life camera image, and its mathematical model is constructed as follows:
[0127]
[0128]
[0129]
[0130] In the formula, represents the X coordinate of the distorted image pixel, represents the pixel X coordinate of the original image, represents the radial distortion coefficient 1, represents the radial distortion coefficient 2, represents the radial distortion coefficient 3, , , According to the optical parameters of the mixed reality helmet lens, r represents the distance between the pixel point and the center point of the image. represents the Y coordinate of the pixel in the distorted image, and y represents the Y coordinate of the pixel in the original image.
[0131] Example 7
[0132] On the basis of Example 5, in step S3, the real-scene camera image is subjected to distortion correction, which specifically includes the sub-steps of: calibrating the parameters of the two constructed distortion mathematical models using Zhang's calibration method, that is, taking multiple calibration plate images and then importing them into the OpenCV graphics tool for parameter calculation.
[0133] Example 8
[0134] Based on Example 1, in step S5, scaling the real-scene camera image to match the resolution of the helmet display specifically includes the sub-step of: using a bilinear interpolation algorithm to enlarge the image.
[0135] Example 9
[0136] On the basis of Example 1, before the image correction in step S3, the method further includes the following steps: merging the image correction table and the image distortion table to be used in the image processing in steps S3 and S4 in advance, and mapping the mapping relationship between the two tables into one table through mathematical methods, so as to reduce the number of times the image pixels are moved when performing image processing.
[0137] Example 10
[0138] On the basis of Example 9, the image correction table and the image distortion table in the image processing of step S3 and step S4 are merged, and the mapping relationship between the two tables is mapped into one table through a mathematical method, which specifically includes the sub-steps of: judging whether all pixels have been traversed, if not, obtaining an uncalculated pixel value, and then looking up the corresponding value in the correction table, and then using the corresponding value in the correction table as the existing distortion table for table lookup, and then recording the current value as the fusion table, and jumping to the step of judging whether all pixels have been traversed; if so, ending.
[0139] Embodiment 11
[0140] On the basis of Example 9, after the mapping relationship of the two tables is mapped into one table by mathematical methods, the following steps are also included: storing the lookup mapping table relationship in DDR, and initializing it through PS configuration when powering on in DDR; both the video data and the coordinate mapping table relationship are stored in DDR, and the image data is read into RAM according to VESA timing, and the coordinate mapping table is read from DDR into FIFO, and a pixel mapping relationship is read from FIFO each time, and then the corresponding coordinate position is searched from RAM, and the found pixel is stored in the video output FIFO to complete the image correction work.
[0141] Example 12
[0142] A device for processing real-scene images for a simulated flight mixed reality helmet comprises a processor and a memory, wherein a program is stored in the memory, and when the program is loaded by the processor, the method for processing real-scene images for a simulated flight mixed reality helmet described in any one of Embodiments 1 to 11 is executed.
[0143] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.
[0144] According to one aspect of an embodiment of the present invention, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in the above various optional implementations.
[0145] As another aspect, an embodiment of the present invention further provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
Claims
1. A method for processing real-scene images of a simulated flight mixed reality helmet, It is characterized in that The following steps are involved: S1, image cropping: cropping the real-view camera image according to the specified field of view; S2, color space conversion: after the cropping is completed, the color space conversion is performed to convert the YUV pixel format into the RGB pixel format; in step S2, the color space conversion is performed after the cropping is completed to convert the YUV pixel format into the RGB pixel format, specifically including sub-steps: the color space conversion uses the following formula, which is completed by multiplying the original input YUV component with the conversion matrix and adding the offset vector, that is: In the formula, R, G, B represent the red, green, and blue component values of the output image after color transformation, Y, U, and V represent the grayscale value of the input original image, the chromaticity of the blue projection, and the chromaticity of the red projection, respectively. K 11 , K 12 , K 13 , K 21 , K 22 , K 23 , K 31 , K 32 , K 33 They represent the conversion matrix from YUV image to RGB image, where K 11 Take 1.164, K 12 Take 1.164, K 13 Take 1.164, K 21 Take 0.0000, K 22 Take -0.391, K 23 Take 2.0180, K 31 Take 1.5960, K 32 Take -0.813, K 33 Take 0.0000, O 1 , O 2 , O 3 Respectively represent the offset of the red component, the green component, and the blue component of the output image, O 1 Take 0, O 2 Take 128, O 3 Take 128; S3, image correction: performing distortion correction on the barrel distortion produced by the real-view camera image, including the following sub-steps: The real-scene camera distortion is abstracted into two distortion mathematical models, namely radial distortion and tangential distortion; Among them, the mathematical model of radial distortion is constructed as follows: In the formula, represents the X coordinate of the image pixel after distortion correction, represents the pixel X coordinate of the original image, represents the radial distortion coefficient 1, represents the radial distortion coefficient 2, represents the radial distortion coefficient 3, , , According to the actual optical parameters of the real-scene camera, r represents the distance between the pixel point and the center point of the image. represents the Y coordinate of the pixel in the image after distortion correction, and y represents the Y coordinate of the pixel in the original image; Among them, the mathematical model of tangential distortion is constructed as follows: In the formula, represents the tangential distortion coefficient of 1, represents the tangential distortion coefficient 2, , Derived from the actual real-scene camera optical parameters; S4, image distortion processing: performing image distortion processing on the real-scene camera image after the distortion correction in step S3 to offset the distortion caused by the display module in the mixed reality helmet, specifically including sub-steps: A barrel distortion is performed to distort the real-life camera image, and its mathematical model is constructed as follows: In the formula, represents the X coordinate of the distorted image pixel, represents the pixel X coordinate of the original image, represents the radial distortion coefficient 1, represents the radial distortion coefficient 2, represents the radial distortion coefficient 3, , , According to the optical parameters of the mixed reality helmet lens, r represents the distance between the pixel point and the center point of the image. represents the Y coordinate of the pixel in the distorted image, and y represents the Y coordinate of the pixel in the original image; S5, Image Scaling: Scale the real-view camera image to match the helmet display resolution.
2. The method for processing real-scene images of a flight simulation mixed reality helmet according to claim 1, It is characterized in that In step S1, the real-scene camera image is cropped according to the specified field of view, which specifically includes the sub-steps of: calculating the rectangular area corresponding to the target field of view FOV, the measuring method uses a marker cropping method, placing a marker at the specified field of view position in the camera shooting scene, and cropping the image taken by the camera until the marker is just removed from the image.
3. The method for processing real-scene images for a flight simulation mixed reality helmet according to claim 1, It is characterized in that In step S3, the barrel distortion generated by the real-view camera image is corrected, which specifically includes the sub-steps of generating a pincushion distortion to offset the barrel distortion generated by the real-view camera.
4. The method for processing real-scene images for a flight simulation mixed reality helmet according to claim 1, It is characterized in that In step S3, the barrel distortion produced by the real-scene camera image is corrected, which specifically includes the sub-steps of: calibrating the parameters of the two constructed distortion mathematical models using Zhang's calibration method, and taking multiple calibration plate pictures and then importing them into the OpenCV graphics tool for parameter calculation.
5. The method for processing real-scene images for a flight simulation mixed reality helmet according to claim 1, It is characterized in that In step S5, the real-scene camera image is scaled to match the helmet display resolution, which specifically includes the sub-steps of: using a bilinear interpolation algorithm to enlarge the image.
6. The method for processing real-scene images for a flight simulation mixed reality helmet according to claim 1, It is characterized in that Before the image correction in step S3, the method also includes the following steps: merging the image correction table and the image distortion table used in the image processing in steps S3 and S4 in advance, and mapping the mapping relationship between the two tables into one table through mathematical methods, so as to reduce the number of times the image pixels are moved when performing image processing.
7. The method for processing real-scene images of a flight simulation mixed reality helmet according to claim 6, It is characterized in that The image correction table and the image distortion table used in the image processing of step S3 and step S4 are merged in advance, and the mapping relationship between the two tables is mapped into one table by mathematical methods, which specifically includes the sub-steps of: judging whether all pixels have been traversed, if not, obtaining an uncalculated pixel value, and then looking up the corresponding value in the correction table, and then using the corresponding value in the correction table as the existing distortion table for table lookup, and then recording the current value as the fusion table, and jumping to the step of judging whether all pixels have been traversed; if so, ending.
8. The method for processing real-scene images for a flight simulation mixed reality helmet according to claim 6, It is characterized in that After the mapping relationship of the two tables is mapped into one table by mathematical methods, the following steps are also included: storing the mapping table lookup relationship in DDR, and initializing it through PS configuration when powering on in DDR; both the video data and the coordinate mapping table relationship are stored in DDR, and the image data is read into RAM according to VESA timing, and the coordinate mapping table is read from DDR into FIFO, and a pixel mapping relationship is read from FIFO each time, and then the corresponding coordinate position is searched from RAM, and the searched pixels are stored in the video output FIFO to complete the image correction work.
9. A real-scene image processing device for a simulated flight mixed reality helmet, It is characterized in that The invention comprises a processor and a memory, wherein a program is stored in the memory, and when the program is loaded by the processor, the real scene image processing method for a simulated flight mixed reality helmet according to any one of claims 1 to 8 is executed.
