Image processing method, device, computer equipment and storage medium

Through the method of extending pixel-style images and linear generation, the problem of jagged image on high-resolution screens is solved, and a softer and more delicate visual effect is achieved.

CN119741242APending Publication Date: 2025-04-01NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411794587.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

When displaying pixel-style images on high-resolution screens, it is necessary to maintain the pixel art retro feel while presenting a softer visual effect to solve the problem of jagged feeling.

Method used

By obtaining a pending image with a pixel block effect, performing an extended process to generate a straight line of a specified color, which is distributed along a row or column of the image, and a target image is generated based on this.

Benefits of technology

Reduces the jagged feeling in pixel block effects images, improves the image performance, and makes the image more soft and delicate on high-resolution screens.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119741242A_ABST
    Figure CN119741242A_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses an image processing method, device, computer equipment and storage medium. The scheme obtains an image to be processed with a pixel block effect; performs expansion processing on the image to be processed to obtain an expanded image; in the expanded image, by changing the colors of multiple pixels to specified colors, at least one group of straight lines of the specified color is generated, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along the rows or columns of the expanded image; based on the expanded image including the straight lines, a target image is obtained. In this way, the jagged feeling in the image with the pixel block effect can be reduced, and the image performance effect can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image processing method, apparatus, computer equipment and computer-readable storage medium. Background Art

[0002] Pixel art is an image style that uses pixels as the basic unit. It presents images by breaking them down into pixels. However, when displaying pixel art images on high-resolution screens, it is necessary to present a softer visual effect while maintaining the retro feel of pixel art. Therefore, pixel art images need to be further processed. Summary of the invention

[0003] The embodiments of the present application provide an image processing method, apparatus, computer device, and computer-readable storage medium, which can reduce the jaggedness in pixel block effect images and improve image presentation effects.

[0004] The present application provides an image processing method, including:

[0005] Obtain an image to be processed with a pixel block effect;

[0006] Performing expansion processing on the image to be processed to obtain an expanded image;

[0007] In the expanded image, by changing the colors of a plurality of pixels to a specified color, at least one group of straight lines of the specified color is generated, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image;

[0008] A target image is obtained based on the expanded image containing the straight line.

[0009] Accordingly, the embodiment of the present application further provides an image processing device, including:

[0010] A first acquisition unit, used for acquiring an image to be processed with a pixel block effect;

[0011] An expansion unit, used for performing expansion processing on the image to be processed to obtain an expanded image;

[0012] A generating unit, configured to generate at least one group of straight lines of the specified color by changing the colors of a plurality of pixels in the expanded image to the specified color, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image;

[0013] The determination unit is used to obtain a target image based on the expanded image containing the straight line.

[0014] Correspondingly, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes any mapping processing method provided in the embodiments of the present application.

[0015] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the above-mentioned mapping processing method.

[0016] This solution obtains an image to be processed with a pixel block effect; performs expansion processing on the image to be processed to obtain an expanded image; in the expanded image, by changing the colors of multiple pixels to a specified color, generates at least one group of straight lines of the specified color, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along the rows or columns of the expanded image; based on the expanded image including the straight lines, a target image is obtained. In this way, the jagged feeling in the image with the pixel block effect can be reduced, and the image performance effect can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 A flowchart of an image processing method provided in an embodiment of the present application.

[0019] Figure 2 A schematic diagram of an application scenario of an image processing method provided in an embodiment of the present application.

[0020] Figure 3 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0021] Figure 4 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0022] Figure 5 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0023] Figure 6 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0024] Figure 7 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0025] Figure 8 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0026] Fig. 9 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0027] Fig.10 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0028] Fig.11 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0029] Fig.12 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0030] Fig.13 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.

[0031] Fig.14 A structural block diagram of an image processing device provided in an embodiment of the present application.

[0032] Fig.15 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0034] The embodiments of the present application provide an image processing method, apparatus, computer-readable storage medium and computer equipment. Specifically, the image processing method of the embodiments of the present application can be executed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a personal computer (PC), a personal digital assistant (PDA), etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0035] For example, the computer device may be a terminal that can obtain an image to be processed having a pixel block effect; perform expansion processing on the image to be processed to obtain an expanded image; generate at least one group of straight lines of the specified color in the expanded image by changing the colors of a plurality of pixels to specified colors, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image; and obtain a target image based on the expanded image including the straight lines.

[0036] Based on the above problems, the embodiments of the present application provide a first image processing method, apparatus, computer device and computer-readable storage medium, which can reduce the jaggedness in pixel block effect images and improve image performance.

[0037] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0038] An embodiment of the present application provides an image processing method, which can be executed by a terminal or a server. The embodiment of the present application is described by taking the image processing method executed by a terminal as an example.

[0039] See also Figure 1 , Figure 1 The following is a flow chart of an image processing method provided in an embodiment of the present application. The specific flow of the image processing method may be as follows:

[0040] 101. Obtain an image to be processed with a pixel block effect.

[0041] Among them, the pixel block effect refers to dividing the image into several small blocks, each of which is presented in a color or tone, thus forming a pixelated visual effect.

[0042] For example, see Figure 2 , Figure 2 A schematic diagram of an application scenario of an image processing method provided in an embodiment of the present application. Figure 2 In the image to be processed shown, a pixel block effect is shown, that is, the color transition area in the image to be processed presents a sawtooth-like shape.

[0043] 102. Perform expansion processing on the image to be processed to obtain an expanded image.

[0044] The image to be processed is expanded, that is, the image to be processed is enlarged to obtain an image with a higher resolution, which can provide enough space for image processing in subsequent processing steps.

[0045] In some embodiments, the image to be processed may be expanded by image upsampling, and the step of "performing an expansion process on the image to be processed to obtain an expanded image" may include the following operations:

[0046] The image to be processed is upsampled based on a preset upsampling multiple to obtain an expanded image.

[0047] Among them, the preset upsampling multiple refers to the multiple by which the image to be processed is enlarged, for example, it can be 8 times. This application does not limit this and can be set according to actual conditions.

[0048] Among them, image upsampling refers to the process of increasing a low-resolution image or a low-density sampled image to a high-resolution or high-density sampled image, mainly by increasing the number of data points to increase the resolution of the image, thereby increasing the details and clarity of the image, such as enlarging a 100x100 pixel image to 200x200 pixels, etc.

[0049] There are many methods for upsampling images, such as nearest neighbor interpolation, bilinear interpolation, and other methods.

[0050] In some embodiments, the image to be processed may be upsampled using a nearest neighbor interpolation method, which achieves seamless expansion by copying each image pixel in the image to be processed to a corresponding plurality of locations.

[0051] For example, the preset upsampling multiple may be 8 times, and the specific steps of upsampling the image to be processed by the nearest neighbor interpolation method may include the following:

[0052] Get the width W and height H of the image to be processed;

[0053] Create a new image of size 8*Wx 8*H to store the upsampling result;

[0054] For each original pixel (x_in, y_in) in the image to be processed, determine its starting position in the new image as: x_start = 8*x_in, y_start = 8*y_in;

[0055] In the new image, the color of the original pixel (x_in, y_in) is copied to the position from (x_start, y_start) to (x_start+7, y_start+7), so that the original pixel will be expanded to an 8x8 square area in the new image.

[0056] For example, see Figure 3 , Figure 3 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 3 The left side shows the image to be processed. The image to be processed is upsampled by a preset upsampling multiple to obtain Figure 3 The expanded image shown on the right is enlarged by a preset sampling multiple relative to the image to be processed.

[0057] 103. In the expanded image, at least one group of straight lines of the specified color is generated by changing the colors of a plurality of pixels to the specified color.

[0058] The set of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image.

[0059] The designated color may belong to a dark color system, for example, the designated color may include black.

[0060] In some embodiments, the step of "generating at least one group of straight lines of specified color by changing the colors of multiple pixel points in the expanded image to specified colors" may include: first, setting the number of straight lines in a group of straight lines and setting the distances between different groups of straight lines; then, in the rows or columns of the expanded image, determining the rows or columns corresponding to each group of straight lines according to the set number of straight lines and distances, and then setting the colors of the pixel points in the rows or columns corresponding to the straight lines to the specified color.

[0061] Among them, for the pixels corresponding to non-straight lines in the expanded image, the original colors of these pixels are kept unchanged.

[0062] The number of lines and the distance can be determined according to a preset upsampling multiple. For example, the value corresponding to the preset upsampling multiple = the value corresponding to the number of lines + the value corresponding to the distance, so that each original pixel in the image to be processed can be processed in the extended area of ​​the expanded image, thereby avoiding mixed processing between the original pixels and affecting the initial performance of the image to be processed.

[0063] For example, the preset upsampling multiple can be 8 times, then the number of straight lines in a group of straight lines can be set to 2, and the distance between different groups of straight lines can be set to 6 pixels; then, the rows or columns of the expanded image are traversed, and multiple groups of straight lines and the rows or columns corresponding to each straight line in each group of straight lines are determined according to the number of straight lines 2 and the distance 6, and then the color of the pixel points in the row or column corresponding to each straight line is set to the specified color, such as black, so that at least one group of straight lines of the specified color can be generated in the expanded image.

[0064] For example, see Figure 4 , Figure 4 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 4 The left side shows the expanded image corresponding to the image to be processed. By changing the colors of multiple pixels in the expanded image to black, at least one group of black straight lines is generated. The distances between different groups of straight lines are the same, and the straight lines are distributed along the rows of the expanded image, that is, Figure 4 The expanded image shown on the right generates multiple rows of black straight lines, which simulate the effect of scanning lines. That is, the straight lines of specified colors are equivalent to the scanning lines in the image.

[0065] Among them, by comparison Figure 4 The expanded image on the left and the expanded image on the right can be determined Figure 4 The expanded image on the right produces a straight black line, which reduces the aliasing effect while retaining the pixelated block style effect.

[0066] Among them, setting the color of the pixel point to the specified color may include: obtaining the color value of the specified color (which may include RGB value), for example, the color value of black is (0, 0, 0), then the color value of the pixel point may be set to (0, 0, 0).

[0067] In some embodiments, in order to improve the accuracy of the operation, the step of "generating at least one set of straight lines of the specified color by changing the colors of multiple pixels in the expanded image to the specified color" may include the following operations:

[0068] Obtaining a preset number of pixels, and grouping the pixels in the expanded image by rows or columns based on the preset number of pixels to obtain a plurality of pixel groups;

[0069] The colors of the pixels in at least one designated sorting position in each pixel group are set to designated colors, thereby obtaining at least one group of straight lines.

[0070] The preset number of pixels refers to the number of pixels that are required to be included in a preset pixel group.

[0071] Among them, the preset number of pixels can be determined according to the preset upsampling multiple. For example, the value corresponding to the preset number of pixels can be the same as the value corresponding to the preset upsampling multiple. That is, if the preset upsampling multiple is 8 times, the preset number of pixels can be set to: 8.

[0072] Among them, based on a preset number of pixels, pixel points in the expanded image are grouped according to rows or columns to obtain multiple pixel groups, which may include: in the rows or columns of the expanded image, pixel points in each row or column are divided according to a preset number of pixels, and then pixel groups obtained by dividing all rows or columns are used as multiple pixel groups.

[0073] For example, the pixel groups may be divided based on columns, and the specific steps include: traversing the expanded image from top to bottom, traversing each column according to a step length of 8, and obtaining the pixel group corresponding to each column.

[0074] The sorting position refers to the arrangement order of the pixels in a pixel group. For example, if a pixel group includes 8 pixels, the sorting positions of the pixels are: first, second, ..., eighth.

[0075] The designated sorting position may be a sorting position that is closer to the front or the back of the pixel group. For example, at least one designated sorting position may include: first, second. This application does not limit this and can be set according to actual conditions.

[0076] For example, the designated sorting positions may include: first and second, and the colors of the pixels in the first and second sorting positions in each pixel group may be set to designated colors, such as black, so that at least one group of black straight lines may be generated in the expanded image.

[0077] A straight line in at least one group of straight lines is composed of pixel points distributed in the same row or column and located at the same specified sorting position.

[0078] The distances between different groups of straight lines are the same. For example, the length of each pixel group is 8 pixels. The first and second pixels in each pixel group are set to black. Then, it can be determined that the distance between any adjacent straight line groups generated is 6 pixels.

[0079] 104. Based on the expanded image containing the straight line, a target image is obtained.

[0080] In some embodiments, obtaining a target image based on an expanded image containing straight lines may include: using the expanded image containing straight lines of specified colors processed in the above steps as the target image, which can reduce the jagged effect in the image while retaining the pixel block style effect.

[0081] In some embodiments, in order to further improve the performance of the target image, the step of “obtaining the target image based on the expanded image containing the straight line” may include the following operations:

[0082] Traverse the pixels in the expanded image and sample the color information of the neighboring pixels of the current pixel;

[0083] The color of the current pixel is adjusted based on the color information to obtain the target image.

[0084] The current pixel point refers to the pixel point that needs to be processed currently in the process of traversing the pixel points of the expanded image; the adjacent pixel point refers to the pixel point adjacent to the current pixel point in the expanded image.

[0085] In some embodiments, in order to reduce the aliasing at both ends of the scan line, the step of “adjusting the color of the current pixel based on the color information to obtain the target image” may include the following operations:

[0086] Determining whether a color adjustment is required for a current pixel according to the color information of each first pixel;

[0087] If it is determined that the color of the current pixel needs to be adjusted, the color of the current pixel is set to the specified color.

[0088] The adjacent pixel points may include a plurality of first pixel points in the eight neighborhoods of the current pixel point. The eight neighborhoods refer to eight adjacent pixel points around a pixel point, and the eight points are respectively located above, below, left, right and in four diagonal directions of the pixel point.

[0089] For example, multiple first pixel points in the eight-neighborhood of the current pixel point may include: in the expanded image, pixel points located above, below, left, right and in four diagonal directions (upper left, lower left, upper right, lower right) of the current pixel point.

[0090] In some embodiments, the color information may include a color value. In order to accurately determine whether the color of the current pixel needs to be adjusted, the step of "determining whether the current pixel needs to be adjusted according to the color information of each first pixel" may include the following operations:

[0091] Calculate a first sum of color values ​​of first pixels located at an upper left position, a directly above position, and a directly left position of a current pixel from among a plurality of first pixels;

[0092] Calculate the second sum of the color values ​​of the first pixel located at the upper right position, the directly above position, and the directly right position of the current pixel;

[0093] Calculate the third sum of the color values ​​of the first pixel located at the lower left position, the directly below position, and the directly left position of the current pixel;

[0094] Calculate a fourth sum of the color values ​​of the first pixel located at the lower right position, the directly below position, and the directly right position of the current pixel;

[0095] If the first sum value, the second sum value, the third sum value or the fourth sum value is less than the first preset threshold value, it is determined that the current pixel point needs to be color adjusted.

[0096] For example, see Figure 5 , Figure 5 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 5 The distribution of the first pixel position adjacent to the current pixel is shown, where m represents the current pixel, and the eight pixel points around the current pixel m are: upper left position lu, left position l, lower left position ld, upper right position ru, right position r, lower right position rd, upper position u, and lower position d.

[0097] Calculating the first sum of the color values ​​of the first pixel located at the upper left position, the upper position, and the left position of the current pixel may include the following steps:

[0098] lu_sum=lu_c+l_c+u_c;

[0099] Among them, lu_c refers to the color value of the upper left position lu; l_c refers to the color value of the left position l; u_c refers to the color value of the upper position u, and lu_sum is the first sum value calculated.

[0100] Calculating the second sum of the color values ​​of the first pixel located at the upper right position, the upper position, and the right position of the current pixel may include the following steps:

[0101] ru_sum=ru_c+r_c+u_c;

[0102] Among them, ru_c refers to the color value of the upper right position ru; r_c refers to the color value of the right right position r; u_c refers to the color value of the upper position u; ru_sum is the calculated second sum value.

[0103] Calculating the third sum of the color values ​​of the first pixel located at the lower left position, the directly below position, and the directly left position of the current pixel may include the following steps:

[0104] ld_sum=ld_c+l_c+d_c;

[0105] Among them, ld_c refers to the color value of the lower left position ld; l_c refers to the color value of the left position l; d_c refers to the color value of the lower position d; ld_sum refers to the calculated third sum value.

[0106] Calculating the fourth sum of the color values ​​of the first pixel located at the lower right position, the directly below position, and the directly right position of the current pixel may include the following steps:

[0107] rd_sum=rd_c+r_c+d_c;

[0108] Among them, rd_c refers to the color value of the lower right position rd; r_c refers to the color value of the right position r; d_c refers to the color value of the lower position d; rd_sum refers to the calculated fourth sum value.

[0109] In an embodiment of the present application, the first sum value represents the color accumulation value of the three adjacent pixels at the upper left position of the current pixel; the second sum value represents the color accumulation value of the three adjacent pixels at the upper right position of the current pixel; the third sum value represents the color accumulation value of the three adjacent pixels at the lower left position of the current pixel; and the fourth sum value represents the color accumulation value of the three adjacent pixels at the lower right position of the current pixel.

[0110] Furthermore, each calculated sum value is compared with a first preset threshold value.

[0111] In some embodiments, the purpose of comparing each sum value with the first preset threshold is to check whether the pixels around the current pixel are a specified color (such as black). In this case, the first preset threshold can be set to a color value close to black. For example, the first preset threshold can be set to 0.001.

[0112] If the first sum, the second sum, the third sum or the fourth sum is less than the first preset threshold, it is determined that the current pixel needs to be color adjusted, which means: if any sum among the multiple sums is less than the first preset threshold, it can be determined that the pixels around the current pixel are the specified color, so it is determined that the current pixel needs to be adjusted. That is, the color of the current pixel is adjusted to the specified color.

[0113] In some embodiments, if the first sum, the second sum, the third sum and the fourth sum are all not less than the first preset threshold, it can be determined that the pixels around the current pixel are not the specified color, and there is no need to adjust the color of the current pixel.

[0114] In an embodiment of the present application, the color of the current pixel is adjusted according to the first pixel, which is equivalent to chamfering both ends of the scan line in the expanded image, wherein the chamfering is also rounding the edge to reduce the jagged feeling.

[0115] For example, see Figure 6 , Figure 6 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 6 The left side is a partial image of the expanded image before the color of the current pixel is adjusted according to the color information of the first pixel; Figure 6 The right side is a partial image of the expanded image after the color of the current pixel is adjusted according to the color information of the first pixel. It can be seen that the jagged feeling at both ends of the scan line in the partial image on the right side is weakened.

[0116] In some embodiments, in order to further reduce the aliasing effect at both ends of the scan line, the scan line in the expanded image may be chamfered again according to the above-mentioned method of adjusting the color of the current pixel point through the color information of the first pixel point.

[0117] For example, see Figure 7 , Figure 7 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 7 The left side is a partial image of the expanded image after the first chamfering process. Figure 7 The right side shows a partial image of the expanded image after the second chamfering process.

[0118] In some embodiments, the straight line may be distributed along the row of the expanded image, that is, the scan line simulated by the straight line is a horizontal scan line. In order to enhance the light and dark contrast of the image, the step of "adjusting the color of the current pixel based on the color information to obtain the target image" may include the following operations:

[0119] Get the brightness information of the current pixel;

[0120] Determining whether the current pixel needs to be color adjusted according to the brightness information and / or the color information of each second pixel;

[0121] If it is determined that the color of the current pixel needs to be adjusted, the color of the current pixel is set to the specified color.

[0122] The adjacent pixel points may include a plurality of second pixel points in the eight neighborhoods of the current pixel point and located in different rows from the current pixel point.

[0123] Specifically, the second pixel point may include six pixel points in the eight neighborhoods of the current pixel point, which are located at the upper left, upper right, lower left, lower right, and lower right positions.

[0124] The brightness information may include a brightness value.

[0125] In some embodiments, obtaining the brightness information of the current pixel may include: obtaining the r (red) value, g (green) value, and b (blue) value in the color information of the current pixel, and then calculating the brightness value of the current pixel according to the R value, G value, and B value, which may be calculated according to the following formula:

[0126] B_m=0.299*r+0.587*g+0.144*b;

[0127] Among them, r refers to the r value of the current pixel, and 0.299 is the preset weight corresponding to the r value; g refers to the g value of the current pixel, and 0.587 is the preset weight corresponding to the g value; b refers to the b value of the current pixel, and 0.144 is the preset weight corresponding to the b value; B_m is the calculated brightness value of the current pixel.

[0128] In some embodiments, the color information includes a color value; the step of “determining whether the current pixel needs to be color adjusted according to the brightness information and / or the color information of each second pixel” may include the following operations:

[0129] If the brightness value is less than the second preset threshold, calculating a fifth sum of the color values ​​of the second pixel points located at the upper left position, the upper position, and the upper right position of the current pixel from the plurality of second pixel points;

[0130] Calculate the sixth sum of the color values ​​of the second pixel points located at the lower left position, the directly lower position, and the lower right position of the current pixel;

[0131] If the fifth sum value or the sixth sum value is less than the first preset threshold, it is determined that the current pixel needs to be color adjusted.

[0132] Among them, the second preset threshold is used to determine whether the current pixel point has low brightness. For example, the second preset threshold can be set to 0.5, and this application does not limit this.

[0133] Furthermore, the brightness value of the current pixel is compared with the second preset threshold. If the brightness value is less than the second preset threshold, it indicates that the current pixel has low brightness, so that the subsequent steps can be continued, that is, the fifth sum and the sixth sum are calculated to determine whether the color of the current pixel needs to be adjusted based on the fifth sum and the sixth sum.

[0134] For example, see Figure 8 , Figure 8 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 8The distribution of the positions of the second pixel points adjacent to the current pixel point is shown, where m represents the current pixel point, and the second pixel points adjacent to the current pixel point m are: upper left position lu, lower left position ld, upper right position ru, lower right position rd, upper position u, and lower position d.

[0135] Calculating the fifth sum of the color values ​​of the second pixel points located at the upper left position, the upper position, and the upper right position of the current pixel may include the following steps:

[0136] u_sum=lu_c+u_c+ru_c;

[0137] Among them, lu_c refers to the color value of the upper left position lu; u_c refers to the color value of the upper position u; ru_c refers to the color value of the upper right position ru; and u_sum is the calculated fifth sum.

[0138] Calculating the sixth sum of the color values ​​of the second pixel points located at the lower left position, the lower right position, and the lower right position of the current pixel may include the following steps:

[0139] d_sum=ld_c+d_c+rd_c;

[0140] Among them, ld_c refers to the color value of the lower left position ld; d_c refers to the color value of the lower right position d; rd_c refers to the color value of the lower right position rd; and d_sum is the calculated sixth sum value.

[0141] In an embodiment of the present application, the fifth sum represents the color accumulation value of the three adjacent pixel points directly above the current pixel point; the sixth sum represents the color accumulation value of the three adjacent pixel points directly below the current pixel point.

[0142] Further, the calculated fifth sum value and the sixth sum value are respectively compared with the first preset threshold value.

[0143] In some embodiments, the purpose of comparing the fifth sum and the sixth sum with the first preset threshold is to check whether the upper and lower adjacent pixels of the current pixel are a specified color (such as black). In this case, the first preset threshold can be set to a color value close to black. For example, the first preset threshold can be set to 0.001.

[0144] If the fifth sum or the sixth sum is less than the first preset threshold, it is determined that the current pixel needs to be adjusted in color, which means: if any of the fifth sum and the sixth sum is less than the first preset threshold, it can be determined that the upper and lower adjacent pixels of the current pixel are the specified color, thereby determining that the current pixel needs to be adjusted. That is, the color of the current pixel is adjusted to the specified color.

[0145] In some embodiments, if the fifth sum or the sixth sum is not less than the first preset threshold, it can be determined that the upper and lower adjacent pixels of the current pixel are not the specified color, so there is no need to adjust the color of the current pixel.

[0146] In some embodiments, if the brightness value of the current pixel is not less than the second preset threshold, it means that the current pixel is not low brightness, and there is no need to adjust the color of the current pixel, and the original color can be maintained.

[0147] In the embodiment of the present application, the color of the current pixel is adjusted according to the brightness value of the current pixel and the color of the second pixel, which is equivalent to checking the brightness of the adjacent pixels above and below the current pixel to determine whether the current pixel is at the upper edge or lower edge of the scan line. If it is, and the brightness of the current pixel is low, the current pixel needs to be set to black to dynamically adjust the thickness of the scan line based on the brightness of each area of ​​the image, and apply thicker scan lines to areas with higher brightness; and use thinner scan lines for areas with lower brightness. The change in the width of the scan line can enhance the light and dark contrast of the image and strengthen the spatial sense of the image.

[0148] For example, see Fig. 9 , Fig. 9 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Fig. 9 The left side is a partial image of the expanded image before the color of the current pixel is adjusted according to the brightness information of the current pixel and the color information of the second pixel; Fig. 9 The right side is a partial image of the expanded image after the color of the current pixel is adjusted according to the brightness information of the current pixel and the color information of the second pixel. It can be seen that the scan lines in the low brightness area of ​​the partial image on the right side are thinner than the scan lines in the high brightness area, so that the brightness contrast of the image can be enhanced by the thickness of the scan lines.

[0149] In some embodiments, the straight line may be distributed along the row of the expanded image, that is, the scan line simulated by the straight line is a horizontal scan line. In order to reduce the abruptness of the color change, the step of "adjusting the color of the current pixel based on the color information to obtain the target image" includes:

[0150] Obtain the distance between the current pixel and each third pixel and the current pixel;

[0151] Calculate the weight parameters corresponding to the current pixel and each third pixel respectively based on the distance;

[0152] Determine target color information according to color information of the current pixel and each third pixel and corresponding weight parameters;

[0153] Adjust the color of the current pixel based on the target color information.

[0154] The adjacent pixel points may include a plurality of third pixel points horizontally adjacent to the current pixel point. For example, the third pixel points may include a plurality of pixel points on the left and a plurality of pixel points on the right of the current pixel point in the expanded image.

[0155] For example, see Fig.10 , Fig.10 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Fig.10 The distribution of the positions of the third pixel points adjacent to the current pixel point is shown, where m represents the current pixel point, and the third pixel points adjacent to the current pixel point m are: left position l1, left position l2, left position l3, right position r1, right position r1, and right position r3.

[0156] Among them, obtaining the distances between the current pixel point and each third pixel point and the current pixel point respectively may include: respectively obtaining the distance between the current pixel point and the current pixel point, the distance between the current pixel point and l1, the distance between the current pixel point and l2, the distance between the current pixel point and l3, the distance between the current pixel point and r1, the distance between the current pixel point and r2, and the distance between the current pixel point and r3.

[0157] In some embodiments, the abruptness of color change can be reduced by smoothing, for example, by smoothing based on Gaussian blur, etc. Then, the weight parameters corresponding to the current pixel and each third pixel are calculated based on the distance, and the calculation formula can be as follows:

[0158]

[0159] Where σ is the standard deviation of the Gaussian distribution, which determines the decay rate of the weight. A larger σ will result in a smoother transition. For example, you can set σ = 1; x represents the distance to the current pixel; G(x) is the calculated weight value.

[0160] In some embodiments, in order to ensure that the sum of all weights is 1, the weights need to be normalized as follows:

[0161]

[0162] Among them, W(x) is the weight parameter obtained after normalizing the weight value.

[0163] In some embodiments, the color information may include a color value; then the step of “determining the target color information according to the color information of each third pixel point and the corresponding weight parameter” may include the following operations:

[0164] Calculate the multiplication of the color values ​​of the current pixel and each third pixel with the corresponding weight parameter respectively;

[0165] Calculate the sum of the multiplication values ​​to determine the target color value.

[0166] Among them, the target color value can be calculated according to the following formula:

[0167] C=W(l3)*l3_c+W(l2)*l2_c+W(l3)*l1_c+W(m)*m_c+W(r1)*r1_c+W(r2)*r2_c+W(r3)*r3_c;

[0168] Among them, W(l3) is the weight parameter corresponding to the left 3 position l3, and l3_c is the color value corresponding to the left 3 position l3; W(l2) is the weight parameter corresponding to the left 2 position l2, and l2_c is the color value corresponding to the left 2 position l2; W(l1) is the weight parameter corresponding to the left 1 position l1, and l1_c is the color value corresponding to the left 1 position l1; W(m) is the weight parameter corresponding to the current pixel point m, and m_c is the color value corresponding to the current pixel point m; W(r3) is the weight parameter corresponding to the right 3 position r3, and r3_c is the color value corresponding to the right 3 position r3; W(r2) is the weight parameter corresponding to the right 2 position r2, and r2_c is the color value corresponding to the right 2 position r2; W(r1) is the weight parameter corresponding to the right 1 position r1, and r1_c is the color value corresponding to the right 1 position r1; C is the calculated target color value.

[0169] Among them, adjusting the color of the current pixel based on the target color information may include: setting the color value of the current pixel as the target color value.

[0170] In some embodiments, in order to further reduce the jaggedness of the image, the step of “adjusting the color of the current pixel based on the color information to obtain the target image” may include the following operations:

[0171] Determining target color information according to the color information of each fourth pixel;

[0172] Adjust the color of the current pixel based on the target color information.

[0173] The adjacent pixel points may include a plurality of fourth pixel points in the four neighborhoods of the current pixel point. The four neighborhoods refer to four adjacent pixel points around a pixel point, and the four pixel points are respectively located in the upper, lower, left and right directions of the pixel point.

[0174] For example, the plurality of fourth pixel points in the four neighborhoods of the current pixel point may include: pixel points located in the upper, lower, left, and right directions of the current pixel point in the expanded image.

[0175] In some embodiments, the color information may include a color value; and the step of “determining the target color information according to the color information of each fourth pixel point” may include the following operations:

[0176] Determining, according to the color value of each fourth pixel point, a first number of edge pixels among the plurality of fourth pixels points;

[0177] Based on the first number and the color value of the current pixel, a target color value is calculated to obtain target color information.

[0178] The edge pixels refer to the pixels around the pixels of a specified color (such as black).

[0179] Among them, determining the first number of edge pixels among multiple fourth pixel points based on the color value of each fourth pixel point can include: comparing the color value of each fourth pixel point with a first preset threshold value, if it is less than the first preset threshold value, determining that the fourth pixel point is around the specified color pixel point, that is, it is an edge pixel point.

[0180] For example, see Fig.11 , Fig.11 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Fig.11 The position distribution of the fourth pixel points adjacent to the current pixel point is shown, where m represents the current pixel point, and the fourth pixel points around the current pixel point m are: left position l, right position r, top position u, and bottom position d.

[0181] Further, the color value of the direct left position l is compared with the first preset threshold; the color value of the direct right position r is compared with the first preset threshold; the color value of the direct upper position u is compared with the first preset threshold; the color value of the direct lower position d is compared with the first preset threshold, and the first number of edge pixels in the direct left position l, the direct right position r, the direct upper position u, and the direct lower position d is determined according to the comparison result. For example, if the color values ​​of the direct left position l and the direct right position r are less than the first preset threshold, then the direct left position l and the direct right position r are determined to be edge pixels, that is, the first number of edge pixels in the multiple fourth pixel points is 2.

[0182] The target color value is calculated based on the first number and the color value of the current pixel to obtain the target color information, which can be calculated according to the following formula:

[0183]

[0184] Wherein, C refers to the color value of the current pixel m, edge_cnt refers to the first quantity, and C1 refers to the calculated target color value.

[0185] Among them, adjusting the color of the current pixel based on the target color information may include: setting the color value of the current pixel as the target color value.

[0186] In an embodiment of the present application, the color of the current pixel is adjusted according to the color information of the fourth pixel, which is equivalent to smoothing the edges of the scan lines in the expanded image, and the jagged effect is further reduced by softening the edge transition of the scan lines.

[0187] For example, see Fig.12 , Fig.12 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Fig.12 The left side shows a partial image of the expanded image before the color of the current pixel is adjusted according to the color information of the fourth pixel; Fig.12 The right side shows a partial image of the expanded image after the color of the current pixel is adjusted according to the color information of the fourth pixel. It can be seen that the color transition edge in the image shown on the right side is smoother.

[0188] In some embodiments, since a plurality of pixels of a specified color (for example, black) are introduced into the expanded image, in order to balance the influence of the colors of these pixels on the brightness of the image, the method may further include the following steps:

[0189] Determine a brightness adjustment coefficient according to a preset upsampling multiple and the number of straight lines in each group of straight lines;

[0190] The colors of the pixels in the target image are adjusted based on the brightness adjustment coefficient to obtain an adjusted target image.

[0191] The brightness adjustment coefficient is determined according to the preset upsampling multiple and the number of straight lines in each group of straight lines, which may include the following:

[0192]

[0193] Among them, L Original Refers to the brightness of the image to be processed, L current refers to the brightness of the image after expansion; a refers to the preset upsampling multiple; b refers to the number of lines in each group of lines, where f is the brightness adjustment coefficient.

[0194] That is,

[0195] Among them, adjusting the color of the pixel in the target image based on the brightness adjustment coefficient may include: calculating the target color value according to the initial color value of the pixel in the target image and the brightness adjustment coefficient, and then adjusting the color value of the pixel according to the target color value.

[0196] The target color value is calculated according to the color value of the pixel point in the target image and the brightness adjustment coefficient, which may include the following:

[0197] C out =C in *f

[0198] Among them, C in is the initial color value of the pixel, f is the brightness adjustment coefficient, C out is the calculated target color value.

[0199] In the embodiment of the present application, the color value of each pixel is adjusted by the brightness adjustment coefficient, so that the pixels in the target image can be brightened and restored to match the initial brightness of the image to be processed.

[0200] For example, see Fig.13 , Fig.13 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Fig.13 The left side shows the image before the color of the pixels of the target image is adjusted according to the brightness adjustment coefficient; Fig.13 The left side shows an image before the color of the pixels of the target image is adjusted according to the brightness adjustment coefficient. It can be seen that the brightness of the image shown on the right side is improved. In some embodiments, in order to improve the performance of the target image, the step of "obtaining the target image based on the expanded image containing the straight line" may include the following operations:

[0201] Traverse the pixels in the expanded image and sample the color information of the neighboring pixels of the current pixel;

[0202] Determine whether the current pixel needs to be adjusted in color according to the color information of the first pixel among the adjacent pixels; if it is determined that the current pixel needs to be adjusted in color, set the color of the current pixel to a specified color;

[0203] Obtaining brightness information of the current pixel; determining whether the current pixel needs to be color adjusted according to the brightness information and / or color information of a second pixel among adjacent pixels; if it is determined that the current pixel needs to be color adjusted, setting the color of the current pixel to a specified color;

[0204] Obtaining the distance between the current pixel and a third pixel among the adjacent pixels and the current pixel; calculating weight parameters corresponding to the current pixel and each third pixel based on the distance; determining target color information according to color information of the current pixel and each third pixel and the corresponding weight parameters; adjusting the color of the current pixel based on the target color information;

[0205] The target color information is determined according to the color information of the fourth pixel among the adjacent pixels; and the color of the current pixel is adjusted based on the target color information.

[0206] In some embodiments, in order to reduce the overhead of subsequent image storage and processing, the method may further include the following steps:

[0207] The target image is downsampled based on a preset downsampling multiple to obtain a processed target image.

[0208] Among them, the preset downsampling multiple refers to the multiple by which the image to be processed is reduced, for example, it can be 4 times. This application does not limit this and can be set according to actual conditions.

[0209] Among them, image upsampling refers to the process of reducing a high-resolution image or a high-density sampled image to a low-resolution or low-density sampled image, mainly by reducing the number of data points to reduce the resolution of the image, for example, reducing a 200x300 pixel image to 100x100 pixels, etc.

[0210] In some embodiments, downsampling the target image based on a preset downsampling multiple may include the following steps:

[0211] Get the width W1 and height H1 of the target image, and set the preset downsampling multiple to 4 times;

[0212] Create a new image with the size of (W1 / 4)*(H1 / 4) to store the down-sampled result;

[0213] Divide the target image into non-overlapping 4×4 pixel blocks;

[0214] For each pixel block, calculate its position in the new image. For each 4×4 pixel block, calculate the average value of all pixels in the pixel block as the value of the corresponding pixel in the downsampled image. Finally, fill the calculated value into the corresponding position in the new image to obtain the processed target image.

[0215] The embodiment of the present application discloses an image processing method, which includes: obtaining an image to be processed with a pixel block effect; performing expansion processing on the image to be processed to obtain an expanded image; in the expanded image, by changing the colors of multiple pixels to a specified color, generating at least one group of straight lines of the specified color, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along the rows or columns of the expanded image; based on the expanded image including the straight lines, obtaining a target image. Thus, the jagged feeling in the image with the pixel block effect can be reduced, and the image performance effect can be improved.

[0216] In order to better implement the image processing method provided in the embodiment of the present application, the embodiment of the present application also provides an image processing device based on the above image processing method. The meanings of the terms are the same as those in the above image processing method, and the specific implementation details can refer to the description in the method embodiment.

[0217] See also Fig.14 , Fig.14 A structural block diagram of an image processing device provided in an embodiment of the present application, the device comprising:

[0218] A first acquisition unit 301 is used to acquire an image to be processed with a pixel block effect;

[0219] An expansion unit 302 is used to perform expansion processing on the image to be processed to obtain an expanded image;

[0220] A generating unit 303 is configured to generate at least one group of straight lines of the specified color by changing the colors of a plurality of pixels in the expanded image to a specified color, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image;

[0221] The determination unit 304 is configured to obtain a target image based on the expanded image containing the straight line.

[0222] In some embodiments, the generating unit 303 may include:

[0223] A first acquisition subunit is used to acquire a preset number of pixels, and to group the pixels in the expanded image by rows or columns based on the preset number of pixels to obtain a plurality of pixel groups;

[0224] A subunit is set, which is used to set the color of the pixel points in at least one specified sorting position in each pixel group to the specified color, so as to obtain the at least one group of straight lines, wherein a straight line in the at least one group of straight lines is composed of pixel points distributed in the same row or column and located in the same specified sorting position, and the distances between different groups of straight lines are the same.

[0225] In some embodiments, the determining unit 304 may include:

[0226] A sampling subunit, used for traversing the pixels in the expanded image and sampling the color information of the pixels adjacent to the current pixel;

[0227] The first adjustment subunit is used to adjust the color of the current pixel based on the color information to obtain the target image.

[0228] In some embodiments, the neighboring pixel points include a plurality of first pixel points in an eight-neighborhood of the current pixel point; and the first adjustment subunit may be specifically used for:

[0229] Determining whether the current pixel needs to be color adjusted according to the color information of each of the first pixels;

[0230] If it is determined that the current pixel needs to be color adjusted, the color of the current pixel is set to the specified color.

[0231] In some embodiments, the color information includes a color value; the first adjustment subunit may be further configured to:

[0232] Calculate, from the plurality of first pixel points, a first sum of color values ​​of first pixel points located at an upper left position, a directly above position, and a directly left position of the current pixel point;

[0233] Calculate a second sum of color values ​​of a first pixel located at an upper right position, a directly above position, and a directly right position of the current pixel;

[0234] Calculate a third sum of color values ​​of a first pixel located at a lower left position, a directly below position, and a directly left position of the current pixel;

[0235] Calculate a fourth sum of color values ​​of a first pixel located at a lower right position, a directly below position, and a directly right position of the current pixel;

[0236] If the first sum value, the second sum value, the third sum value or the fourth sum value is less than a first preset threshold, it is determined that the current pixel needs to be color adjusted.

[0237] In some embodiments, the straight lines are distributed along rows of the expanded image; the adjacent pixel points include a plurality of second pixel points in an eight-neighborhood of the current pixel point that are in different rows from the current pixel point;

[0238] The first adjustment subunit can be specifically used for:

[0239] Obtaining brightness information of the current pixel;

[0240] Determining whether color adjustment is required for the current pixel point according to the brightness information and / or the color information of each of the second pixels;

[0241] If it is determined that the current pixel needs to be color adjusted, the color of the current pixel is set to the specified color.

[0242] In some embodiments, the brightness information includes brightness values, and the color information includes color values;

[0243] The first adjustment subunit may also be specifically used for:

[0244] If the brightness value is less than a second preset threshold, calculating a fifth sum of the color values ​​of the second pixel points located at the upper left position, the upper position, and the upper right position of the current pixel from the plurality of second pixel points;

[0245] Calculate the sixth sum of the color values ​​of the second pixel points located at the lower left position, the directly lower position, and the lower right position of the current pixel;

[0246] If the fifth sum value or the sixth sum value is less than the first preset threshold, it is determined that the current pixel needs to be color adjusted.

[0247] In some embodiments, the straight lines are distributed along rows of the expanded image; the adjacent pixel points include a plurality of third pixel points horizontally adjacent to the current pixel point;

[0248] The first adjustment subunit can be specifically used for:

[0249] Obtaining the distances between the current pixel point and each third pixel point and the current pixel point;

[0250] Calculate the weight parameters corresponding to the current pixel and each third pixel respectively based on the distance;

[0251] Determine target color information according to the color information of the current pixel and each third pixel and the corresponding weight parameters;

[0252] The color of the current pixel is adjusted based on the target color information.

[0253] In some embodiments, the color information includes a color value;

[0254] The first adjustment subunit may also be specifically used for:

[0255] Calculate the multiplication value of the color value of the current pixel and each third pixel with the corresponding weight parameter respectively;

[0256] Calculate the sum of the multiplication values ​​to determine the target color value.

[0257] In some embodiments, the adjacent pixel points include a plurality of fourth pixel points in a four-neighborhood region of the current pixel point;

[0258] The first adjustment subunit can be specifically used for:

[0259] Determining target color information according to the color information of each of the fourth pixels;

[0260] The color of the current pixel is adjusted based on the target color information.

[0261] In some embodiments, the color information includes a color value;

[0262] The first adjustment subunit may also be specifically used for:

[0263] Determining, according to the color value of each fourth pixel point, a first number of edge pixels among the plurality of fourth pixels points;

[0264] Based on the first number and the color value of the current pixel, a target color value is calculated to obtain the target color information.

[0265] In some embodiments, the extension unit 302 may include:

[0266] The expansion subunit is used to perform upsampling processing on the image to be processed based on a preset upsampling multiple to obtain the expanded image.

[0267] In some embodiments, the apparatus may further include:

[0268] A determination subunit, configured to determine a brightness adjustment coefficient according to the preset upsampling multiple and the number of straight lines in each group of straight lines;

[0269] The second adjustment subunit is used to adjust the color of the pixel points in the target image based on the brightness adjustment coefficient to obtain an adjusted target image.

[0270] In some embodiments, the apparatus may further include:

[0271] The processing unit is used to perform downsampling processing on the target image based on a preset downsampling multiple to obtain a processed target image.

[0272] The embodiment of the present application discloses an image processing device, wherein a first acquisition unit 301 acquires an image to be processed with a pixel block effect; an expansion unit 302 performs expansion processing on the image to be processed to obtain an expanded image; a generation unit 303 generates at least one group of straight lines of the specified color in the expanded image by changing the colors of multiple pixels to a specified color, wherein a group of straight lines includes at least one straight line, and the straight lines are distributed along the rows or columns of the expanded image; a determination unit 304 obtains a target image based on the expanded image including the straight line. In this way, the jagged feeling in the image with the pixel block effect can be reduced, and the image performance effect can be improved.

[0273] Accordingly, the embodiment of the present application also provides a computer device, which may be a terminal. Fig.15 As shown, Fig.15A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored in the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. It will be understood by those skilled in the art that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0274] The processor 501 is the control center of the computer device 500. It uses various interfaces and lines to connect the various parts of the entire computer device 500, executes various functions of the computer device 500 and processes data by running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, thereby monitoring the computer device 500 as a whole.

[0275] In the embodiment of the present application, the processor 501 in the computer device 500 will load instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions:

[0276] Obtain an image to be processed with a pixel block effect;

[0277] Perform expansion processing on the image to be processed to obtain an expanded image;

[0278] In the expanded image, by changing the colors of a plurality of pixels to a specified color, at least one group of straight lines of the specified color is generated, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image;

[0279] Based on the expanded image containing the straight line, the target image is obtained.

[0280] The embodiment of the present application obtains an image to be processed with a pixel block effect; performs expansion processing on the image to be processed to obtain an expanded image; in the expanded image, by changing the colors of multiple pixels to a specified color, at least one group of straight lines of the specified color is generated, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along the rows or columns of the expanded image; and based on the expanded image including the straight lines, a target image is obtained. In this way, the jagged feeling in the image with the pixel block effect can be reduced, and the image performance effect can be improved.

[0281] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0282] Optional, such as Fig.15 As shown, the computer device 500 further includes: a touch screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507, respectively. Those skilled in the art can understand that Fig.15 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0283] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, and these graphical user interfaces may be composed of graphics, guide information, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 501, and can receive the command sent by the processor 501 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 501 to determine the type of touch event, and then the processor 501 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 503 can also be used as a part of the input unit 506 to realize the input function.

[0284] The radio frequency circuit 504 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer devices through wireless communication, and to send and receive signals between the network device or other computer devices.

[0285] The audio circuit 505 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 505 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505 and converted into audio data, and then the audio data is output to the processor 501 for processing, and then sent to another computer device through the radio frequency circuit 504, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between an external headset and the computer device.

[0286] The input unit 506 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0287] The power supply 507 is used to supply power to various components of the computer device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 507 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0288] although Fig.15 Not shown, the computer device 500 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

[0289] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0290] As can be seen from the above, the computer device provided in this embodiment can obtain an image to be processed with a pixel block effect; perform expansion processing on the image to be processed to obtain an expanded image; in the expanded image, by changing the colors of multiple pixel points to specified colors, generate at least one group of straight lines of the specified color, wherein a group of straight lines contains at least one straight line, and the straight lines are distributed along the rows or columns of the expanded image; based on the expanded image containing the straight lines, a target image is obtained.

[0291] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0292] To this end, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any image processing method provided in the embodiment of the present application. For example, the computer program can execute the following steps:

[0293] Obtain an image to be processed with a pixel block effect;

[0294] Perform expansion processing on the image to be processed to obtain an expanded image;

[0295] In the expanded image, by changing the colors of a plurality of pixels to a specified color, at least one group of straight lines of the specified color is generated, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image;

[0296] Based on the expanded image containing the straight line, the target image is obtained.

[0297] The embodiment of the present application obtains an image to be processed with a pixel block effect; performs expansion processing on the image to be processed to obtain an expanded image; in the expanded image, by changing the colors of multiple pixels to a specified color, at least one group of straight lines of the specified color is generated, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along the rows or columns of the expanded image; and based on the expanded image including the straight lines, a target image is obtained. In this way, the jagged feeling in the image with the pixel block effect can be reduced, and the image performance effect can be improved.

[0298] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0299] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0300] Since the computer program stored in the computer-readable storage medium can execute the steps in any image processing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any image processing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0301] The above is a detailed introduction to an image processing method, apparatus, computer-readable storage medium and computer equipment provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An image processing method, characterized in that: The method comprises: Obtain an image to be processed with a pixel block effect; Performing expansion processing on the image to be processed to obtain an expanded image; In the expanded image, by changing the colors of a plurality of pixels to a specified color, at least one group of straight lines of the specified color is generated, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image; A target image is obtained based on the expanded image containing the straight line.

2. The method according to claim 1, characterized in that The step of changing the colors of a plurality of pixels in the expanded image to a specified color to generate at least one group of straight lines of the specified color comprises: Obtaining a preset number of pixels, and grouping the pixels in the expanded image by rows or columns based on the preset number of pixels to obtain a plurality of pixel groups; The color of the pixel points in at least one specified sorting position in each pixel group is set to the specified color to obtain the at least one group of straight lines, wherein a straight line in the at least one group of straight lines is composed of pixel points distributed in the same row or column and located in the same specified sorting position, and the distances between different groups of straight lines are the same.

3. The method according to claim 1, characterized in that The step of obtaining a target image based on the expanded image containing the straight line comprises: Traversing the pixels in the expanded image, sampling the color information of the pixels adjacent to the current pixel; The color of the current pixel is adjusted based on the color information to obtain the target image.

4. The method according to claim 3, characterized in that The adjacent pixel points include a plurality of first pixel points in an eight-neighborhood of the current pixel point; The step of adjusting the color of the current pixel based on the color information to obtain the target image includes: Determining whether the current pixel needs to be color adjusted according to the color information of each of the first pixels; If it is determined that the current pixel needs to be color adjusted, the color of the current pixel is set to the specified color.

5. The method according to claim 4, characterized in that The color information includes a color value; The determining, according to the color information of each of the first pixels, whether the current pixel needs to be color adjusted includes: Calculate, from the plurality of first pixel points, a first sum of color values ​​of first pixel points located at an upper left position, a directly above position, and a directly left position of the current pixel point; Calculate a second sum of color values ​​of a first pixel located at an upper right position, a directly above position, and a directly right position of the current pixel; Calculate a third sum of color values ​​of a first pixel located at a lower left position, a directly below position, and a directly left position of the current pixel; Calculate a fourth sum of color values ​​of a first pixel located at a lower right position, a directly below position, and a directly right position of the current pixel; If the first sum value, the second sum value, the third sum value or the fourth sum value is less than a first preset threshold, it is determined that the current pixel needs to be color adjusted.

6. The method according to claim 3, characterized in that The straight lines are distributed along the rows of the expanded image; the adjacent pixel points include a plurality of second pixel points in the eight neighborhoods of the current pixel point and in different rows from the current pixel point; The step of adjusting the color of the current pixel based on the color information to obtain the target image includes: Obtaining brightness information of the current pixel; Determining whether color adjustment is required for the current pixel point according to the brightness information and / or the color information of each of the second pixels; If it is determined that the current pixel needs to be color adjusted, the color of the current pixel is set to the specified color.

7. The method according to claim 6, characterized in that The brightness information includes a brightness value, and the color information includes a color value; The determining, according to the brightness information and / or the color information of each of the second pixels, whether the current pixel needs to be color adjusted includes: If the brightness value is less than a second preset threshold, calculating a fifth sum of the color values ​​of the second pixel points located at the upper left position, the upper position, and the upper right position of the current pixel from the plurality of second pixel points; Calculate the sixth sum of the color values ​​of the second pixel points located at the lower left position, the directly lower position, and the lower right position of the current pixel; If the fifth sum value or the sixth sum value is less than the first preset threshold, it is determined that the current pixel needs to be color adjusted.

8. The method according to claim 3, characterized in that The straight lines are distributed along the rows of the expanded image; the adjacent pixel points include a plurality of third pixel points horizontally adjacent to the current pixel point; The step of adjusting the color of the current pixel based on the color information to obtain the target image includes: Obtaining the distances between the current pixel point and each third pixel point and the current pixel point; Calculate the weight parameters corresponding to the current pixel and each third pixel respectively based on the distance; Determine target color information according to the color information of the current pixel and each third pixel and the corresponding weight parameters; The color of the current pixel is adjusted based on the target color information.

9. The method according to claim 8, characterized in that The color information includes a color value; Determining target color information according to the color information of each third pixel and the corresponding weight parameter includes: Calculate the multiplication value of the color value of the current pixel and each third pixel with the corresponding weight parameter respectively; Calculate the sum of the multiplication values ​​to determine the target color value.

10. The method according to claim 3, characterized in that: The adjacent pixel points include a plurality of fourth pixel points in four neighborhoods of the current pixel point; The step of adjusting the color of the current pixel based on the color information to obtain the target image includes: Determining target color information according to the color information of each of the fourth pixels; The color of the current pixel is adjusted based on the target color information.

11. The method according to claim 10, characterized in that The color information includes a color value; The step of determining target color information according to the color information of each of the fourth pixels includes: Determining, according to the color value of each fourth pixel point, a first number of edge pixels among the plurality of fourth pixels points; Based on the first number and the color value of the current pixel, a target color value is calculated to obtain the target color information.

12. The method according to claim 1, characterized in that The step of performing expansion processing on the image to be processed to obtain an expanded image includes: The image to be processed is upsampled based on a preset upsampling multiple to obtain the expanded image.

13. The method according to claim 12, characterized in that The method further comprises: Determining a brightness adjustment coefficient according to the preset upsampling multiple and the number of straight lines in each group of straight lines; The colors of the pixels in the target image are adjusted based on the brightness adjustment coefficient to obtain an adjusted target image.

14. The method according to claim 1, characterized in that The method further comprises: The target image is downsampled based on a preset downsampling multiple to obtain a processed target image.

15. An image processing device, characterized in that: The device comprises: A first acquisition unit, used for acquiring an image to be processed with a pixel block effect; An expansion unit, used for performing expansion processing on the image to be processed to obtain an expanded image; A generating unit, configured to generate at least one group of straight lines of the specified color by changing the colors of a plurality of pixels in the expanded image to the specified color, wherein the group of straight lines includes at least one straight line, and the straight lines are distributed along rows or columns of the expanded image; The determination unit is used to obtain a target image based on the expanded image containing the straight line.

16. A computer device comprising a memory, a processor and a computer program stored in the memory and running on the processor, wherein: When the processor executes the program, the image processing method according to any one of claims 1 to 14 is implemented.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the image processing method according to any one of claims 1 to 14.