A method, apparatus and device for image distortion correction

By reading the distorted texture object corresponding to the distortion matrix on the image processor GPU and parsing the RGBA pixel values, the GPU's parallel processing capability is used to generate the distorted corrected image, thus solving the problem of slow CPU rendering speed and achieving efficient image rendering.

CN115100062BActive Publication Date: 2026-02-03NEUSOFT CORP +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210752809.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-29
Publication Date
2026-02-03
Estimated Expiration
2042-06-29

AI Technical Summary

Technical Problem

In existing technologies, using a central processing unit (CPU) for image distortion correction results in slow image rendering speed, affecting rendering efficiency.

Method used

Using a GPU (Graphics Processing Unit), the system reads the distorted texture object corresponding to the distortion matrix, generates one-to-one RGBA pixel values, parses them into coordinate values, and uses the GPU's pixel-parallel processing capability to sample the target image, generating a distorted corrected image.

Benefits of technology

It improves image rendering speed and efficiency, reduces CPU computational load, and greatly enhances rendering performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115100062B_ABST
    Figure CN115100062B_ABST
Patent Text Reader

Abstract

The application discloses a method, device and equipment for image distortion correction, which is applied to a graphic processing unit (GPU). A distortion matrix includes a plurality of coordinate values, one-to-one corresponding RGBA pixel values are generated based on the coordinate values of the distortion matrix, and the generated plurality of RGBA pixel values form a distortion texture object. The GPU can read the distortion texture object corresponding to the distortion matrix, and can parse the RGBA pixel values included in the distortion texture object into coordinate values. Furthermore, the GPU samples a target image according to the parsed coordinate values to generate a corrected image after distortion correction. Since the GPU has a pixel parallel processing capability, when the GPU samples the target image according to the parsed coordinate values, the sampling speed can be improved, and the corrected image after distortion correction can be generated quickly. In this way, the speed of generating the corrected image after distortion correction is improved, and the rendering speed of the target image is relatively fast.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to a method, apparatus, and device for image distortion correction. Background Technology

[0002] In image processing, image distortion may occur when an image is projected from one surface to another. For example, when an image on a plane is projected onto a curved surface, the projected image will be distorted. In this case, a distortion matrix is ​​needed to correct the distortion of the image to be projected, generating a distorted image that can be rendered and displayed correctly on the other surface.

[0003] Currently, a central processing unit (CPU) is needed to calculate the distortion matrix to correct image distortion, generate a distorted image, and then render it. However, this method results in slow image rendering speed, affecting image rendering efficiency. Summary of the Invention

[0004] In view of this, embodiments of this application provide a method, apparatus, and device for image distortion correction, which can improve the rendering speed of images.

[0005] To address the above problems, the technical solutions provided in this application are as follows:

[0006] A method for image distortion correction, the method being applied to an image processor GPU, the method comprising:

[0007] Read the distortion texture object corresponding to the distortion matrix. The distortion matrix includes multiple coordinate values, and the distortion texture object includes multiple RGBA pixel values. The coordinate values ​​included in the distortion matrix correspond one-to-one with the RGBA pixel values ​​included in the distortion texture object. The RGBA pixel values ​​included in the distortion texture object are generated based on the corresponding coordinate values.

[0008] The RGBA pixel values ​​included in the distorted texture object are parsed into parsed coordinate values;

[0009] The target image is sampled based on the parsed coordinate values ​​to generate a distortion-corrected image.

[0010] In one possible implementation, the process of generating the RGBA pixel values ​​of the distorted texture object includes:

[0011] The target coordinate values ​​are normalized to obtain target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix.

[0012] Multiply the x-coordinate value of the target floating-point coordinates by a first preset coefficient and round down to obtain the first integer value;

[0013] Convert the first integer value into the pixel values ​​of any two pixel channels in the RGBA pixel value;

[0014] Multiply the vertical coordinate value of the target floating-point coordinate value by the first preset coefficient and round it to obtain the second integer value;

[0015] The second integer value is converted into the pixel values ​​of the other two pixel channels in the RGBA pixel value to generate the RGBA pixel value corresponding to the target coordinate value.

[0016] In one possible implementation, converting the first integer value into pixel values ​​for any two pixel channels in the RGBA pixel value includes:

[0017] The high-order bits of the first integer value are used as the pixel value of any one pixel channel in the RGBA pixel value, and the low-order bits of the first integer value are used as the pixel value of the other pixel channel in the RGBA pixel value.

[0018] The step of converting the second integer value into pixel values ​​of the other two pixel channels in the RGBA pixel value to generate the RGBA pixel value corresponding to the target coordinate value includes:

[0019] Use the high-order bits of the second integer value as the pixel value of any other pixel channel in the RGBA pixel value, and use the low-order bits of the second integer value as the pixel value of the last pixel channel in the RGBA pixel value.

[0020] In one possible implementation, the process of generating the RGBA pixel values ​​of the distorted texture object includes:

[0021] The target coordinate values ​​are normalized to obtain target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix.

[0022] Multiply the x-coordinate value of the target floating-point coordinates by a second preset coefficient and round down to obtain a third integer value;

[0023] The third integer value is used as the pixel value of any pixel channel in the RGBA pixel value;

[0024] Multiply the ordinate value of the target floating-point coordinates by the second preset coefficient and round down to obtain the fourth integer value;

[0025] Use the fourth integer value as the pixel value of another pixel channel in the RGBA pixel value;

[0026] Set the pixel values ​​of the other two pixel channels in the RGBA pixel value to zero to generate the RGBA pixel value corresponding to the target coordinate value.

[0027] In one possible implementation, normalizing the target coordinate values ​​to obtain target floating-point coordinate values ​​includes:

[0028] Divide the x-coordinate value of the target coordinates by the width of the corrected image, and divide the y-coordinate value of the target coordinates by the height of the corrected image to obtain the target floating-point coordinates.

[0029] In one possible implementation, resolving the RGBA pixel values ​​of the distorted texture object into resolved coordinate values ​​includes:

[0030] The first integer value and the second integer value are obtained by reading the pixel values ​​of the two pixel channels corresponding to the first integer value and the two pixel channels corresponding to the second integer value from the target RGBA pixel value; the target RGBA pixel value is each RGBA pixel value in the distorted texture object.

[0031] Divide the first integer value by the first preset coefficient to obtain the first horizontal axis value, and divide the second integer value by the first preset coefficient to obtain the first vertical axis value;

[0032] Multiply the first horizontal coordinate value by the width of the corrected image, and multiply the first vertical coordinate value by the height of the corrected image to obtain the parsed coordinate value corresponding to the target RGBA pixel value.

[0033] In one possible implementation, resolving the RGBA pixel values ​​of the distorted texture object into resolved coordinate values ​​includes:

[0034] The pixel values ​​of the pixel channels corresponding to the third integer value and the pixel channels corresponding to the fourth integer value are read from the target RGBA pixel values ​​to obtain the third integer value and the fourth integer value; the target RGBA pixel values ​​are each RGBA pixel value in the distorted texture object;

[0035] Divide the third integer value by the second preset coefficient to obtain the second horizontal axis value, and divide the fourth integer value by the second preset coefficient to obtain the second vertical axis value;

[0036] Multiply the second horizontal coordinate value by the width of the corrected image, and multiply the second vertical coordinate value by the height of the corrected image to obtain the parsed coordinate value corresponding to the target RGBA pixel value.

[0037] An image distortion correction apparatus, the apparatus being applied to an image processor GPU, the apparatus comprising:

[0038] The reading unit is used to read the distortion texture object corresponding to the distortion matrix. The distortion matrix includes multiple coordinate values, and the distortion texture object includes multiple RGBA pixel values. The coordinate values ​​included in the distortion matrix correspond one-to-one with the RGBA pixel values ​​included in the distortion texture object. The RGBA pixel values ​​included in the distortion texture object are generated based on the corresponding coordinate values.

[0039] The parsing unit is used to parse the RGBA pixel values ​​included in the distorted texture object into parsed coordinate values;

[0040] The generation unit is used to sample the target image based on the parsed coordinate values ​​to generate a distortion-corrected image.

[0041] An electronic device includes: 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, it implements the image distortion correction method as described above.

[0042] A computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform the image distortion correction method described above.

[0043] Therefore, the embodiments of this application have the following beneficial effects:

[0044] This application provides a method, apparatus, and device for image distortion correction. The method is applied to a graphics processing unit (GPU). A distortion matrix includes multiple coordinate values. Based on these coordinate values, corresponding RGBA pixel values ​​are generated, and these generated RGBA pixel values ​​form a distortion texture object. The GPU can read the distortion texture object corresponding to the distortion matrix and parse the RGBA pixel values ​​into coordinate values. Then, the GPU samples the target image based on the parsed coordinate values ​​to generate a distorted image. Because the GPU has pixel-parallel processing capabilities, it can increase the sampling speed when sampling the target image based on the parsed coordinate values, thus enabling faster generation of the distorted image. This increases the speed of generating the distorted image, resulting in faster rendering speed and higher rendering efficiency for the target image. Attached Figure Description

[0045] Figure 1 A schematic diagram illustrating an exemplary application scenario provided in this application embodiment;

[0046] Figure 2A flowchart illustrating an image distortion correction method provided in this application embodiment;

[0047] Figure 3 A flowchart illustrating the generation process of RGBA pixel values ​​for a distorted texture object provided in this application embodiment;

[0048] Figure 4 A flowchart illustrating the generation process of RGBA pixel values ​​for another distorted texture object provided in this application embodiment;

[0049] Figure 5 This is a schematic diagram of the structure of an image distortion correction device provided in an embodiment of this application. Detailed Implementation

[0050] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the embodiments of this application will be further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0051] To facilitate understanding of the technical solutions provided in this application, the background technology involved in this application will be explained below.

[0052] In image processing, image distortion may occur when an image is projected from one surface to another. For example, when an image on a plane is projected onto a curved surface, the image density is high at the center and low at the edges, causing distortion. This distorted image appears abnormal to the human eye. In this case, a distortion matrix is ​​needed to correct the distortion of the projected image, generating a corrected image. This corrected image has a uniform density on the other surface and can be rendered and displayed correctly there.

[0053] Currently, a central processing unit (CPU) is needed to calculate the distortion matrix to correct image distortion, generate a distorted image, and then render it. However, this method results in slow image rendering speed, affecting image rendering efficiency.

[0054] Based on this, embodiments of this application provide a method, apparatus, and device for image distortion correction. The image distortion correction method is applied to a graphics processing unit (GPU). The distortion matrix includes multiple coordinate values. Based on the coordinate values ​​of the distortion matrix, corresponding RGBA pixel values ​​are generated, and these multiple RGBA pixel values ​​form a distortion texture object. The GPU can read the distortion texture object corresponding to the distortion matrix and parse the RGBA pixel values ​​included in the distortion texture object into coordinate values. Then, the GPU samples the target image according to the parsed coordinate values ​​to generate a distorted image. Because the GPU has pixel-parallel processing capabilities, it can improve the sampling speed when sampling the target image according to the parsed coordinate values, thereby generating the distorted image faster. This increases the speed of generating the distorted image, resulting in faster rendering speed and higher rendering efficiency for the target image.

[0055] To facilitate understanding of the image distortion correction method provided in the embodiments of this application, the following is combined with... Figure 1 The example scenario is shown below. See also... Figure 1 This figure is a schematic diagram of an exemplary application scenario provided in an embodiment of this application. This method can be applied to a graphics processing unit (GPU).

[0056] The distortion matrix includes multiple coordinate values. Based on the coordinate values ​​of the distortion matrix, corresponding RGBA pixel values ​​are generated. The generated multiple RGBA pixel values ​​form a distortion texture object.

[0057] Based on this, the GPU can read the distorted texture object corresponding to the distortion matrix and parse the RGBA pixel values ​​included in the distorted texture object into parsed coordinate values. Then, the GPU samples the target image based on the parsed coordinate values ​​to generate a distorted corrected image.

[0058] Those skilled in the art will understand that Figure 1 The schematic diagram shown is merely one example in which embodiments of this application can be implemented. The scope of application of the embodiments of this application is not limited by any aspect of this framework.

[0059] Based on the above description, the image distortion correction method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0060] See Figure 2 This figure is a flowchart of an image distortion correction method provided in an embodiment of this application, which can be applied to the GPU of the above embodiment. Figure 2 As shown, the image distortion correction method may include steps S201-S203:

[0061] S201: Read the distortion texture object corresponding to the distortion matrix. The distortion matrix includes multiple coordinate values, and the distortion texture object includes multiple RGBA pixel values. The coordinate values ​​included in the distortion matrix correspond one-to-one with the RGBA pixel values ​​included in the distortion texture object. The RGBA pixel values ​​included in the distortion texture object are generated based on the corresponding coordinate values.

[0062] The distortion matrix is ​​used to correct the target image, which is the image to be corrected. In this embodiment, the distortion matrix is ​​used to correct the target image, generating a distorted corrected image so that the distorted corrected image can be displayed normally on the target display surface. For example, the target display surface is a curved surface.

[0063] Each element in the distortion matrix represents a coordinate value, and the distortion matrix contains multiple coordinate values. The number of elements (or coordinate values) in the distortion matrix is ​​the same as the number of pixels in the generated corrected image. For example, if the corrected image is 200*200 pixels, then the distortion matrix also contains 200*200 elements, meaning it contains 200*200 sets of coordinate values. Each coordinate value in the distortion matrix represents the display position of the corresponding pixel in the target image within the corrected image. For example, if the coordinate value in the 200th row and 200th column of the distortion matrix is ​​(195, 197), then the pixel at position (200, 200) in the target image should be displayed at position (195, 197) in the corrected image. The corrected image and the target display surface have the same display area size; the display area is the area where the corrected image is displayed. For example, the display area of ​​the target display surface is also 200*200 pixels.

[0064] In practical applications, the target display surface can be the screen on which the corrected image is displayed. For example, if the screen is curved, the corrected image will be projected onto that curved screen. The distortion matrix corresponds to the target display surface (such as the screen) of the target image; that is, one target display surface (such as the screen) can correspond to one distortion matrix. When multiple target images are projected onto the target display surface, the distortion matrix used for distortion correction of multiple images is the same, namely the distortion matrix corresponding to that target display surface. As an optional example, the distortion matrix can be obtained based on the relevant parameters of the target display surface. For example, when the target display surface is curved, the distortion matrix can be obtained based on the curvature of the target display surface.

[0065] In this embodiment, to improve image rendering efficiency, image distortion correction is implemented by the GPU. The GPU needs to first obtain the distortion matrix. Since the GPU can only read pixel values, in order to enable the GPU to read the distortion matrix, after obtaining the distortion matrix, a corresponding distortion texture object is generated based on the distortion matrix. The distortion texture object includes multiple RGBA pixel values ​​that can be read by the GPU.

[0066] There is a one-to-one correspondence between the distortion matrix and the distortion texture object. For example, a target display surface corresponds to a distortion matrix and a distortion texture object. Furthermore, the RGBA pixel values ​​in the distortion texture object are generated based on their corresponding coordinate values. The coordinate values ​​in the distortion matrix correspond one-to-one with the RGBA pixel values ​​in the distortion texture object; one RGBA pixel value represents one coordinate value.

[0067] RGBA represents a 4-channel color space, including four color pixel channels: R channel, G channel, B channel, and A channel. The R channel represents Red, the G channel represents Green, the B channel represents Blue, and the A channel represents Alpha, which is the opacity parameter. The pixel values ​​of the four channels can range from [0, 255].

[0068] As an alternative example, in practical applications, the distorted texture object corresponding to the distortion matrix can be generated by the CPU, and the generated distorted texture object can be stored in video memory. In specific implementations, the GPU reads the distorted texture object corresponding to the distortion matrix from video memory.

[0069] In one possible implementation, embodiments of this application provide a specific implementation of the process for generating RGBA pixel values ​​for two types of distorted texture objects, as detailed in S301-S305 and S401-S406 below.

[0070] S202: Resolve the RGBA pixel values ​​contained in the distorted texture object into the resolved coordinate values.

[0071] After reading the distorted texture object corresponding to the distortion matrix, the GPU parses the RGBA pixel values ​​included in the distorted texture object into coordinate values. Understandably, theoretically, the parsed coordinate values ​​should be consistent with the coordinate values ​​included in the distortion matrix. However, due to potential precision loss during parsing, there may be slight differences between the parsed coordinate values ​​and the coordinate values ​​included in the distortion matrix in S201. Nevertheless, the parsed coordinate values ​​can still be considered consistent with the coordinate values ​​included in the distortion matrix in S201.

[0072] GPUs contain shaders that are used to implement image rendering. As an optional example, shaders in a GPU resolve the RGBA pixel values ​​contained in a distorted texture object into resolved coordinate values.

[0073] In one possible implementation, this application provides two specific implementation methods for resolving the RGBA pixel values ​​of the distorted texture object into the resolved coordinate values, as detailed in A1-A3 and B1-B3 below.

[0074] S203: Sample the target image based on the parsed coordinate values ​​to generate a distortion-corrected image.

[0075] After obtaining the parsed coordinate values, the GPU can sample the target image based on these coordinate values ​​to generate a distortion-corrected image. As an alternative example, in practical applications, the GPU's shaders sample the target image to be rendered based on the parsed coordinate values ​​to generate a distortion-corrected image.

[0076] Understandably, because GPUs possess pixel-parallel processing capabilities, they can improve sampling speed when sampling the target image based on the parsed coordinate values, thus enabling faster generation of the distortion-corrected image. For example, in actual experiments, based on comparative data, rendering a single frame of an 800*480 target image using the CPU method took 200 milliseconds. Using the GPU-based method provided in this embodiment, rendering takes less than 4 milliseconds. Clearly, using GPU computation significantly improves rendering performance and also reduces some of the computational burden on the CPU.

[0077] As described in S201-S203, this application provides a method for image distortion correction, which is applied to a graphics processing unit (GPU). The distortion matrix includes multiple coordinate values. Based on these coordinate values, corresponding RGBA pixel values ​​are generated, and these generated RGBA pixel values ​​form a distortion texture object. The GPU can read the distortion texture object corresponding to the distortion matrix and parse the RGBA pixel values ​​into coordinate values. Then, the GPU samples the target image based on the parsed coordinate values ​​to generate a distorted image. Because the GPU has pixel-parallel processing capabilities, it can increase the sampling speed when sampling the target image based on the parsed coordinate values, thus enabling faster generation of the distorted image. This increases the speed of generating the distorted image, resulting in faster rendering speed and higher rendering efficiency for the target image.

[0078] See Figure 3 , Figure 3 A flowchart illustrating the generation process of RGBA pixel values ​​for a distorted texture object provided in this application embodiment. In one possible implementation, it combines... Figure 3 This application provides a specific implementation method for generating RGBA pixel values ​​of a distorted texture object, specifically including steps S301-S305:

[0079] S301: Normalize the target coordinate values ​​to obtain the target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix.

[0080] For ease of explanation, each coordinate value in the distortion matrix is ​​represented by the target coordinate value. The target coordinate values ​​in the distortion matrix are then normalized to obtain the target floating-point coordinate values, where the x and y coordinates range from [0,1].

[0081] In one possible implementation, this application provides a specific method for normalizing target coordinate values ​​to obtain target floating-point coordinate values, including:

[0082] Divide the x-coordinate of the target coordinates by the width of the corrected image, and divide the y-coordinate of the target coordinates by the height of the corrected image to obtain the target floating-point coordinates.

[0083] The corrected image is the same size as the display area of ​​the target display surface, and the display area is the region where the corrected image is displayed. The width of the corrected image is the same as the width of the display area of ​​the target display surface, and the height of the corrected image is the same as the height of the display area of ​​the target display surface. For example, if both the width and height of the corrected image are 200, then the x-coordinate value of the target coordinates is divided by 200, and the y-coordinate value of the target coordinates is also divided by 200 to obtain the target floating-point coordinates.

[0084] S302: Multiply the x-coordinate value of the target floating-point coordinates by the first preset coefficient and round down to obtain the first integer value.

[0085] Since the x-coordinate and y-coordinate of the target floating-point coordinates both range from [0,1], while the pixel values ​​of each channel in RGBA range from [0,255], in order to ensure that the target floating-point coordinates are fully mapped to the four RGBA channels, both the x-coordinate and y-coordinate values ​​of the target floating-point coordinates are multiplied by a first preset coefficient and rounded. In this step, the x-coordinate value of the target floating-point coordinates is first multiplied by the first preset coefficient and rounded to obtain the first integer value.

[0086] As an alternative example, the x-coordinate of the target floating-point coordinate can be stored using any two pixel channels of RGBA, and the y-coordinate can be stored using the other two pixel channels of RGBA. In this way, all four pixel channels of RGBA are used, ensuring a relatively accurate mapping of the target floating-point coordinate to the pixel values ​​of the four RGBA channels.

[0087] As an optional example, when all four pixel channels of RGBA are used to store the target floating-point coordinate value, that is, when any two pixel channels of RGBA are used to store the x-coordinate value of the target floating-point coordinate value and the other two pixel channels of RGBA are used to store the y-coordinate value of the target floating-point coordinate value, the first preset coefficient can be set to 65536. The target floating-point coordinate value is represented by (x, y), then the first integer value is [65536*x], where [] indicates rounding.

[0088] S303: Convert the first integer value to the pixel values ​​of any two pixel channels in the RGBA pixel value.

[0089] It is understood that the embodiments of this application do not limit any two pixel channels in the RGBA pixel value. For example, any two pixel channels in the RGBA pixel value are the R channel and the G channel.

[0090] In one possible implementation, this application provides a specific method for converting a first integer value into pixel values ​​of any two pixel channels in an RGBA pixel value, including:

[0091] Use the high-order bits of the first integer value as the pixel value of any one pixel channel in the RGBA pixel value, and use the low-order bits of the first integer value as the pixel value of the other pixel channel in the RGBA pixel value.

[0092] The high-order bits can be the high 8 bits, and the low-order bits can be the low 8 bits. For example, when any two pixel channels in an RGBA pixel value are the R channel and the G channel, where one pixel channel in the RGBA pixel value is the R channel and the other pixel channel in the RGBA pixel value is the G channel, then the high-order bits of the first integer value are used as the pixel value of the R channel, and the low-order bits of the first integer value are used as the pixel value of the G channel.

[0093] S304: Multiply the vertical coordinate value of the target floating-point coordinate value by the first preset coefficient and round it to obtain the second integer value.

[0094] As an optional example, the first preset coefficient is 65536. For example, if the target floating-point coordinates are (x, y), then the second integer value is [65536*y], where [] indicates rounding.

[0095] S305: Convert the second integer value into the pixel values ​​of the other two pixel channels in the RGBA pixel value, and generate the RGBA pixel value corresponding to the target coordinate value.

[0096] It is understood that the embodiments of this application do not limit the other two pixel channels in the RGBA pixel value. For example, when any two pixel channels in the RGBA pixel value are the R channel and the G channel, the other two pixel channels in the RGBA pixel value are the B channel and the A channel.

[0097] In one possible implementation, this application provides a specific method for converting a second integer value into pixel values ​​of the other two pixel channels in the RGBA pixel value to generate the RGBA pixel value corresponding to the target coordinate value, including:

[0098] Use the high-order bits of the second integer value as the pixel value of any other pixel channel in the RGBA pixel value, and use the low-order bits of the second integer value as the pixel value of the last pixel channel in the RGBA pixel value.

[0099] In this context, the high-order bits can be the high 8 bits, and the low-order bits can be the low 8 bits. For example, when the other two pixel channels in an RGBA pixel value are channel B and channel A, any other pixel channel in the RGBA pixel value is channel B, and the last pixel channel in the RGBA pixel value is channel A. Then, the high-order bits of the second integer value are used as the pixel value of channel B, and the low-order bits of the second integer value are used as the pixel value of channel A.

[0100] Based on the content of S301-S305, the target coordinate values ​​are first normalized to obtain target floating-point coordinate values. Then, the x-coordinate and y-coordinate values ​​of the target floating-point coordinate values ​​are multiplied by a first preset coefficient and rounded to obtain a first integer value and a second integer value. The first integer value is converted into the pixel value of any two pixel channels in the RGBA pixel value set, and the second integer value is converted into the pixel value of the other two pixel channels in the RGBA pixel value set. In this way, the RGBA pixel values ​​corresponding to the target coordinate values ​​are obtained, ensuring that the generated RGBA pixel values ​​can accurately represent the target coordinate values.

[0101] See Figure 4 , Figure 4 A flowchart illustrating the generation process of RGBA pixel values ​​for another distorted texture object provided in this application embodiment. In one possible implementation, combined with... Figure 4 This application provides a specific implementation of the process for generating RGBA pixel values ​​of a distorted texture object, specifically including steps S401-S406:

[0102] S401: Normalize the target coordinate values ​​to obtain the target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix.

[0103] For ease of explanation, each coordinate value in the distortion matrix is ​​represented by the target coordinate value. The target coordinate values ​​in the distortion matrix are then normalized to obtain the target floating-point coordinate values, where the x and y coordinates range from [0,1].

[0104] In one possible implementation, this application provides a specific method for normalizing target coordinate values ​​to obtain target floating-point coordinate values, including:

[0105] Divide the x-coordinate of the target coordinates by the width of the corrected image, and divide the y-coordinate of the target coordinates by the height of the corrected image to obtain the target floating-point coordinates.

[0106] The corrected image is the same size as the display area of ​​the target display surface, and the display area is the region where the corrected image is displayed. The width of the corrected image is the same as the width of the display area of ​​the target display surface, and the height of the corrected image is the same as the height of the display area of ​​the target display surface. For example, if both the width and height of the corrected image are 200, then the x-coordinate value of the target coordinates is divided by 200, and the y-coordinate value of the target coordinates is also divided by 200 to obtain the target floating-point coordinates.

[0107] S402: Multiply the x-coordinate value of the target floating-point coordinates by the second preset coefficient and round down to obtain the third integer value.

[0108] Since the x-coordinate and y-coordinate of the target floating-point coordinates both range from [0,1], while the pixel values ​​of each channel in RGBA range from [0,255], in order to ensure that the target floating-point coordinates are fully mapped to the RGBA channels, both the x-coordinate and y-coordinate values ​​of the target floating-point coordinates are multiplied by a second preset coefficient and rounded. In this step, the x-coordinate value of the target floating-point coordinates is first multiplied by the second preset coefficient and rounded to obtain the third integer value.

[0109] As an alternative example, one pixel channel from RGBA can be used to store the x-coordinate of the target floating-point coordinate, and another pixel channel from RGBA can be used to store the y-coordinate. The other two pixel channels in the RGBA pixel value are not used. In this way, only two of the four pixel channels of RGBA are used, which can reduce the amount of subsequent calculations.

[0110] As an optional example, when storing the x-coordinate of the target floating-point coordinate value using one pixel channel of RGBA and storing the y-coordinate of the target floating-point coordinate value using another pixel channel of RGBA, the second preset coefficient is set to 65536 / 2, meaning the first preset coefficient is twice the second preset coefficient. If the target floating-point coordinate value is represented by (x, y), then the third integer value is [32768*x], where [] indicates rounding.

[0111] S403: Use the third integer value as the pixel value of any pixel channel in the RGBA pixel value.

[0112] It is understood that the embodiments of this application do not limit any pixel channel in the RGBA pixel values. For example, if any pixel channel in the RGBA pixel values ​​is the R channel, the third integer value is used as the pixel value of the R channel.

[0113] S404: Multiply the vertical coordinate value of the target floating-point coordinate value by the second preset coefficient and round it to obtain the fourth integer value.

[0114] As an optional example, the second preset coefficient is 32768. For example, if the target floating-point coordinates are (x, y), then the fourth integer value is [32768*y], where [] indicates rounding.

[0115] S405: Use the fourth integer value as the pixel value of another pixel channel in the RGBA pixel value.

[0116] It is understood that the embodiments of this application do not limit the other pixel channel in the RGBA pixel value. For example, when any pixel channel in the RGBA pixel value is the R channel, and the other pixel channel in the RGBA pixel value is the G channel, the fourth integer value is used as the pixel value of the G channel.

[0117] S406: Set the pixel values ​​of the other two pixel channels in the RGBA pixel value to zero, and generate the RGBA pixel value corresponding to the target coordinate value.

[0118] In this step, since the other two pixel channels in the RGBA pixel value are not used to store the target coordinate value, their pixel values ​​are set to zero. Therefore, the RGBA pixel value corresponding to the target coordinate value can be obtained based on the pixel value of any one pixel channel in the RGBA pixel value, the pixel value of the other pixel channel in the RGBA pixel value, and the other two pixel channels in the RGBA pixel value that are set to zero.

[0119] Based on the content of S401-S406, the target coordinate values ​​are normalized to obtain target floating-point coordinate values. Then, the x-coordinate and y-coordinate values ​​of the target floating-point coordinate values ​​are multiplied by a second preset coefficient and rounded to obtain a third and fourth integer value. The third integer value is converted to the pixel value of any one pixel channel in the RGBA pixel value set, and the fourth integer value is converted to the pixel value of another pixel channel in the RGBA pixel value set. The pixel values ​​of the other two pixel channels in the RGBA pixel value set are set to zero. In this way, the RGBA pixel values ​​corresponding to the target coordinate values ​​are obtained, making the representation of the generated RGBA pixel values ​​relatively simple and convenient for subsequent calculations.

[0120] Based on the content of S301-S305, in one possible implementation, this application embodiment provides a specific implementation method for resolving the RGBA pixel values ​​of a distorted texture object into resolved coordinate values, including:

[0121] A1: Read the pixel values ​​of the two pixel channels corresponding to the first integer value and the pixel values ​​of the two pixel channels corresponding to the second integer value from the target RGBA pixel values ​​to obtain the first integer value and the second integer value; the target RGBA pixel values ​​are each RGBA pixel value in the distorted texture object.

[0122] For ease of explanation, each RGBA pixel value in the distorted texture object is defined as the target RGBA pixel value, and the explanation will focus on the target RGBA pixel value. Based on the content of S301-S305, the target RGBA pixel value can be obtained from a first integer value and a second integer value. Therefore, after obtaining the target RGBA pixel value, it can be parsed to obtain the first integer value and the second integer value. Specifically, the pixel values ​​of the two pixel channels corresponding to the first integer value and the pixel values ​​of the two pixel channels corresponding to the second integer value are read from the target RGBA pixel value to obtain the first integer value and the second integer value.

[0123] As an optional example, this application provides a specific implementation of A1, including:

[0124] Read the pixel value of the pixel channel corresponding to the low bit of the first integer value from the target RGBA pixel value to obtain the low bit of the first integer value. Read the pixel value of the pixel channel corresponding to the high bit of the first integer value to obtain the high bit of the first integer value. Concatenate the low bit and the high bit of the first integer value to obtain the first integer value.

[0125] Read the pixel value of the pixel channel corresponding to the low byte of the second integer value from the target RGBA pixel value to obtain the low byte of the second integer value. Read the pixel value of the pixel channel corresponding to the high byte of the second integer value to obtain the high byte of the second integer value. Concatenate the low byte of the second integer value and the high byte of the second integer value to obtain the second integer value.

[0126] A2: Divide the first integer value by the first preset coefficient to obtain the first horizontal axis value, and divide the second integer value by the first preset coefficient to obtain the first vertical axis value.

[0127] As shown in S302 and S304, the first integer value and the second integer value are calculated based on the first preset coefficient. Therefore, after obtaining the first integer value and the second integer value, the first integer value is divided by the first preset coefficient to obtain the first horizontal axis value, and the second integer value is divided by the first preset coefficient to obtain the first vertical axis value.

[0128] It is understandable that the process of obtaining the first horizontal coordinate value and the first vertical coordinate value in this step can be regarded as the reverse process of S302 and S304.

[0129] A3: Multiply the first horizontal coordinate value by the width of the corrected image, and multiply the first vertical coordinate value by the height of the corrected image to obtain the parsed coordinate values ​​corresponding to the target RGBA pixel values.

[0130] As shown in S301, the first horizontal and vertical coordinates can be understood as floating-point coordinates. Based on the width and height of the corrected image, the original coordinates in the distortion matrix can be obtained. Therefore, multiplying the first horizontal coordinate by the width of the corrected image and multiplying the first vertical coordinate by the height of the corrected image yields the parsed coordinates corresponding to the target RGBA pixel values.

[0131] Based on the content of A1-A3, the parsed coordinate values ​​can be obtained by parsing the RGBA pixel values ​​included in the distorted texture object. It can be understood that the process of generating the parsed coordinate values ​​corresponding to the target RGBA pixel values ​​through A1-A3 can be seen as the reverse process of generating the RGBA pixel values ​​corresponding to the target coordinate values ​​in S301-S305.

[0132] Based on the content of S401-S406, in one possible implementation, this application embodiment provides another specific implementation for resolving the RGBA pixel values ​​of a distorted texture object into resolved coordinate values, including:

[0133] B1: Read the pixel value of the pixel channel corresponding to the third integer value and the pixel value of the pixel channel corresponding to the fourth integer value from the target RGBA pixel value to obtain the third integer value and the fourth integer value; the target RGBA pixel value is each RGBA pixel value in the distorted texture object.

[0134] For ease of explanation, each RGBA pixel value in the distorted texture object is defined as the target RGBA pixel value, and the explanation will focus on the target RGBA pixel value. Based on the content of S401-S306, it is known that the target RGBA pixel value can be obtained from the third integer value and the fourth integer value. Therefore, after obtaining the target RGBA pixel value, it can be parsed to obtain the third integer value and the fourth integer value. Specifically, the pixel value of the pixel channel corresponding to the third integer value and the pixel value of the pixel channel corresponding to the fourth integer value are read from the target RGBA pixel value to obtain the third integer value and the fourth integer value.

[0135] B2: Divide the third integer value by the second preset coefficient to obtain the second horizontal axis value, and divide the fourth integer value by the second preset coefficient to obtain the second vertical axis value.

[0136] According to S402 and S404, the third and fourth integer values ​​are calculated based on the second preset coefficient. Therefore, after obtaining the third and fourth integer values, the third integer value is divided by the second preset coefficient to obtain the second horizontal axis value, and the fourth integer value is divided by the second preset coefficient to obtain the second vertical axis value.

[0137] It is understandable that the process of obtaining the second horizontal coordinate value and the second vertical coordinate value in this step can be regarded as the reverse process of S402 and S404.

[0138] B3: Multiply the second horizontal coordinate value by the width of the corrected image, and multiply the second vertical coordinate value by the height of the corrected image to obtain the parsed coordinate values ​​corresponding to the target RGBA pixel values.

[0139] As shown in S401, the second horizontal and vertical coordinates can be understood as floating-point coordinates. Based on the width and height of the corrected image, the original coordinates in the distortion matrix can be obtained. Therefore, multiplying the second horizontal coordinate by the width of the corrected image and multiplying the second vertical coordinate by the height of the corrected image yields the parsed coordinates corresponding to the target RGBA pixel values.

[0140] Based on the content of B1-B3, the parsed coordinate values ​​can be obtained by parsing the RGBA pixel values ​​included in the distorted texture object. It can be understood that the process of generating the parsed coordinate values ​​corresponding to the target RGBA pixel values ​​through B1-B3 can be seen as the reverse process of generating the RGBA pixel values ​​corresponding to the target coordinate values ​​in S401-S406.

[0141] Based on the image distortion correction method provided in the above-described method embodiments, this application also provides an image distortion correction apparatus, which will be described below with reference to the accompanying drawings.

[0142] See Figure 5 The figure is a schematic diagram of the structure of an image distortion correction device provided in an embodiment of this application. This device is applied to an image processor GPU. Figure 5 As shown, the image distortion correction device includes:

[0143] The reading unit 501 is used to read the distortion texture object corresponding to the distortion matrix. The distortion matrix includes multiple coordinate values, and the distortion texture object includes multiple RGBA pixel values. The coordinate values ​​included in the distortion matrix correspond one-to-one with the RGBA pixel values ​​included in the distortion texture object. The RGBA pixel values ​​included in the distortion texture object are generated based on the corresponding coordinate values.

[0144] The parsing unit 502 is used to parse the RGBA pixel values ​​included in the distorted texture object into parsed coordinate values;

[0145] The generation unit 503 is used to sample the target image based on the parsed coordinate values ​​to generate a distortion-corrected image.

[0146] In one possible implementation, the apparatus further includes a pixel value generation unit, the pixel value generation unit being used to generate RGBA pixel values ​​included in the distorted texture object; the pixel value generation unit includes:

[0147] The first normalization subunit is used to normalize the target coordinate values ​​to obtain target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix.

[0148] The first acquisition subunit is used to multiply the horizontal coordinate value of the target floating-point coordinate value by a first preset coefficient and round it to obtain a first integer value;

[0149] A conversion subunit is used to convert the first integer value into pixel values ​​of any two pixel channels in the RGBA pixel value;

[0150] The second acquisition subunit is used to multiply the ordinate value in the target floating-point coordinate value by the first preset coefficient and round it to obtain a second integer value.

[0151] The first generation subunit is used to convert the second integer value into pixel values ​​of the other two pixel channels in the RGBA pixel value, and generate the RGBA pixel value corresponding to the target coordinate value.

[0152] In one possible implementation, the first conversion subunit is specifically used for:

[0153] The high-order bits of the first integer value are used as the pixel value of any one pixel channel in the RGBA pixel value, and the low-order bits of the first integer value are used as the pixel value of the other pixel channel in the RGBA pixel value.

[0154] The first generating subunit is specifically used for:

[0155] Use the high-order bits of the second integer value as the pixel value of any other pixel channel in the RGBA pixel value, and use the low-order bits of the second integer value as the pixel value of the last pixel channel in the RGBA pixel value.

[0156] In one possible implementation, the apparatus further includes a pixel value generation unit, the pixel value generation unit being used to generate RGBA pixel values ​​included in the distorted texture object; the pixel value generation unit includes:

[0157] The second normalization subunit is used to normalize the target coordinate values ​​to obtain target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix.

[0158] The third acquisition subunit is used to multiply the horizontal coordinate value of the target floating-point coordinate value by a second preset coefficient and round it to obtain a third integer value.

[0159] The first determining subunit is used to take the third integer value as the pixel value of any pixel channel in the RGBA pixel value;

[0160] The fourth acquisition subunit is used to multiply the ordinate value in the target floating-point coordinate value by the second preset coefficient and round it to obtain a fourth integer value;

[0161] The second determining subunit is used to take the fourth integer value as the pixel value of another pixel channel in the RGBA pixel value;

[0162] The second generation subunit is used to set the pixel values ​​of the other two pixel channels in the RGBA pixel value to zero, and generate the RGBA pixel value corresponding to the target coordinate value.

[0163] In one possible implementation, the first normalization subunit or the second normalization subunit is specifically used for:

[0164] Divide the x-coordinate value of the target coordinates by the width of the corrected image, and divide the y-coordinate value of the target coordinates by the height of the corrected image to obtain the target floating-point coordinates.

[0165] In one possible implementation, the parsing unit 502 includes:

[0166] The first reading subunit is used to read the pixel values ​​of the two pixel channels corresponding to the first integer value and the pixel values ​​of the two pixel channels corresponding to the second integer value from the target RGBA pixel value, so as to obtain the first integer value and the second integer value; the target RGBA pixel value is each RGBA pixel value in the distorted texture object;

[0167] The fifth acquisition subunit is used to divide the first integer value by the first preset coefficient to obtain the first horizontal coordinate value, and divide the second integer value by the first preset coefficient to obtain the first vertical coordinate value;

[0168] The sixth acquisition subunit is used to multiply the first horizontal coordinate value by the width of the corrected image and multiply the first vertical coordinate value by the height of the corrected image to obtain the parsed coordinate value corresponding to the target RGBA pixel value.

[0169] In one possible implementation, the parsing unit 502 includes:

[0170] The second reading subunit is used to read the pixel value of the pixel channel corresponding to the third integer value and the pixel value of the pixel channel corresponding to the fourth integer value from the target RGBA pixel value, so as to obtain the third integer value and the fourth integer value; the target RGBA pixel value is each RGBA pixel value in the distorted texture object;

[0171] The seventh acquisition subunit is used to divide the third integer value by the second preset coefficient to obtain the second horizontal coordinate value, and divide the fourth integer value by the second preset coefficient to obtain the second vertical coordinate value;

[0172] The eighth acquisition subunit is used to multiply the second horizontal coordinate value by the width of the corrected image and multiply the second vertical coordinate value by the height of the corrected image to obtain the parsed coordinate value corresponding to the target RGBA pixel value.

[0173] In addition, embodiments of this application also provide an electronic device, including: 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, it implements the image distortion correction method as described in any of the preceding claims.

[0174] In addition, embodiments of this application also provide a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to perform the image distortion correction method as described in any of the preceding claims.

[0175] This application provides an image distortion correction apparatus and device, and the image distortion correction method is applied to an image processor (GPU). The distortion matrix includes multiple coordinate values. Based on the coordinate values ​​of the distortion matrix, corresponding RGBA pixel values ​​are generated, and the generated multiple RGBA pixel values ​​form a distortion texture object. Based on this, the GPU can read the distortion texture object corresponding to the distortion matrix and parse the RGBA pixel values ​​included in the distortion texture object into coordinate values. Then, the GPU samples the target image according to the parsed coordinate values ​​to generate a distortion-corrected image. Since the GPU has pixel-parallel processing capabilities, the sampling speed can be improved when the GPU samples the target image according to the parsed coordinate values, thus enabling faster generation of the distortion-corrected image. This increases the speed of generating the distortion-corrected image, resulting in faster rendering speed and higher rendering efficiency for the target image.

[0176] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems or apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.

[0177] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0178] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0179] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0180] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for image distortion correction, characterized in that, The method is applied to a graphics processing unit (GPU), and the method includes: Read the distortion texture object corresponding to the distortion matrix. The distortion matrix includes multiple coordinate values, and the distortion texture object includes multiple RGBA pixel values. The coordinate values ​​included in the distortion matrix correspond one-to-one with the RGBA pixel values ​​included in the distortion texture object. The RGBA pixel values ​​included in the distortion texture object are generated based on the corresponding coordinate values. The RGBA pixel values ​​included in the distorted texture object are parsed into parsed coordinate values; The target image is sampled based on the parsed coordinate values ​​to generate a distortion-corrected image; The generation process of the RGBA pixel values ​​included in the distorted texture object includes: The target coordinate values ​​are normalized to obtain target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix. Multiply the x-coordinate value of the target floating-point coordinates by a first preset coefficient and round down to obtain the first integer value; Convert the first integer value into the pixel values ​​of any two pixel channels in the RGBA pixel value; Multiply the vertical coordinate value of the target floating-point coordinate value by the first preset coefficient and round it to obtain the second integer value; The second integer value is converted into the pixel values ​​of the other two pixel channels in the RGBA pixel value to generate the RGBA pixel value corresponding to the target coordinate value; Alternatively, the process of generating the RGBA pixel values ​​included in the distorted texture object includes: The target coordinate values ​​are normalized to obtain target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix. Multiply the x-coordinate value of the target floating-point coordinates by a second preset coefficient and round down to obtain a third integer value; The third integer value is used as the pixel value of any pixel channel in the RGBA pixel value; Multiply the ordinate value of the target floating-point coordinates by the second preset coefficient and round down to obtain the fourth integer value; Use the fourth integer value as the pixel value of another pixel channel in the RGBA pixel value; Set the pixel values ​​of the other two pixel channels in the RGBA pixel value to zero to generate the RGBA pixel value corresponding to the target coordinate value.

2. The method according to claim 1, characterized in that, The step of converting the first integer value into pixel values ​​of any two pixel channels in the RGBA pixel value includes: The high-order bits of the first integer value are used as the pixel value of any one pixel channel in the RGBA pixel value, and the low-order bits of the first integer value are used as the pixel value of the other pixel channel in the RGBA pixel value. The step of converting the second integer value into pixel values ​​of the other two pixel channels in the RGBA pixel value to generate the RGBA pixel value corresponding to the target coordinate value includes: Use the high-order bits of the second integer value as the pixel value of any other pixel channel in the RGBA pixel value, and use the low-order bits of the second integer value as the pixel value of the last pixel channel in the RGBA pixel value.

3. The method according to claim 1, characterized in that, The step of normalizing the target coordinate values ​​to obtain the target floating-point coordinate values ​​includes: Divide the x-coordinate value of the target coordinates by the width of the corrected image, and divide the y-coordinate value of the target coordinates by the height of the corrected image to obtain the target floating-point coordinates.

4. The method according to claim 1 or 2, characterized in that, The step of resolving the RGBA pixel values ​​of the distorted texture object into resolved coordinate values ​​includes: The first integer value and the second integer value are obtained by reading the pixel values ​​of the two pixel channels corresponding to the first integer value and the two pixel channels corresponding to the second integer value from the target RGBA pixel value; the target RGBA pixel value is each RGBA pixel value in the distorted texture object. Divide the first integer value by the first preset coefficient to obtain the first horizontal axis value, and divide the second integer value by the first preset coefficient to obtain the first vertical axis value; Multiply the first horizontal coordinate value by the width of the corrected image, and multiply the first vertical coordinate value by the height of the corrected image to obtain the parsed coordinate value corresponding to the target RGBA pixel value.

5. The method according to claim 1, characterized in that, The step of resolving the RGBA pixel values ​​of the distorted texture object into resolved coordinate values ​​includes: The pixel values ​​of the pixel channels corresponding to the third integer value and the pixel channels corresponding to the fourth integer value are read from the target RGBA pixel values ​​to obtain the third integer value and the fourth integer value; the target RGBA pixel values ​​are each RGBA pixel value in the distorted texture object; Divide the third integer value by the second preset coefficient to obtain the second horizontal axis value, and divide the fourth integer value by the second preset coefficient to obtain the second vertical axis value; Multiply the second horizontal coordinate value by the width of the corrected image, and multiply the second vertical coordinate value by the height of the corrected image to obtain the parsed coordinate value corresponding to the target RGBA pixel value.

6. An image distortion correction device, characterized in that, The device is used in a graphics processing GPU, and the device includes: The reading unit is used to read the distortion texture object corresponding to the distortion matrix. The distortion matrix includes multiple coordinate values, and the distortion texture object includes multiple RGBA pixel values. The coordinate values ​​included in the distortion matrix correspond one-to-one with the RGBA pixel values ​​included in the distortion texture object. The RGBA pixel values ​​included in the distortion texture object are generated based on the corresponding coordinate values. The parsing unit is used to parse the RGBA pixel values ​​included in the distorted texture object into parsed coordinate values; The generation unit is used to sample the target image based on the parsed coordinate values ​​to generate a distortion-corrected image; A pixel value generation unit is used to generate the RGBA pixel values ​​included in the distorted texture object; The pixel value generation unit includes: The first normalization subunit is used to normalize the target coordinate values ​​to obtain target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix. The first acquisition subunit is used to multiply the horizontal coordinate value of the target floating-point coordinate value by a first preset coefficient and round it to obtain a first integer value; A conversion subunit is used to convert the first integer value into pixel values ​​of any two pixel channels in the RGBA pixel value; The second acquisition subunit is used to multiply the ordinate value in the target floating-point coordinate value by the first preset coefficient and round it to obtain a second integer value. The first generation subunit is used to convert the second integer value into pixel values ​​of the other two pixel channels in the RGBA pixel value, and generate the RGBA pixel value corresponding to the target coordinate value; Alternatively, the pixel value generation unit includes: The second normalization subunit is used to normalize the target coordinate values ​​to obtain target floating-point coordinate values; the target coordinate values ​​are each coordinate value in the distortion matrix. The third acquisition subunit is used to multiply the horizontal coordinate value of the target floating-point coordinate value by a second preset coefficient and round it to obtain a third integer value. The first determining subunit is used to take the third integer value as the pixel value of any pixel channel in the RGBA pixel value; The fourth acquisition subunit is used to multiply the ordinate value in the target floating-point coordinate value by the second preset coefficient and round it to obtain a fourth integer value; The second determining subunit is used to take the fourth integer value as the pixel value of another pixel channel in the RGBA pixel value; The second generation subunit is used to set the pixel values ​​of the other two pixel channels in the RGBA pixel value to zero, and generate the RGBA pixel value corresponding to the target coordinate value.

7. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the image distortion correction method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the image distortion correction method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Multichannel LED dome screen geometric correction method

    CN111192552A