A method, apparatus, electronic device and storage medium for image scaling

By completing the sub-pixel rendering arrangement data in the original image into a standard RGB arrangement and combining it with gamma correction processing, the problem of poor image scaling effect in the existing technology is solved, and high-quality image display is achieved.

CN114140328BActive Publication Date: 2025-10-28CHIP WEALTH TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111486085.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-07
Publication Date
2025-10-28
Estimated Expiration
2041-12-07

AI Technical Summary

Technical Problem

Existing image scaling algorithms have significant drawbacks in the display effect of the scaled target image when applied to SPR pixel data.

Method used

The original pixel data in the original image, which is rendered and arranged as subpixels, is padded to standard RGB pixel data, and then gamma correction is applied to determine the pixel data of the target image.

Benefits of technology

The image quality is improved after scaling, resulting in less distortion of the image displayed on the panel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114140328B_ABST
    Figure CN114140328B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, electronic device, and storage medium for image scaling, comprising: padding the original pixel data of the sub-pixel rendering arrangement in the original image to standard pixel data of the standard RGB arrangement; performing a first gamma correction on the standard pixel data to obtain first pixel data of the original image; determining second pixel data of the target image obtained after image scaling based on the first pixel data, the resolution of the original image, and the resolution of the target image; and performing a second gamma correction on the second pixel data to obtain display pixel data of the target image. In this way, the original pixel data of the sub-pixel rendering arrangement in the original image can be padded to standard pixel data of the standard RGB arrangement, and then the pixel data of the target image obtained after image scaling can be determined based on the standard pixel data, thereby improving the image quality obtained after scaling and reducing image distortion on the panel display.
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, and in particular to a method, apparatus, electronic device, and storage medium for image scaling. Background Technology

[0002] In computer image processing and computer graphics, image scaling refers to the process of adjusting the size of a digital image. The basic principle of image scaling is to obtain the pixel values ​​of the target image from the pixel values ​​of the original image using a certain algorithm. With the advent of AMOLED panels (Active Matrix / Organic Light Emitting Diode), the original image that needs to be scaled has added the data type of SPR pixel arrangement (Sub-Pixel Rendering).

[0003] Existing image scaling algorithms have significant drawbacks in displaying the scaled target image when applied to pixel data with SPR arrangement. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a method, apparatus, electronic device, and storage medium for image scaling, which can complete the original pixel data of the sub-pixel rendering arrangement in the original image into standard RGB arrangement pixel data, and then determine the pixel data of the target image obtained after image scaling based on the standard pixel data. This improves the quality of the scaled image and reduces image distortion on the panel display.

[0005] This application provides an image scaling method, the method comprising:

[0006] The original pixel data in the original image, which is rendered and arranged as sub-pixels, is padded to standard pixel data arranged in standard RGB;

[0007] Perform a first gamma correction on the standard pixel data to obtain the first pixel data of the original image;

[0008] Based on the first pixel data, the resolution of the original image, and the resolution of the target image, the second pixel data of the target image obtained after image scaling is determined;

[0009] The second pixel data is subjected to a second gamma correction to obtain the display pixel data of the target image.

[0010] Furthermore, the step of padding the original pixel data in the original image with sub-pixel rendering arrangement to standard pixel data in standard RGB arrangement includes:

[0011] For each pixel in the original image, the pixel data of the missing sub-pixels in that pixel is completed based on the pixel data of the other pixels adjacent to that pixel.

[0012] Furthermore, the step of filling in the pixel data of missing sub-pixels in each pixel of the original image based on the pixel data of other pixels adjacent to that pixel includes:

[0013] For each missing sub-pixel in the pixel, if the pixel has only one adjacent other pixel in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined to be 0;

[0014] When a pixel has two adjacent pixels in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined as the average value of the sum of the sub-pixels in the other pixels; wherein the color corresponding to the sub-pixels in the other pixels is the same as the color corresponding to the sub-pixel.

[0015] Furthermore, determining the second pixel data of the scaled target image based on the first pixel data, the resolution of the original image, and the resolution of the target image includes:

[0016] Based on the resolution of the original image, the display area of ​​the original image is divided into at least one first image; wherein each first image corresponds to a first pixel of the original image;

[0017] Based on the resolution of the target image, the display area of ​​the original image is divided into at least one second image; wherein each second image corresponds to a second pixel of the target image;

[0018] For each second image, at least one first patch corresponding to the position of the second image is determined; wherein each first patch is a first image or a part of a first image;

[0019] The pixel value of the second pixel corresponding to the second image is determined based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs.

[0020] The pixel value of each second pixel is determined as the second pixel data of the target image.

[0021] Furthermore, determining the pixel value of the second pixel corresponding to the second image based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs, includes:

[0022] For each first image patch, determine the area ratio between the display area of ​​the first image patch and the display area of ​​the second image patch;

[0023] Determine the product of the area ratio and the pixel value of the first pixel corresponding to the first image to which the first patch belongs;

[0024] The sum of the products of each first patch is determined as the pixel value of the second pixel corresponding to the second image.

[0025] Furthermore, the gamma value of the first gamma correction is 2.2; the gamma value of the second gamma correction is 1 / 2.2.

[0026] This application also provides an image scaling apparatus, the apparatus comprising:

[0027] The completion module is used to complete the original pixel data in the original image, which is rendered and arranged as sub-pixels, into standard pixel data arranged in standard RGB.

[0028] The first correction module is used to perform a first gamma correction on the standard pixel data to obtain the first pixel data of the original image;

[0029] The determining module is used to determine the second pixel data of the target image obtained after image scaling based on the first pixel data, the resolution of the original image, and the resolution of the target image;

[0030] The second correction module is used to perform a second gamma correction on the second pixel data to obtain the display pixel data of the target image.

[0031] Furthermore, when the completion module is used to complete the original pixel data of the sub-pixel rendering arrangement in the original image into standard pixel data of standard RGB arrangement, the completion module is used to:

[0032] For each pixel in the original image, the pixel data of the missing sub-pixels in that pixel is completed based on the pixel data of the other pixels adjacent to that pixel.

[0033] Furthermore, when the completion module is used to complete the pixel data of missing sub-pixels in each pixel of the original image based on the pixel data of other pixels adjacent to that pixel, the completion module is used to:

[0034] For each missing sub-pixel in the pixel, if the pixel has only one adjacent other pixel in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined to be 0;

[0035] When a pixel has two adjacent pixels in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined as the average value of the sum of the sub-pixels in the other pixels; wherein the color corresponding to the sub-pixels in the other pixels is the same as the color corresponding to the sub-pixel.

[0036] Furthermore, when the determining module determines the second pixel data of the target image obtained after image scaling based on the first pixel data, the resolution of the original image, and the resolution of the target image, the determining module is used to:

[0037] Based on the resolution of the original image, the display area of ​​the original image is divided into at least one first image; wherein each first image corresponds to a first pixel of the original image;

[0038] Based on the resolution of the target image, the display area of ​​the original image is divided into at least one second image; wherein each second image corresponds to a second pixel of the target image;

[0039] For each second image, at least one first patch corresponding to the position of the second image is determined; wherein each first patch is a first image or a part of a first image;

[0040] The pixel value of the second pixel corresponding to the second image is determined based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs.

[0041] The pixel value of each second pixel is determined as the second pixel data of the target image.

[0042] Furthermore, when determining the pixel value of the second pixel corresponding to the second image based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs, the determining module is configured to:

[0043] For each first image patch, determine the area ratio between the display area of ​​the first image patch and the display area of ​​the second image patch;

[0044] Determine the product of the area ratio and the pixel value of the first pixel corresponding to the first image to which the first patch belongs;

[0045] The sum of the products of each first patch is determined as the pixel value of the second pixel corresponding to the second image.

[0046] Furthermore, the gamma value of the first gamma correction is 2.2; the gamma value of the second gamma correction is 1 / 2.2.

[0047] This application also provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the method described above are performed.

[0048] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the method described above.

[0049] This application provides an image scaling method, apparatus, electronic device, and storage medium. The method involves: padding the original pixel data (in the sub-pixel rendering arrangement) of the original image with standard RGB pixel data; performing a first gamma correction on the standard pixel data to obtain the first pixel data of the original image; determining the second pixel data of the target image after image scaling based on the first pixel data, the resolution of the original image, and the resolution of the target image; and performing a second gamma correction on the second pixel data to obtain the display pixel data of the target image.

[0050] In this way, the original pixel data of the sub-pixel rendering arrangement in the original image can be completed into standard RGB arrangement standard pixel data. Then, the pixel data of the target image obtained after image scaling is determined based on the standard pixel data, so as to improve the image quality obtained after scaling and make the image displayed on the panel less distorted.

[0051] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0052] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0053] Figure 1 A flowchart of an image scaling method provided in an embodiment of this application is shown;

[0054] Figures 2(a) to (c) show schematic diagrams illustrating the principle of an image scaling method provided in the embodiments of this application;

[0055] Figure 3 A schematic diagram of the structure of an image scaling device provided in an embodiment of this application is shown;

[0056] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.

[0058] First, the applicable scenarios for this application will be introduced. This application can be applied to the field of image processing technology.

[0059] Research has revealed that the advent of AMOLED (Active Matrix / Organic Light Emitting Diode) panels has introduced SPR (Sub-Pixel Rendering) data types into the original images required for scaling. Existing image scaling algorithms exhibit significant shortcomings in display quality when applied to SPR-arranged pixel data.

[0060] Based on this, embodiments of this application provide an image scaling method that can pad the original pixel data of the sub-pixel rendering arrangement in the original image to standard RGB arrangement pixel data, and then determine the pixel data of the target image obtained after image scaling based on the standard pixel data. This improves the quality of the scaled image and reduces image distortion on the panel display.

[0061] First, a brief introduction to the names involved in the embodiments of this application will be given.

[0062] Image scaling: In computer image processing and computer graphics, image scaling refers to the process of adjusting the size of a digital image. The basic principle of image scaling is to obtain the pixel values ​​of the target image from the pixel values ​​of the original image using a certain algorithm.

[0063] Pixel: The smallest unit that makes up an image.

[0064] Resolution: The number of pixels in an image, often expressed as the product of the number of rows and columns of pixels in the image.

[0065] Standard RGB arrangement: In standard RGB pixel data, each pixel is composed of sub-pixels of three colors: red (R), green (G), and blue (B). A wide variety of colors are obtained by changing the pixel values ​​of these three sub-pixels and by superimposing them on each other.

[0066] Sub-Pixel Rendering: With the advent of AMOLED panels, the SPR (Surface Placement) pixel data type was added to images. In SPR pixel data, the number of sub-pixels within a pixel is reduced, achieving higher resolution through sub-pixel rendering.

[0067] Please see Figure 1 , Figure 1 This is a flowchart illustrating an image scaling method provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the method includes:

[0068] S101. Complete the original pixel data of the sub-pixel rendering arrangement in the original image into standard pixel data of standard RGB arrangement.

[0069] In one possible implementation, step S101 includes:

[0070] For each pixel in the original image, the pixel data of the missing sub-pixels in that pixel is completed based on the pixel data of the other pixels adjacent to that pixel.

[0071] In this arrangement, pixels are arranged in a grid pattern in the image, and each pixel has other adjacent pixels. As mentioned earlier, in the SPR (Side Pixel Layout) pixel data, the number of sub-pixels within a pixel is reduced. Therefore, for each pixel, the pixel data of the missing sub-pixels in that pixel can be supplemented based on the pixel data of the other pixels adjacent to that pixel.

[0072] In one possible implementation, for each pixel in the original image, the pixel data of the missing sub-pixels in that pixel is completed based on the pixel data of other pixels adjacent to that pixel, including:

[0073] For each missing sub-pixel in the pixel, if the pixel has only one adjacent other pixel in the row direction of the pixel arrangement, the pixel value of the sub-pixel is determined to be 0;

[0074] When a pixel has two adjacent pixels in the row direction of the pixel arrangement, the pixel value of the sub-pixel is determined as the average value of the sum of the sub-pixels in the other pixels; wherein the color corresponding to the sub-pixels in the other pixels is the same as the color corresponding to the sub-pixel.

[0075] The following explanation uses one type of SPR pixel arrangement—RGBG pixel arrangement—as an example.

[0076] In the RGBG pixel arrangement (i.e., Samsung's Diamond arrangement), each pixel includes an R subpixel and a G subpixel, or a B subpixel and a G subpixel. Table 1 below shows the pixel data of two adjacent rows in the RGBG pixel arrangement.

[0077]

[0078] Table 1 shows the pixel data of two adjacent rows in the RGBG pixel arrangement.

[0079] In this text, the letters R, G, and B represent the colors corresponding to the subpixels. The subscript of each letter indicates the position of the pixel in the pixel arrangement. For example, Bi+1 1 represents the value of the blue subpixel located in the (i+1)th row and 1st column of the pixel arrangement in the image.

[0080] As can be seen, compared to the standard RGB arrangement, in the RGBG pixel arrangement, each pixel is missing one R sub-pixel or one B sub-pixel. Therefore, for any given pixel, the missing sub-pixel is filled in. In one possible implementation, when the pixel has only one adjacent pixel in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is set to 0; when the pixel has two adjacent pixels in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is set to the average of the sums of the sub-pixels of the other pixels; wherein the colors corresponding to the sub-pixels of the other pixels are the same as the colors corresponding to the current sub-pixel.

[0081] Corresponding to the example above, Table 2 below shows the pixel data of two adjacent rows after the RGBG pixel arrangement is completed into a standard RGB arrangement.

[0082]

[0083]

[0084] Table 2 shows the pixel data of two adjacent rows after RGBG pixel arrangement is completed in standard RGB arrangement.

[0085] It should be noted that, besides the RGBG pixel arrangement, pixel data from other types of SPR pixel arrangements can also be completed into standard RGB pixel data in a similar manner. The RGBG pixel arrangement is merely one possible implementation in the embodiments of this application, and this application does not impose any limitations on the specific type of SPR pixel arrangement.

[0086] In this way, by supplementing the original pixel data of the sub-pixel rendering arrangement in the original image with standard RGB arrangement pixel data, and then according to the subsequent image scaling operation, the quality of the scaled image can be improved, resulting in less image distortion in the panel display.

[0087] S102. Perform a first gamma correction on the standard pixel data to obtain the first pixel data of the original image.

[0088] Gamma correction compensates for the human eye's response to brightness, providing linearity for color balance when scaling image data. The gamma value for the first gamma correction is 2.2. The first pixel data of the original image is obtained by applying the first gamma correction to the data of each pixel in the standard pixel data.

[0089] S103. Based on the first pixel data, the resolution of the original image, and the resolution of the target image, determine the second pixel data of the target image obtained after image scaling.

[0090] In one possible implementation, step S103 includes:

[0091] S1031. Based on the resolution of the original image, the display area of ​​the original image is divided into at least one first image; wherein each first image corresponds to a first pixel of the original image.

[0092] S1032. Based on the resolution of the target image, the display area of ​​the original image is divided into at least one second image; wherein each second image corresponds to a second pixel of the target image.

[0093] S1033. For each second image, determine at least one first image block corresponding to the position of the second image; wherein each first image block is a first image or a part of a first image.

[0094] S1034. Based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs, determine the pixel value of the second pixel corresponding to the second image.

[0095] S1035. The pixel value of each second pixel is determined as the second pixel data of the target image.

[0096] Please refer to Figures 2(a) to (c), which are schematic diagrams illustrating the principle of an image scaling method provided in an embodiment of this application. The principle of an image scaling method provided in an embodiment of this application will be explained below with reference to Figures 2(a) to (c).

[0097] First, it should be noted that in image scaling, because the display panel is the same, the display area of ​​the original image before scaling and the target image after scaling are the same (i.e., the display areas overlap).

[0098] In one possible implementation, as described above, the display area of ​​the target image is the same as the display area of ​​the original image. For example, the large square areas of equal area enclosed by solid lines in Figures 2(a) and 2(b) represent this display area. It should be noted that the large square areas in Figures 2(a) and 2(b) are merely examples of display areas, and this application does not limit the shape of the display area. Assuming the resolution of the original image is 1920*1080, as mentioned earlier, this resolution means that there are 1920 rows and 1080 columns of pixels in the original image. As shown by the solid lines in Figure 2(a), the display area of ​​the original image is divided into 1920*1080 first images, each corresponding to a first pixel of the original image. Assuming the target image has a resolution of 1280*720, as mentioned earlier, this resolution means that there are 1280 rows and 720 columns of pixels in the target image; as shown by the dotted line in Figure 2(b), the display area of ​​the original image is divided into 1280*720 second images, and each second image corresponds to a second pixel of the original image.

[0099] Where 1280 / 1920 = 2 / 3 and 720 / 1080 = 2 / 3, the horizontal scaling ratio of the target image is 2 / 3 and the vertical scaling ratio is 2 / 3. It should be noted that the horizontal and vertical scaling ratios of the target image can be the same or different; this application does not impose any restrictions on this. Considering that the display area of ​​the original image before scaling and the target image after scaling is the same, with a horizontal scaling ratio of 2 / 3 and a vertical scaling ratio of 2 / 3, the display area corresponding to the four second images is the same as the area corresponding to the nine first images. For ease of explanation, Figure 2(c) shows the four second images in the display area and the nine first images corresponding to their positions.

[0100] For a second image a (shaded area in the figure) in Figure 2(c), the position of the second image a corresponds to the four first image blocks d1, d2, d3 and d4; where d1 is a first image; d2, d3 and d4 are each a part of a first image.

[0101] In one possible implementation, step S1034 includes:

[0102] Step 1: For each first image tile, determine the area ratio between the display area of ​​the first image tile and the display area of ​​the second image tile.

[0103] Step 2: Determine the product of the area ratio and the pixel value of the first pixel corresponding to the first image to which the first patch belongs.

[0104] Step 3: The sum of the products of each first image patch is determined as the pixel value of the second pixel corresponding to the second image.

[0105] Please refer to Figure 2(c). The area of ​​the display region of the second image a is Sa, and the areas of the display regions of the first image blocks d1, d2, d3, and d4 are Sd1, Sd2, Sd3, and Sd4, respectively; Sa = Sd1 + Sd2 + Sd3 + Sd4. The pixel values ​​of the first pixels corresponding to the first images to which the first image blocks d1, d2, d3, and d4 belong are D1, D2, D3, and D4, respectively. Based on the horizontal scaling ratio and vertical scaling ratio of the target image, the pixel value A of the second pixel corresponding to the second image a is:

[0106]

[0107] It should be noted that after the original pixel data is padded to standard RGB pixel data in step S101, each first pixel includes three sub-pixels, and each sub-pixel has a corresponding pixel value. The second pixel determined in the above manner also includes three second sub-pixels (R sub-pixel, G sub-pixel, and B sub-pixel). For any one of the second sub-pixels, when determining the pixel value of the second sub-pixel, the pixel values ​​D1, D2, D3, and D4 of the first pixel in the formula are the pixel values ​​of the sub-pixels in the first pixel that have the same color as the second sub-pixel. For example, when determining the pixel value A of the red sub-pixel (R sub-pixel) in the second pixel corresponding to the second image a, the pixel values ​​D1, D2, D3, and D4 are also the pixel values ​​of the red sub-pixel (R sub-pixel) in the corresponding first pixel. After determining the pixel value of each second sub-pixel in the second pixel, the pixel value of the second pixel is determined accordingly.

[0108] Furthermore, using a similar method, the pixel value of the second pixel corresponding to each second image can be determined, and the pixel value of each second pixel can be determined as the second pixel data of the target image.

[0109] S104. Perform a second gamma correction on the second pixel data to obtain the display pixel data of the target image.

[0110] The gamma value of the second gamma correction is 1 / 2.2.

[0111] It should be noted that after obtaining the display pixel data of the target image, since the obtained display pixel data of the target image is standard pixel data arranged in standard RGB, these display pixel data need to be re-rendered as subpixels when displayed on an AMOLED panel.

[0112] This application provides an image scaling method, comprising: padding the original pixel data of the original image with sub-pixel rendering arrangement to standard pixel data with standard RGB arrangement; performing a first gamma correction on the standard pixel data to obtain the first pixel data of the original image; determining the second pixel data of the target image obtained after image scaling based on the first pixel data, the resolution of the original image and the resolution of the target image; and performing a second gamma correction on the second pixel data to obtain the display pixel data of the target image.

[0113] In this way, the original pixel data of the sub-pixel rendering arrangement in the original image can be completed into standard RGB arrangement standard pixel data. Then, the pixel data of the target image obtained after image scaling is determined based on the standard pixel data, so as to improve the image quality obtained after scaling and make the image displayed on the panel less distorted.

[0114] Please refer to the figure. Figure 3 This is a schematic diagram of the structure of an image scaling device provided in an embodiment of this application. Figure 3 As shown, the device 300 includes:

[0115] The completion module 310 is used to complete the original pixel data of the sub-pixel rendering arrangement in the original image into standard pixel data of standard RGB arrangement.

[0116] The first correction module 320 is used to perform a first gamma correction on the standard pixel data to obtain the first pixel data of the original image;

[0117] The determining module 330 is used to determine the second pixel data of the target image obtained after image scaling based on the first pixel data, the resolution of the original image and the resolution of the target image;

[0118] The second correction module 340 is used to perform a second gamma correction on the second pixel data to obtain the display pixel data of the target image.

[0119] Furthermore, when the completion module 310 is used to complete the original pixel data of the sub-pixel rendering arrangement in the original image into standard pixel data of standard RGB arrangement, the completion module 310 is used to:

[0120] For each pixel in the original image, the pixel data of the missing sub-pixels in that pixel is completed based on the pixel data of the other pixels adjacent to that pixel.

[0121] Furthermore, when the completion module 310 is used to complete the pixel data of missing sub-pixels in each pixel of the original image based on the pixel data of other pixels adjacent to that pixel, the completion module 310 is used to:

[0122] For each missing sub-pixel in the pixel, if the pixel has only one adjacent other pixel in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined to be 0;

[0123] When a pixel has two adjacent pixels in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined as the average value of the sum of the sub-pixels in the other pixels; wherein the color corresponding to the sub-pixels in the other pixels is the same as the color corresponding to the sub-pixel.

[0124] Furthermore, when determining the second pixel data of the target image obtained after image scaling based on the first pixel data, the resolution of the original image, and the resolution of the target image, the determining module 330 is used to:

[0125] Based on the resolution of the original image, the display area of ​​the original image is divided into at least one first image; wherein each first image corresponds to a first pixel of the original image;

[0126] Based on the resolution of the target image, the display area of ​​the original image is divided into at least one second image; wherein each second image corresponds to a second pixel of the target image;

[0127] For each second image, at least one first patch corresponding to the position of the second image is determined; wherein each first patch is a first image or a part of a first image;

[0128] The pixel value of the second pixel corresponding to the second image is determined based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs.

[0129] The pixel value of each second pixel is determined as the second pixel data of the target image.

[0130] Furthermore, when determining the pixel value of the second pixel corresponding to the second image based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs, the determining module 330 is used to:

[0131] For each first image patch, determine the area ratio between the display area of ​​the first image patch and the display area of ​​the second image patch;

[0132] Determine the product of the area ratio and the pixel value of the first pixel corresponding to the first image to which the first patch belongs;

[0133] The sum of the products of each first patch is determined as the pixel value of the second pixel corresponding to the second image.

[0134] Furthermore, the gamma value of the first gamma correction is 2.2; the gamma value of the second gamma correction is 1 / 2.2.

[0135] This application provides an image scaling apparatus, comprising: a completion module for completing the original pixel data of the original image with sub-pixel rendering arrangement into standard pixel data with standard RGB arrangement; a first correction module for performing a first gamma correction on the standard pixel data to obtain the first pixel data of the original image; a determination module for determining the second pixel data of the target image obtained after image scaling based on the first pixel data, the resolution of the original image, and the resolution of the target image; and a second correction module for performing a second gamma correction on the second pixel data to obtain the display pixel data of the target image.

[0136] In this way, the original pixel data of the sub-pixel rendering arrangement in the original image can be completed into standard RGB arrangement standard pixel data. Then, the pixel data of the target image obtained after image scaling is determined based on the standard pixel data, so as to improve the image quality obtained after scaling and make the image displayed on the panel less distorted.

[0137] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 400 includes a processor 410, a memory 420, and a bus 430.

[0138] The memory 420 stores machine-readable instructions executable by the processor 410. When the electronic device 400 is running, the processor 410 communicates with the memory 420 via the bus 430. When the machine-readable instructions are executed by the processor 410, they can perform the operations described above. Figure 1 The steps of the method in the method embodiment shown in Figure 2 can be found in the method embodiment for specific implementation, and will not be repeated here.

[0139] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 The steps of the method in the method embodiment shown in Figure 2 can be found in the method embodiment for specific implementation, and will not be repeated here.

[0140] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0141] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0142] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0143] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0144] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0145] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for image scaling, characterized in that, The method includes: The original pixel data in the original image, which is rendered and arranged as sub-pixels, is padded to standard pixel data arranged in standard RGB; Perform a first gamma correction on the standard pixel data to obtain the first pixel data of the original image; Based on the first pixel data, the resolution of the original image, and the resolution of the target image, the second pixel data of the target image obtained after image scaling is determined; Perform a second gamma correction on the second pixel data to obtain the display pixel data of the target image; The step of padding the original pixel data in the original image with sub-pixel rendering arrangement to standard RGB arrangement pixel data includes: For each pixel in the original image, the pixel data of the missing sub-pixels in the pixel is completed based on the pixel data of the other pixels adjacent to the pixel; wherein, the other pixels adjacent to the pixel are in the horizontal direction of the pixel; The step of filling in the missing sub-pixel data of each pixel in the original image based on the pixel data of other pixels adjacent to that pixel includes: For each missing sub-pixel in the pixel, if the pixel has only one adjacent other pixel in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined to be 0; When a pixel has two adjacent pixels in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined as the average value of the sum of the sub-pixels of the other pixels; wherein, the color corresponding to the sub-pixels of the other pixels is the same as the color corresponding to the sub-pixel. Determining the second pixel data of the scaled target image based on the first pixel data, the resolution of the original image, and the resolution of the target image includes: Based on the resolution of the original image, the display area of ​​the original image is divided into at least one first image; wherein each first image corresponds to a first pixel of the original image; Based on the resolution of the target image, the display area of ​​the original image is divided into at least one second image; wherein each second image corresponds to a second pixel of the target image; For each second image, at least one first patch corresponding to the position of the second image is determined; wherein each first patch is a first image or a part of a first image; The pixel value of the second pixel corresponding to the second image is determined based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs. The pixel value of each second pixel is determined as the second pixel data of the target image.

2. The method according to claim 1, characterized in that, The step of determining the pixel value of the second pixel corresponding to the second image based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs, includes: For each first image patch, determine the area ratio between the display area of ​​the first image patch and the display area of ​​the second image patch; Determine the product of the area ratio and the pixel value of the first pixel corresponding to the first image to which the first patch belongs; The sum of the products of each first patch is determined as the pixel value of the second pixel corresponding to the second image.

3. The method according to claim 1, characterized in that, The gamma value of the first gamma correction is 2.2; the gamma value of the second gamma correction is 1 / 2.

2.

4. An image scaling device, characterized in that, The device includes: The completion module is used to complete the original pixel data in the original image, which is rendered and arranged as sub-pixels, into standard pixel data arranged in standard RGB. The first correction module is used to perform a first gamma correction on the standard pixel data to obtain the first pixel data of the original image; The determining module is used to determine the second pixel data of the target image obtained after image scaling based on the first pixel data, the resolution of the original image, and the resolution of the target image; The second correction module is used to perform a second gamma correction on the second pixel data to obtain the display pixel data of the target image; When the completion module is used to complete the original pixel data of the sub-pixel rendering arrangement in the original image into standard pixel data of standard RGB arrangement, the completion module is used for: For each pixel in the original image, the pixel data of the missing sub-pixels in the pixel is completed based on the pixel data of the other pixels adjacent to the pixel; the other pixels adjacent to the pixel are in the horizontal direction of the pixel; When the completion module is used to complete the pixel data of missing sub-pixels in each pixel of the original image based on the pixel data of other pixels adjacent to that pixel, the completion module is used to: For each missing sub-pixel in the pixel, if the pixel has only one adjacent other pixel in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined to be 0; When a pixel has two adjacent pixels in the horizontal direction of the pixel arrangement, the pixel value of the sub-pixel is determined as the average value of the sum of the sub-pixels of the other pixels; wherein, the color corresponding to the sub-pixels of the other pixels is the same as the color corresponding to the sub-pixel. When determining the second pixel data of the scaled target image based on the first pixel data, the resolution of the original image, and the resolution of the target image, the determining module is used to: Based on the resolution of the original image, the display area of ​​the original image is divided into at least one first image; wherein each first image corresponds to a first pixel of the original image; Based on the resolution of the target image, the display area of ​​the original image is divided into at least one second image; wherein each second image corresponds to a second pixel of the target image; For each second image, at least one first patch corresponding to the position of the second image is determined; wherein each first patch is a first image or a part of a first image; The pixel value of the second pixel corresponding to the second image is determined based on the display area of ​​each first patch corresponding to the position of the second image, the display area of ​​the second image, and the pixel value of the first pixel corresponding to the first image to which each first patch belongs. The pixel value of each second pixel is determined as the second pixel data of the target image.

5. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the machine-readable instructions are executed by the processor to perform the steps of the method as described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Display device making use of sub-pixel rendering method and sub-pixel rendering method

    CN105096755A

  • Image zooming display method and device and terminal equipment

    CN111260559A