Method, device and equipment for improving display effect of picture lines and storage medium
Patent Information
- Application Number
- CN202311165189.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-11
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2043-09-11
AI Technical Summary
采用这种方法处理图像的过程中,会使得输入图像中各点的亮度在处理过程中从左向右侧堆积,从而使原本处于同一直线的各点能量在亮度堆积过程中不均衡,最终处理后的图像中的线条在画面中相对原始图像歪曲的情况
[0039]本发明提供了一种提高画面线条显示效果的方法、装置、设备及存储介质,该方法通过获取待处理图像以及待处理图像需显示的目标灰阶,通过待处理图像中所有像素点的坐标和亮度确定当前待处理图像的第一亮度矩阵;对待处理图像进行边缘检测以确定待处理图像中构成线条的各像素点的坐标,并根据所确定的构成线条的各像素点的坐标、待处理图像和待处理图像的目标灰阶确定待处理图像的灰阶均匀矩阵;结合灰阶均匀矩阵对第一亮度矩阵进行调整生成第二亮度矩阵,再通过第二亮度矩阵对待处理图像中各像素点的显示亮度进行调整,从而使得所生成的图像在灰阶均匀矩阵的作用下可确保线条处的显示不歪斜,且图像中各像素点的亮度不集中,提高整体画面的显示效果以及画面中线条的显示效果。
Smart Images

Figure CN117253461B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic paper module display technology, and in particular to a method, apparatus, device, and storage medium for improving the display effect of lines on a screen. Background Technology
[0002] Grayscale represents different levels of brightness from the darkest to the brightest. The more grayscale levels there are, the more delicate the image effect can be presented.
[0003] In the field of electronic paper module displays, the number of gray levels used for display is limited, typically a maximum of 16 gray levels, and as few as 8 or 4 gray levels. Existing technologies, when displaying input images on an electronic paper display, usually employ a dithering algorithm to process the input image before displaying the processed image. This method causes the brightness of points in the input image to accumulate from left to right during processing, resulting in uneven energy accumulation between points that were originally aligned on a straight line. Consequently, lines in the processed image appear distorted relative to the original image. Summary of the Invention
[0004] This invention provides a method, apparatus, device, and storage medium for improving the display effect of lines in an image, which can improve the overall display effect of the image and the display effect of lines in the image.
[0005] An embodiment of the present invention provides a method for improving the display effect of lines in an image, comprising:
[0006] Obtain the image to be processed and its target grayscale, and determine the coordinates and brightness of all pixels in the image to be processed;
[0007] Generate the first brightness matrix of the image to be processed based on the coordinates and brightness of all pixels in the image to be processed;
[0008] Edge detection is performed on the image to be processed to determine the coordinates of each pixel that constitutes the lines in the image to be processed;
[0009] The grayscale uniformity matrix of the image to be processed is determined based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel that constitutes the lines in the image to be processed.
[0010] A second brightness matrix of the image to be processed is generated based on the first brightness matrix and the grayscale uniformity matrix.
[0011] The brightness of each pixel in the image to be processed is adjusted using the second brightness matrix to generate the final processed image.
[0012] Further, determining the grayscale uniformity matrix of the image to be processed based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel constituting the lines in the image to be processed includes:
[0013] The initial grayscale uniformity matrix of the image to be processed is determined based on the image to be processed and the target grayscale of the image to be processed.
[0014] The brightness of the corresponding coordinates in the initial grayscale uniform matrix is adjusted according to the coordinates of each pixel that constitutes the lines in the image to be processed, thereby generating the grayscale uniform matrix of the image to be processed.
[0015] Furthermore, after determining the initial grayscale uniformity matrix of the image to be processed based on the image to be processed and the target grayscale of the image to be processed, the process also includes:
[0016] Select any pixel in the initial grayscale uniform matrix;
[0017] The selected pixels determine the diffusion area; wherein the diffusion area includes several sub-regions, and each sub-region corresponds one-to-one with each pixel in the initial grayscale matrix;
[0018] Diffusion is performed on each sub-region of the region to be diffused according to a preset diffusion coefficient to generate a diffusion matrix;
[0019] The step of adjusting the brightness of corresponding coordinates in the initial grayscale uniform matrix based on the coordinates of each pixel point constituting the lines in the image to be processed, to generate the grayscale uniform matrix of the image to be processed, includes:
[0020] The brightness of the corresponding coordinates in the diffusion matrix is adjusted according to the coordinates of each pixel that constitutes the lines in the image to be processed, thereby generating a uniform grayscale matrix of the image to be processed.
[0021] Furthermore, after generating the diffusion matrix, the process also includes:
[0022] When periodicity is detected in the diffusion matrix, the diffusion matrix is randomly scattered within each sub-region.
[0023] Further, edge detection is performed on the image to be processed, including:
[0024] Edge detection is performed on the image to be processed using the Sobel edge detection algorithm.
[0025] Furthermore, after acquiring the image to be processed and its target grayscale, and determining the coordinates and brightness of all pixels in the image to be processed, the process also includes:
[0026] When a change in brightness is detected in any pixel in the image to be processed, if the brightness of the pixel decreases, the brightness of the pixels surrounding the pixel is increased.
[0027] If the brightness of a pixel increases, the brightness of the pixels surrounding that pixel decreases.
[0028] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments;
[0029] One embodiment of the present invention provides a device for improving the display effect of lines in an image, comprising: a data acquisition module, a first brightness matrix generation module, an edge detection module, a grayscale uniformity matrix generation module, a second brightness matrix generation module, and an image adjustment module;
[0030] The data acquisition module is used to acquire the image to be processed and the target grayscale of the image to be processed, and to determine the coordinates and brightness of all pixels in the image to be processed.
[0031] The first brightness matrix generation module is used to generate a first brightness matrix of the image to be processed based on the coordinates and brightness of all pixels in the image to be processed.
[0032] The edge detection module is used to perform edge detection on the image to be processed and determine the coordinates of each pixel that constitutes the lines in the image to be processed.
[0033] The grayscale uniform matrix generation module is used to determine the grayscale uniform matrix of the image to be processed based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel that constitutes the lines in the image to be processed.
[0034] The second brightness matrix generation module is used to generate a second brightness matrix of the image to be processed based on the first brightness matrix and the grayscale uniformity matrix;
[0035] The image adjustment module is used to adjust the brightness of each pixel in the image to be processed using the second brightness matrix to generate the final processed image.
[0036] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a method for improving the display effect of screen lines as described in the above-described embodiments of the invention.
[0037] Another embodiment of the present invention provides a storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform a method for improving the display effect of screen lines as described in the above-described embodiment of the invention.
[0038] The following benefits can be obtained by implementing the present invention:
[0039] This invention provides a method, apparatus, device, and storage medium for improving the display effect of lines in an image. The method involves acquiring an image to be processed and the target grayscale level to be displayed in the image; determining a first brightness matrix of the image to be processed based on the coordinates and brightness of all pixels in the image; performing edge detection on the image to be processed to determine the coordinates of each pixel constituting the lines in the image; determining a grayscale uniformity matrix of the image to be processed based on the determined coordinates of each pixel constituting the lines, the image to be processed, and the target grayscale level of the image to be processed; adjusting the first brightness matrix in conjunction with the grayscale uniformity matrix to generate a second brightness matrix; and then adjusting the display brightness of each pixel in the image to be processed using the second brightness matrix. This ensures that the generated image, under the action of the grayscale uniformity matrix, ensures that the display of lines is not skewed and that the brightness of each pixel in the image is not concentrated, thereby improving the overall display effect of the image and the display effect of lines in the image. Attached Figure Description
[0040] Figure 1 This is an example diagram illustrating the display effect of an existing image containing lines, provided by an embodiment of the present invention.
[0041] Figure 2 This is a flowchart illustrating a method for improving the display effect of lines on a screen, provided by an embodiment of the present invention.
[0042] Figure 3 This is a schematic diagram of a device for improving the display effect of lines on a screen, provided by an embodiment of the present invention. Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] To better demonstrate the technical effects achievable by this invention, it should be noted before describing the embodiments of this invention that, as Figure 1 The image shown is an example of the display effect of an existing image containing lines, as provided by this invention. In the current electronic paper industry, the image processing algorithms used process the image as a whole. When processing images containing lines, the lines are not specially processed, resulting in skewed lines in the final image and a poor display effect.
[0045] To address the aforementioned display problems, this invention proposes a method for improving the display effect of lines in a screen.
[0046] like Figure 2 The image shown is a method for improving image display uniformity according to an embodiment of the present invention, comprising:
[0047] Step S1: Obtain the image to be processed and the target grayscale of the image to be processed, and determine the coordinates and brightness of all pixels in the image to be processed;
[0048] Step S2: Generate the first brightness matrix of the image to be processed based on the coordinates and brightness of all pixels in the image to be processed;
[0049] Step S3: Perform edge detection on the image to be processed to determine the coordinates of each pixel that constitutes the lines in the image to be processed;
[0050] Step S4: Determine the grayscale uniformity matrix of the image to be processed based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel that constitutes the lines in the image to be processed.
[0051] Step S5: Generate a second brightness matrix of the image to be processed based on the first brightness matrix and the grayscale uniformity matrix;
[0052] Step S6: Adjust the brightness of each pixel in the image to be processed using the second brightness matrix to generate the final processed image.
[0053] For steps S1, obtain the image to be processed and the target grayscale to be displayed in the image to be processed, and determine the number of pixels contained in the image to be processed and the coordinates of each pixel in the image to be processed based on the obtained image.
[0054] In a preferred embodiment, after acquiring the image to be processed and the target grayscale of the image to be processed, and determining the coordinates and brightness of all pixels in the image to be processed, the method further includes: when a change in the brightness of any pixel in the image to be processed is detected, if the brightness of the pixel decreases, the brightness of the pixels surrounding the pixel is increased; if the brightness of the pixel increases, the brightness of the pixels surrounding the pixel is decreased.
[0055] Specifically, in the field of electronic paper displays, the energy of each pixel in an image changes during the process from input to display on the screen. The final image displayed on the electronic paper screen consists only of black pixels (0 brightness) and white pixels (255 brightness). For example, if the brightness of a pixel is 120, and the threshold set during image processing is 128, pixels with a brightness below 128 will be set as black pixels (0 brightness), while pixels with a brightness above 128 will be set as white pixels (255 brightness). In the process of converting pixels to black or white pixels according to the set threshold, there is energy loss or gain. To ensure energy conservation, a preset energy radiation table is used to distribute the energy lost or gained by any pixel, ensuring no energy is lost and that black and white pixels can still reflect the grayscale of the image.
[0056] For example, an image has 16 pixels as shown in the table below:
[0057]
[0058]
[0059] The energy radiation table for a non-edge is shown below:
[0060] 3 / 8 1 / 8 1 / 8
[0061] The energy radiation table for a left boundary is shown in the table below:
[0062] 3 / 8 1 / 8
[0063] The energy radiation table for a right boundary is shown in the table below:
[0064] 1 / 8 3 / 8
[0065] The energy radiation table for the boundary conditions is shown in the table below:
[0066] 0 Current point 3 / 8
[0067] When the brightness value of a pixel in the image changes, the changed energy is distributed according to the energy radiation table mentioned above, so that the display effect is uniform and conforms to the principle of energy conservation.
[0068] For example: when the brightness of the second pixel in the first row changes from 120 to 0, and the changed brightness is distributed to the surrounding pixels, then from the original:
[0069] 200 30 80
[0070] Transformed into:
[0071] 200+45 30+15 80+15
[0072] Similarly, when the brightness of the second pixel in the third row changes from 240 to 255, the change in brightness is obtained from the surrounding pixels, thus changing from the original:
[0073] 220 214 24
[0074] Change to:
[0075] 220-6 214-2 24-2
[0076] The above method ensures that the brightness of any pixel is not lost by following the principle of energy conservation, and also allows black and white dots to reflect the grayscale of the image.
[0077] For step S2, a first brightness matrix is generated based on the coordinates and brightness of each pixel in the image to be processed. For example, if the image to be processed is a 4x4 image with 16 pixels, and each pixel is a solid color image with a brightness of 100, then the coordinate matrix of the image to be processed is shown in the table below:
[0078] N[x][y+1] N[x+1][y+1] N[x+2][y+1] N[x+3][y+1] N[x][y+2] N[x+1][y+2] N[x+2][y+2] N[x+3][y+2] N[x][y+3] N[x+1][y+3] N[x+2][y+3] N[x+3][y+3]
[0079] The first brightness matrix of the image to be processed is shown in the table below:
[0080]
[0081] For step S3, in a preferred embodiment, edge detection is performed on the image to be processed, including: edge detection of the image to be processed according to the Sobel edge detection algorithm.
[0082] Specifically, when processing an image using the Sobel edge detection algorithm, the algorithm calculates the grayscale value of each pixel. For a detected pixel, if the value reaches a set threshold during the calculation, it is determined to be a horizontal or vertical ridge. By detecting each pixel in the image one by one using the Sobel edge detection algorithm, the coordinates of the pixels constituting each line in the image can be obtained.
[0083] For step S4, in a preferred embodiment, determining the grayscale uniformity matrix of the image to be processed based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel constituting the lines in the image to be processed includes: determining the initial grayscale uniformity matrix of the image to be processed based on the image to be processed and the target grayscale of the image to be processed; adjusting the brightness of the corresponding coordinates in the initial grayscale uniformity matrix based on the coordinates of each pixel constituting the lines in the image to be processed to generate the grayscale uniformity matrix of the image to be processed.
[0084] Specifically, the target grayscale level determines the size of the final generated initial grayscale uniform matrix. For example, if the target grayscale level is 16 grayscale levels, the generated grayscale uniform matrix will be a 4x4 uniform matrix; if the target grayscale level is 64 grayscale levels, the generated grayscale uniform matrix will be an 8x8 uniform matrix; and if the target grayscale level is 96 grayscale levels, the generated grayscale uniform matrix will be an 18x8 uniform matrix. It should be noted that regardless of the number of target grayscale levels selected, there is a proportional correspondence between the initial grayscale uniform matrix and the first brightness matrix of the image to be processed.
[0085] In a preferred embodiment, after determining the initial grayscale uniform matrix of the image to be processed based on the image to be processed and the target grayscale of the image to be processed, the method further includes: selecting any pixel in the initial grayscale uniform matrix; determining a diffusion region based on the selected pixel; wherein the diffusion region includes several sub-regions, and the sub-regions correspond one-to-one with each pixel in the initial grayscale matrix; diffusing each sub-region in the diffusion region according to a preset diffusion coefficient to generate a diffusion matrix; the step of adjusting the brightness of the corresponding coordinates in the initial grayscale uniform matrix according to the coordinates of each pixel constituting the lines in the image to be processed to generate the grayscale uniform matrix of the image to be processed includes: adjusting the brightness of the corresponding coordinates in the diffusion matrix according to the coordinates of each pixel constituting the lines in the image to be processed to generate the grayscale uniform matrix of the image to be processed.
[0086] Specifically, to achieve better uniformity in the final display, diffusion processing is required for each pixel in the initial grayscale uniformity matrix. Any pixel in the initial grayscale uniformity matrix is selected, and the area to be diffused is determined based on this selected pixel. This area can be determined using the aforementioned energy radiation table. When diffusing each sub-region within the area to be diffused according to a preset diffusion coefficient, the preset diffusion coefficient determines the size of the final diffusion matrix. It should be noted that the desired uniformity range is determined by selecting a larger diffusion coefficient, resulting in a more uniform final diffusion matrix. For example, a 3x2 diffusion matrix can only achieve uniformity within a small 3x2 area. To achieve visual uniformity, a larger uniformity range needs to be selected. A 6x7 diffusion matrix provides better uniformity than a 3x2 diffusion matrix. Typically, if a 3x2 diffusion matrix is selected, a 6x4 matrix will exhibit periodicity or pixel brightness concentration over a larger area. Therefore, a larger diffusion matrix results in a more uniform visual display and a better overall display effect. However, a larger diffusion matrix means more computing power is required to complete the calculation. Therefore, based on practical experience, it is considered that a diffusion matrix containing 30-60 coefficients is more suitable. In this embodiment, we take the example of diffusing a 3x2 region to be diffused into a 6x7 diffusion matrix:
[0087] The following is a 3x2 region to be diffused:
[0088] 3 / 8 (bottom left) 1 / 8 (Part 2) 1 / 8 (bottom right)
[0089] In the table above, 3 / 8 (bottom left), 3 / 8 (right), 1 / 8 (bottom), and 3 / 8 (bottom right) are considered as the principal coefficients, each corresponding to a sub-region. Diffusion is applied to the sub-region corresponding to each principal coefficient, resulting in a 6x7 diffusion matrix as shown in the table below:
[0090] 4 / 72 3 / 72 3 / 72 2 / 72 3 / 72 2 / 72 3 / 72 3 / 72 2 / 72 1 / 72 2 / 72 2 / 72 3 / 72 2 / 72 2 / 72 1 / 72 2 / 72 2 / 72 2 / 72 1 / 72 1 / 72 1 / 72 1 / 72 2 / 72 2 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72
[0091] The sum of the coefficients of each sub-region in the diffusion matrix after diffusion must be approximately equal. For example:
[0092] 2 / 72 3 / 72 2 / 72 2 / 72 2 / 72 2 / 72
[0093] The sum of all the coefficients in the table above should be approximately equal to 3 / 8 (right).
[0094]
[0095]
[0096] The sum of all the coefficients in the table above should be approximately equal to 3 / 8 (bottom left).
[0097] 3 / 72 2 / 72 2 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72
[0098] The sum of all the coefficients in the table above should be approximately equal to 1 / 8 (below).
[0099] 1 / 72 1 / 72 2 / 72 1 / 72 1 / 72 2 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72
[0100] The sum of all the coefficients in the table above should be approximately equal to 1 / 8 (bottom right).
[0101] After determining the diffusion matrix, the coordinates of each pixel that constitutes the lines in the image to be processed are determined by the Sobel edge detection algorithm, and the corresponding coordinate positions in the diffusion matrix are marked so that when generating the second brightness matrix, the brightness at the coordinates of each pixel that constitutes the lines in the image to be processed is set to 255.
[0102] In a preferred embodiment, after generating the diffusion matrix, the method further includes: when periodicity is detected in the diffusion matrix, randomly scattering each sub-region in the diffusion matrix.
[0103] Specifically, based on the aforementioned sub-regions, without affecting the coefficient values in the diffusion matrix, the regions containing each coefficient within each sub-region are randomly shuffled. After each random shuffling, the periodicity and uniformity of the diffusion matrix are checked. Random shuffling within each sub-region is stopped when the diffusion matrix is found to have lower periodicity without reducing the original uniformity. The grayscale uniformity matrix of the image to be processed is determined based on the final determined diffusion matrix and the coordinates of each pixel of the lines in the image.
[0104] The table below shows an example of a diffusion matrix that can be obtained after performing a random scattering:
[0105] 4 / 72 3 / 72 3 / 72 2 / 72 3 / 72 2 / 72 3 / 72 3 / 72 2 / 72 1 / 72 2 / 72 2 / 72 3 / 72 2 / 72 2 / 72 1 / 72 2 / 72 2 / 72 2 / 72 1 / 72 1 / 72 1 / 72 1 / 72 2 / 72 2 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72 1 / 72
[0106] For step S5, a second brightness matrix is generated by combining the determined grayscale uniformity matrix with the first brightness matrix. In the second brightness matrix, the brightness of each pixel used to form the line is set to 255 and displayed as a white dot. The brightness of the remaining pixels is processed according to the coefficients in the determined diffusion matrix.
[0107] For step S6, the brightness values of each pixel in the image to be processed are reset according to the second brightness matrix determined in step S5, so that an image with straight lines and uniform brightness can be obtained.
[0108] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments.
[0109] like Figure 3As shown, an embodiment of the present invention provides a device for improving the display effect of lines in an image, including: a data acquisition module, a first brightness matrix generation module, an edge detection module, a grayscale uniformity matrix generation module, a second brightness matrix generation module, and an image adjustment module;
[0110] The data acquisition module is used to acquire the image to be processed and the target grayscale of the image to be processed, and to determine the coordinates and brightness of all pixels in the image to be processed.
[0111] The first brightness matrix generation module is used to generate a first brightness matrix of the image to be processed based on the coordinates and brightness of all pixels in the image to be processed.
[0112] The edge detection module is used to perform edge detection on the image to be processed and determine the coordinates of each pixel that constitutes the lines in the image to be processed.
[0113] The grayscale uniform matrix generation module is used to determine the grayscale uniform matrix of the image to be processed based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel that constitutes the lines in the image to be processed.
[0114] The second brightness matrix generation module is used to generate a second brightness matrix of the image to be processed based on the first brightness matrix and the grayscale uniformity matrix;
[0115] The image adjustment module is used to adjust the brightness of each pixel in the image to be processed using the second brightness matrix to generate the final processed image.
[0116] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0117] Those skilled in the art will clearly understand that, for convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0118] Based on the above method embodiments, the present invention provides corresponding terminal device embodiments.
[0119] One embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a method for improving the display effect of screen lines as described in any one of the present invention.
[0120] The terminal device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0121] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.
[0122] The memory can be used to store the computer program. The processor implements various functions of the terminal device by running or executing the computer program stored in the memory and calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created based on the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0123] Based on the above method embodiments, the present invention provides corresponding storage medium embodiments.
[0124] One embodiment of the present invention provides a storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to execute a method for improving the display effect of screen lines as described in any one of the present invention.
[0125] The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When executed by a processor, the computer program can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0126] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for improving the display effect of lines in an image, characterized in that, include: Obtain the image to be processed and its target grayscale, and determine the coordinates and brightness of all pixels in the image to be processed; Generate the first brightness matrix of the image to be processed based on the coordinates and brightness of all pixels in the image to be processed; Edge detection is performed on the image to be processed to determine the coordinates of each pixel that constitutes the lines in the image to be processed; The grayscale uniformity matrix of the image to be processed is determined based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel that constitutes the lines in the image to be processed. A second brightness matrix of the image to be processed is generated based on the first brightness matrix and the grayscale uniformity matrix. The brightness of each pixel in the image to be processed is adjusted using the second brightness matrix to generate the final processed image; The step of determining the grayscale uniformity matrix of the image to be processed based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel constituting the lines in the image to be processed includes: The initial grayscale uniformity matrix of the image to be processed is determined based on the image to be processed and the target grayscale of the image to be processed. The brightness of the corresponding coordinates in the initial grayscale uniform matrix is adjusted according to the coordinates of each pixel that constitutes the lines in the image to be processed, thereby generating the grayscale uniform matrix of the image to be processed. After determining the initial grayscale uniformity matrix of the image to be processed based on the image to be processed and the target grayscale of the image to be processed, the process also includes: Select any pixel in the initial grayscale uniform matrix; The selected pixels determine the diffusion area; wherein the diffusion area includes several sub-regions, and each sub-region corresponds one-to-one with each pixel in the initial grayscale matrix; Diffusion is performed on each sub-region of the region to be diffused according to a preset diffusion coefficient to generate a diffusion matrix; The step of adjusting the brightness of corresponding coordinates in the initial grayscale uniform matrix based on the coordinates of each pixel point constituting the lines in the image to be processed, to generate the grayscale uniform matrix of the image to be processed, includes: The brightness of the corresponding coordinates in the diffusion matrix is adjusted according to the coordinates of each pixel that constitutes the lines in the image to be processed, thereby generating a uniform grayscale matrix of the image to be processed; wherein, when generating the second brightness matrix, the brightness of each pixel that constitutes the lines in the image to be processed is set to 255, and the brightness of the remaining pixels is processed according to the coefficients in the diffusion matrix.
2. The method for improving the display effect of lines in a picture as described in claim 1, characterized in that, After generating the diffusion matrix, the following steps are also included: When periodicity is detected in the diffusion matrix, the diffusion matrix is randomly scattered within each sub-region.
3. The method for improving the display effect of lines in a picture as described in claim 1, characterized in that, Edge detection is performed on the image to be processed, including: Edge detection is performed on the image to be processed using the Sobel edge detection algorithm.
4. The method for improving the display effect of lines in a picture as described in claim 1, characterized in that, After acquiring the image to be processed and its target grayscale, and determining the coordinates and brightness of all pixels in the image to be processed, the process also includes: When a change in brightness is detected in any pixel in the image to be processed, if the brightness of the pixel decreases, the brightness of the pixels surrounding the pixel is increased. If the brightness of a pixel increases, the brightness of the pixels surrounding that pixel decreases.
5. A device for improving the display effect of lines in an image, characterized in that, include: The system includes a data acquisition module, a first brightness matrix generation module, an edge detection module, a grayscale uniformity matrix generation module, a second brightness matrix generation module, and an image adjustment module. The data acquisition module is used to acquire the image to be processed and the target grayscale of the image to be processed, and to determine the coordinates and brightness of all pixels in the image to be processed. The first brightness matrix generation module is used to generate a first brightness matrix of the image to be processed based on the coordinates and brightness of all pixels in the image to be processed. The edge detection module is used to perform edge detection on the image to be processed and determine the coordinates of each pixel that constitutes the lines in the image to be processed. The grayscale uniform matrix generation module is used to determine the grayscale uniform matrix of the image to be processed based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel that constitutes the lines in the image to be processed. The second brightness matrix generation module is used to generate a second brightness matrix of the image to be processed based on the first brightness matrix and the grayscale uniformity matrix; The image adjustment module is used to adjust the brightness of each pixel in the image to be processed using the second brightness matrix to generate the final processed image. The grayscale uniform matrix generation module determines the grayscale uniform matrix of the image to be processed based on the image to be processed, the target grayscale of the image to be processed, and the coordinates of each pixel that constitutes the lines in the image to be processed, including: The grayscale uniform matrix generation module determines the initial grayscale uniform matrix of the image to be processed based on the image to be processed and the target grayscale of the image to be processed. The brightness of the corresponding coordinates in the initial grayscale uniform matrix is adjusted according to the coordinates of each pixel that constitutes the lines in the image to be processed, thereby generating the grayscale uniform matrix of the image to be processed. After the grayscale uniform matrix generation module determines the initial grayscale uniform matrix of the image to be processed based on the image to be processed and the target grayscale of the image to be processed, the grayscale uniform matrix generation module is further configured to: Select any pixel in the initial grayscale uniform matrix; The selected pixels determine the diffusion area; wherein the diffusion area includes several sub-regions, and each sub-region corresponds one-to-one with each pixel in the initial grayscale matrix; Diffusion is performed on each sub-region of the region to be diffused according to a preset diffusion coefficient to generate a diffusion matrix; The step of adjusting the brightness of corresponding coordinates in the initial grayscale uniform matrix based on the coordinates of each pixel point constituting the lines in the image to be processed, to generate the grayscale uniform matrix of the image to be processed, includes: The brightness of the corresponding coordinates in the diffusion matrix is adjusted according to the coordinates of each pixel that constitutes the lines in the image to be processed, thereby generating a uniform grayscale matrix of the image to be processed; wherein, when generating the second brightness matrix, the brightness of each pixel that constitutes the lines in the image to be processed is set to 255, and the brightness of the remaining pixels is processed according to the coefficients in the diffusion matrix.
6. A terminal device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a method for improving the display effect of screen lines as described in any one of claims 1 to 4.
7. A storage medium, characterized in that, The storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform a method for improving the display effect of screen lines as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Character enhancement processing method and device, equipment and medium
CN114298932A
Bright spot positioning method, bright spot positioning device, electronic equipment and storage medium
CN115294035A