CN113436087B - Image binarization and display method, storage medium and terminal equipment - Google Patents
Image binarization and display method, storage medium and terminal equipment Download PDFInfo
- Publication number
- CN113436087B CN113436087B CN202110626973.6A CN202110626973A CN113436087B CN 113436087 B CN113436087 B CN 113436087B CN 202110626973 A CN202110626973 A CN 202110626973A CN 113436087 B CN113436087 B CN 113436087B
- Authority
- CN
- China
- Prior art keywords
- image
- gray level
- gray
- sub
- images
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000009792 diffusion process Methods 0.000 claims abstract description 63
- 238000013139 quantization Methods 0.000 claims abstract description 29
- 239000011159 matrix material Substances 0.000 claims description 12
- 238000012937 correction Methods 0.000 claims description 8
- 230000008569 process Effects 0.000 claims description 5
- 238000012545 processing Methods 0.000 abstract description 7
- 230000000007 visual effect Effects 0.000 description 8
- 230000004438 eyesight Effects 0.000 description 4
- 230000002688 persistence Effects 0.000 description 4
- 238000012935 Averaging Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000016776 visual perception Effects 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000013178 mathematical model Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/73—Deblurring; Sharpening
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/76—Television signal recording
- H04N5/765—Interface circuits between an apparatus for recording and another apparatus
- H04N5/775—Interface circuits between an apparatus for recording and another apparatus between a recording apparatus and a television receiver
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Control Of Indicators Other Than Cathode Ray Tubes (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
The invention discloses an image binarization and display method, a storage medium and a terminal device, wherein the image binarization method comprises the steps of firstly copying an initial multi-gray level image to obtain k multi-gray level sub-images; then, performing a binarization algorithm based on error diffusion on the 1 st multi-gray level sub-image in a frame, and calculating quantization errors caused by thresholding of each pixel of the 1 st multi-gray level sub-image; then, a binarization algorithm based on error diffusion is applied between frames: sequentially multiplying the quantization error by m weight values in an inter-frame error diffusion template, and then adding the m weight values to corresponding pixel gray values of m multi-gray level sub-images; and carrying out error diffusion on the 2 nd to the k th multi-gray level sub-images in the same manner in frames and between frames to finish binarization processing, and finally obtaining k binarization sub-images. These binarized sub-images can approximate the original multi-gray level image and are not prone to forming structured noise and creating false contours in areas of the image where there are large patches of similar gray levels.
Description
Technical Field
The invention relates to the technical field of image and video processing, in particular to an image binarization and display method, a storage medium and terminal equipment.
Background
For the image, under the condition of unchanged size, the more the gray level is, the more the carried image information is, and more lifelike visual experience can be provided for people. However, in the process of storing, transmitting and processing images, the multi-gray-level images occupy more space, bandwidth and operation amount than the binary images, and in the case that the storage space, transmission bandwidth and operation capability of the device are limited, the number of multi-gray-level images that can be stored by the device, the number of multi-gray-level images that can be transmitted in a unit time, and the number of multi-gray-level images that can be processed in a unit time are also limited.
For example, common computer image formats often use 8 bits to quantify the gray value of each pixel, i.e., there may be 256 (2 8 ) Different levels. When storing a multi-gray-scale picture of size 5400×3600 pixels, it takes 18.5 megabytes of space; while storing a binary image of the same size, only 2.31 megabytes of space is required, since the gray value of each pixel only needs to be represented by 1 bit. It follows that the binary image consumes only 1/8 of the memory space of an 8-bit gray scale image of the same size. Thus, to improve image storage, transmissionAnd processing efficiency, even improving display rate, image binarization is widely used at present. Image binarization techniques generally convert a multi-gray level image into a binary image, which approximates the multi-gray level image.
DLP (Digital Light Processing) the projector uses image binarization and the core chip DMD (Digital Micromirror Device) of the projector is a kind of binarizing element, so that at each instant the DLP projector can only project a binarized pattern. In order to realize multi-gray-level image display, a DLP projector adopts a pulse width modulation method to decompose each multi-gray-level image into a plurality of binary images, further carries out time weighting according to a certain weight, and projects the plurality of binary images in sequence by utilizing the persistence of vision characteristic of human eyes so as to enable the human eyes to obtain the visual perception of the multi-gray-level images. This image display mode is also called time dithering. However, the time-dithering technique comes at the cost of reducing the display rate of the image. For example, a DMD with 768 x 1024 pixels may display binary images at a rate up to 22727 frames per second, but when 256 gray-scale images are displayed by time dithering techniques, the highest display rate of the images drops to 290 frames per second. The direct display of binary images is performed at a high rate, and if the binary images can be directly displayed on a binary display device (such as a DMD) and finally a multi-gray-scale image effect can be displayed, the advantage of the DMD that the binary images are rapidly projected can be fully utilized, so that the digital halftone technology has been developed.
Digital halftoning (Digital Halftoning Technology) is a technique that utilizes the visual characteristics of the human eye and the color rendering characteristics of images, and utilizes mathematical, computer, etc. tools to achieve optimal reproduction of multi-gray scale (or color multi-gray scale) images on binary (or multi-color binary) display devices. The technique can convert a high resolution multi-level image into a low resolution binary (or multi-valued) image. When viewed at a distance, the human eye treats the spatially close portion of the image as a whole. With this feature, the halftone image local average gray scale observed by the human eye approximates the local average gray scale value of the original image, thereby forming a continuous tone effect as a whole.
The error diffusion method is a digital half-tone technology with wider application, good performance and low processing complexity at present, and the principle is that image pixels are quantized according to a certain scanning path, pixel gray values are compared with a binary threshold value and are subjected to differential quantization, and quantization errors are diffused to unprocessed pixel gray values adjacent to the currently accessed pixel points in a certain proportion.
Fig. 1 is a flowchart of a conventional error diffusion-based binarization method. Assuming that the original multi-gray level image is of the order of l multi-gray levels, [ m ] in FIG. 1]Representing the currently accessed image pixel, im]Representing the gray value of the currently accessed pixel in the original multi-gray level image,representing the gray value, qm, of the pixel point currently accessed after thresholding]Gray values representing currently accessed pixels in the original multi-gray level image superimposed with gray values obtained from quantization errors generated by thresholding preceding pixels, W representing an error diffusion weight matrix (proposed by Floyd and Steinberg, see FIG. 2), E [ m ]]Representing quantization error. The mathematical model of error diffusion can be represented by the following two equations:
wherein T represents a binarization threshold value, W i Represents the ith weight value in the error diffusion weight matrix, M represents the number of elements contained in the error diffusion weight matrix, E M-i]Representing the quantization error propagated by the M-i th pixel before the currently accessed pixel (the image can be seen as a one-dimensional vector at this time). To ensure that the errors are all spread over the unprocessed pixels, the sum of the elements of the error diffusion weight matrix W is typically 1, i.e
However, the conventional error diffusion-based binarization method generally focuses on diffusing the error into the same image, which easily generates pseudo contours and forms structured noise in large-scale gray-scale similar image areas, so that the resolution of the image is reduced, and the display quality of the picture is further affected, and the visual effect is affected.
Disclosure of Invention
The first objective of the present invention is to solve the deficiencies of the prior art, and to provide an image binarization method for performing error diffusion simultaneously in and between frames, wherein the error is diffused not only to other pixel gray values of the same image, but also to a plurality of multi-gray level sub-images copied from an original multi-gray level image, so that the multi-gray level sub-images can approach the original multi-gray level image after being binarized in turn, and structured noise is not easy to form in an image area with large gray level similarity and pseudo contours are not easy to generate.
The second object of the present invention is to provide an image display method, in which the binary sub-images obtained by error diffusion are arranged continuously at equal intervals in time, and are displayed on a binary display device in a fast switching manner, so that the human eyes can generate the visual effect of watching multi-gray-level images and videos by using the persistence of vision characteristic of the human eyes and the color development characteristic of the images.
A third object of the present invention is to propose a computer readable storage medium.
A fourth object of the present invention is to propose a terminal device.
The first object of the invention is achieved by the following technical scheme: an image binarization method for performing error diffusion simultaneously in and between frames is used for converting an initial image with a gray level (order) of l into k sub-images with a gray level of 2, wherein l is a positive integer and l > 2, and approximating the obtained k binarized sub-images to the initial multi-gray level image.
The method specifically comprises the following steps:
S1copying the initial multi-gray level image I to obtain k multi-gray level sub-images: i 1 、I 2 、…、I i 、…、I k Where i=1, 2,..k.
S2, copying the 1 st multi-gray level sub-image I 1 Performing a binarization algorithm based on error diffusion in the frame to obtain a corresponding binarized sub-imageI 1 Pixels in +.>Corresponding pixels can be found and both can form a pair of pixels, then I is calculated 1 And->The difference in grey scale between each pair of pixels, i.e. calculate I 1 Pixels in and->Gray scale differences between corresponding pixels.
The process is specifically as follows:
s21, traversing the pixel of the 1 st multi-gray level sub-image according to a certain path, and thresholding the traversed pixel:
21-1) setting a binarization threshold T epsilon [0,l-1] of 1 st-order multi-gray level sub-image pixels, wherein the binarization thresholds of different sub-images are the same;
21-2) traversing the pixels of the multi-gray level image, and setting the currently accessed pixels as (x, y) with the gray values of Q, wherein x and y respectively represent the row serial numbers and the column serial numbers of the pixels in the multi-gray level sub-image, and Q epsilon [0,l-1];
21-3) comparing the gray value Q of the pixel with a binarization threshold T, if the gray value Q is greater than or equal to the threshold T, setting the gray value of the pixel (x, y) to l-1, otherwise, setting the gray value of the pixel (x, y) to 0, and recording the binarized gray value as
S22, calculating quantization errors caused by thresholding of the traversed pixels, wherein the quantization errors are gray level difference values, multiplying the quantization errors by weight values in an error diffusion template in a frame in sequence, and then overlapping the weighted quantization errors on corresponding pixel gray level values which are not thresholded in the 1 st multi-gray level sub-image.
Here, the intra-frame error diffusion template refers to a weight matrix when quantization errors generated by pixels that have been thresholded currently propagate to pixels that are adjacent to pixels that have not been thresholded, and the weight values are elements in the weight matrix. The intra error diffusion template may be preset.
The number of pixels in the multi-gray level sub-image to be subjected to error diffusion depends on the number of weight values in the weight matrix, and the positions of the pixels in the multi-gray level sub-image to be subjected to error diffusion depend on row and column numbers of the weight values in the weight matrix.
The process of step S22 is specifically as follows:
22-1) calculating quantization error of pixel (x, y) due to thresholdingThe quantization error is then corrected using an error correction formula:
wherein, beta is error correction coefficient, beta is 0,1, which can be set by oneself;
22-2) correcting the quantization errorWeighting and superposing the weights on the error diffusion templates in the frames on the corresponding pixel gray values which are not thresholded in the same image;
22-3) repeating the steps 21-3), 22-1) to 22-2) for other pixels to be thresholded after (x, y) until the pixels to be thresholded in the multi-gray level sub-image are thresholded, thereby obtaining a binarized sub-image.
S3, performing a binarization algorithm based on error diffusion between frames: sequentially multiplying the gray difference value by m weight values w in the inter-frame error diffusion template 1 、w 2 、…、w m The weighted gray difference is then added to m multi-gray level sub-images I which have not been binarized 2 、I 3 、…、I 1+m Wherein 1+m.ltoreq.k.
Here, m weight values in the inter-frame error diffusion template refer to scale factors for sequentially diffusing quantization errors of each pixel to pixels of m multi-gray level sub-images that have not been binarized, and a sum of the m weight values in the inter-frame error diffusion template and all elements in the intra-frame error diffusion template is 1. The inter-frame error diffusion template may be preset. The number of the weight values determines the number of the multi-gray level sub-images which are positioned behind the current multi-gray level sub-image and need error diffusion.
S4, pair I 2 、I 3 、…、I k And (3) sequentially repeating the steps S2 to S3, and finally, all the k pieces of multi-gray level sub-images are binarized to obtain k pieces of binarized sub-images.
The second object of the invention is achieved by the following technical scheme: the image display method includes obtaining k pieces of binary sub-images through the image binarization method according to the first object of the invention, continuously arranging the k pieces of binary sub-images at equal intervals in time, and switching and displaying the binary sub-images on a binarization display device according to a certain speed.
The third object of the invention is achieved by the following technical scheme: a computer-readable storage medium storing a program which, when executed by a processor, implements the image binarization method of the first object of the present invention.
The fourth object of the invention is achieved by the following technical scheme: the terminal equipment comprises a processor and a memory for storing a program executable by the processor, wherein the image binarization method of the first object of the invention is realized when the processor executes the program stored by the memory.
The terminal device also comprises a binarized display device, and the processor continuously arranges the k binarized sub-images at equal intervals in time after generating the k binarized sub-images, and the binarized display device switches and displays the k binarized sub-images according to a certain speed.
Compared with the prior art, the invention has the following advantages and effects:
(1) The image binarization method not only carries out error diffusion in frames, but also carries out error diffusion among frames, and the multi-gray-level image obtained by averaging a plurality of binarization sub-images corresponding to the initial multi-gray-level image can approximate to the initial multi-gray-level image, so that structured noise is not easy to form in an image area with large gray-level similarity and a pseudo contour is not easy to generate.
(2) The invention can realize the visual perception of the multi-gray-level image or video on the visual effect of human eyes by rapidly switching a plurality of binarization sub-images corresponding to the initial multi-gray-level image, thereby realizing the ultra-high-speed display of the multi-gray-level image and the video on the binarization high-speed display equipment.
(3) The invention generates a plurality of corresponding binarization sub-images for each frame of the video, the binarization sub-images are continuously arranged at equal intervals in time, and the two binarization sub-images are rapidly switched and displayed on a binary high-speed display device, so that the video picture content is even sharper and the contrast ratio is higher than that of the original multi-gray level video.
Drawings
Fig. 1 is a flowchart of a conventional error diffusion-based binarization method.
Fig. 2 is an error diffusion weight matrix used in the method of fig. 1.
FIG. 3 is a flow chart of the image binarization method of the present invention.
Fig. 4 is a schematic diagram of an initial 256-level gray scale image in embodiment 1 of the present invention.
Fig. 5 is an intra error diffusion template in embodiment 1 of the present invention.
Fig. 6 is an inter-frame error diffusion template in embodiment 1 of the present invention.
Fig. 7 shows a binarized sub-image obtained after intra and inter error diffusion in example 1 of the present invention.
Fig. 8 is a 256-level gray scale image obtained by averaging 4 binarized sub-images in embodiment 1 of the present invention.
Detailed Description
The present invention will be described in further detail with reference to examples and drawings, but embodiments of the present invention are not limited thereto.
Example 1
The present embodiment provides an image binarization method, as shown in fig. 3, including:
s1, copying an initial multi-gray level image to obtain k multi-gray level sub-images;
s2, performing a binarization algorithm based on error diffusion on the 1 st copied multi-gray level sub-image, and calculating a gray level difference value corresponding to each pair of pixels between the 1 st multi-gray level sub-image and the binarized sub-image, namely, a quantization error caused by thresholding of each pixel of the 1 st multi-gray level sub-image;
s3, performing a binarization algorithm based on error diffusion between frames: sequentially multiplying the quantization error by m weight values in an inter-frame error diffusion template, and adding the weighted E to the corresponding pixel gray values of m multi-gray level sub-images which are not binarized;
s4, performing binarization processing on the 2 nd to the k th multi-gray level sub-images in sequence according to the steps of performing error diffusion in the frames and between the frames, and finally, binarizing all the multi-gray level sub-images to obtain k binarized sub-images.
In order to better describe the method of the present embodiment, each step will be described below with a 256-level gray-scale natural image I as an initial image.
S1, FIG. 4 shows a 256-level gray level natural image I with 768×1024 pixels and a pixel gray value range of [0,255]]. Let k=4, duplicate 4 copies of the original multi-gray level image I to obtain 4 multi-gray levelsSub-image I 1 、I 2 、I 3 I 4 。
S2, setting a binarization threshold T to be 128, wherein an intra-frame error diffusion template is shown in FIG. 5, an error correction coefficient beta is 0.3, and an error correction formula is as follows:
let the currently accessed pixel be (x, y), Q be its gray value, Q ε [0,255].
For 1 st multiple gray level sub-image I 1 The pixel of the (C) is scanned line by line from the upper left corner to the right, the gray value Q of the currently accessed pixel is compared with the binarization threshold value 128, if the gray value Q of the pixel is more than or equal to 128, the gray value of the pixel (x, y) is set to 255, otherwise, is set to 0, and the binarized gray value of the pixel is recorded as
Then, calculating the quantization error E of the current pixel (x, y) caused by thresholding, E being the difference value of the pixel point before and after thresholding
Correcting the error by adopting an error correction formula, wherein the corrected errorThe weighted error values are superimposed on the neighboring pixel gray values according to the weight distribution on the intra error diffusion template (solid black dots representing the currently accessed pixel) of fig. 5. As can be seen from fig. 5, the error diffusion range can reach the right two columns of the column of the currently accessed pixel and the lower two rows of the row of the currently accessed pixel.
Thresholding is carried out on pixel points by pixel points according to the method until a multi-gray level sub-image I 1 All pixel points in the array are thresholded to obtain a multi-gray level sub-image I 1 Corresponding binary image
In the present embodiment, it is assumed that the pixel gray value distribution of the multi-gray level sub-image currently binarized is as shown in table 1:
TABLE 1
255 | 255 | 0 | 0 | 0 | 255 | 0 |
0 | 0 | 255 | 255 | 0 | 255 | 255 |
255 | 0 | 0 | 140 | 94 | 142 | 159 |
161 | 150 | 139 | 108 | 147 | 167 | 151 |
147 | 130 | 142 | 157 | 169 | 172 | 149 |
155 | 147 | 159 | 134 | 157 | 139 | 137 |
If the gray value of the currently accessed pixel is 140 (the pixel in front of the pixel has been binarized), since the gray value is greater than 128, the gray value of the pixel is set to 255 after binarization, the error e=140-255, and the error is corrected to be diffused to the pixels at the right side and below. For example, here, the correction error is spread to the 1 st pixel gray value on the right:the 1 st pixel gray value on the right is weighted and added with the corrected error to become:
similarly, when the error is corrected and then spread to the leftmost pixel gray value of the next row, the corrected error isThe leftmost pixel gray value of the next row becomes:
thus, after the intra error diffusion process, the image pixel gray value distribution is as shown in table 2:
TABLE 2
255 | 255 | 0 | 0 | 0 | 255 | 0 |
0 | 0 | 255 | 255 | 0 | 255 | 255 |
255 | 0 | 0 | 140 | 80 | 131 | 159 |
161 | 143 | 128 | 94 | 136 | 160 | 151 |
147 | 126 | 135 | 146 | 162 | 168 | 149 |
155 | 147 | 159 | 134 | 157 | 139 | 137 |
S3, as shown in FIG. 6, setting the weight w in the inter-frame error diffusion template 1 =1.5/33、w 2 =1/33、w 3 =0.5/33, multi-gray level sub-image I 1 The quantization error of each pixel in the image is based on the weight w 1 、w 2 、w 3 Superimposed on a multi-gray level sub-image I 2 、I 3 I 4 The gray value of the corresponding pixel.
Here, assume I 1 The gray value of the pixel corresponding to the fourth column of the fifth row isThe modified quantization error is-107 due to sub-image I 1 、I 2 、I 3 、I 4 Is copied by I, so I 2 、I 3 、I 4 Initializing the gray value of the pixel corresponding to the fourth column of the fifth row to 157, passing through I 1 After error propagation of I 2 、I 3 、I 4 The gray value of the pixel corresponding to the fourth column of the fifth row is corrected as
S4, waiting for multi-gray level sub-image I 1 After binarization, the rest of the multi-gray level sub-image I 2 、I 3 I 4 And repeating the steps S2 and S3, and sequentially executing a binarization algorithm based on error diffusion in frames and between frames to finally obtain 4 pieces of binarized sub-images (a) - (d) shown in fig. 7.
As shown in fig. 8, the multi-gray-level image obtained by averaging the 4 binarized sub-images is very similar to the initial image of fig. 4, and it can be seen that the visual effect of using the plurality of binarized sub-images to approximate the multi-gray-level image can be achieved by using the method of the embodiment.
In addition, the embodiment also discloses an image display method, which obtains 4 pieces of binarized sub-images (a) - (d) shown in fig. 7 through the image binarization method, continuously arranges the 4 pieces of binarized sub-images at equal intervals in time, and displays the images on a binarized high-speed display device through fast switching, that is, the binarized sub-images are displayed in a constant-speed switching manner, so that human eyes can generate visual effects of watching multi-gray-level images and videos by utilizing the persistence of vision and the color development characteristic of the images, and high-definition and high-speed multi-gray-level images and videos are displayed.
Example 2
The present embodiment provides a computer-readable storage medium storing a program which, when executed by a processor, implements the image binarization method described in embodiment 1, specifically as follows:
s1, copying an initial multi-gray level image to obtain k multi-gray level sub-images;
s2, performing a binarization algorithm based on error diffusion on the multi-gray level sub-image obtained in the i Zhang Fuzhi to obtain a corresponding binarization sub-image, wherein i=1, 2, & gt, k, and calculating gray level difference values between pixels in the i multi-gray level sub-image and pixels corresponding to the i multi-gray level sub-image;
s3, performing a binarization algorithm based on error diffusion between frames: sequentially multiplying the gray difference values by m weight values in an inter-frame error diffusion template, and then adding the weighted gray difference values to corresponding pixel gray values of m multi-gray level sub-images which are not binarized, wherein 1+m is less than or equal to k;
s4, repeating the steps S2-S3 for the (i+1) th multi-gray level sub-image, and the like until all k multi-gray level sub-images are binarized, and finally obtaining k binarized sub-images;
the computer readable storage medium in the present embodiment may be a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a usb disk, a removable hard disk, or the like.
Example 3
The embodiment provides a terminal device, which comprises a processor, a memory and a binarized display device, wherein the memory and the binarized display device are respectively connected with the processor and controlled by the processor, and the memory stores a program executable by the processor.
When the processor executes the program stored in the memory, the image binarization method described in embodiment 1 can be implemented, specifically as follows:
s1, copying an initial multi-gray level image to obtain k multi-gray level sub-images;
s2, performing a binarization algorithm based on error diffusion on the multi-gray level sub-image obtained in the i Zhang Fuzhi to obtain a corresponding binarization sub-image, wherein i=1, 2, & gt, k, and calculating gray level difference values between pixels in the i multi-gray level sub-image and pixels corresponding to the i multi-gray level sub-image;
s3, performing a binarization algorithm based on error diffusion between frames: sequentially multiplying the gray difference values by m weight values in an inter-frame error diffusion template, and then adding the weighted gray difference values to corresponding pixel gray values of m multi-gray level sub-images which are not binarized, wherein 1+m is less than or equal to k;
s4, repeating the steps S2-S3 for the (i+1) th multi-gray level sub-image, and the like until all the k multi-gray level sub-images are binarized, and finally obtaining k binarized sub-images.
After generating k binarized sub-images, the processor can also continuously arrange the k binarized sub-images at equal intervals in time, and the binarized display device can display the sequentially arranged binarized sub-images in a switching manner according to a certain speed, so that the human eyes can generate the visual effect of watching the multi-gray-level images and videos by utilizing the persistence of vision characteristics of the human eyes and the color development characteristics of the images, and the ultra-high-speed display of the multi-gray-level images and videos is realized on the binarized high-speed display device.
The computing device described in this embodiment may be a desktop computer, a notebook computer, a tablet computer, or other terminal devices with processor functions. The binarized display device may be a binary high-speed display device such as a DMD.
The above embodiments are merely preferred embodiments of the present invention and are not intended to limit the present invention, and any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.
Claims (8)
1. An image binarization method, characterized by comprising the following steps:
s1, copying an initial multi-gray level image to obtain k multi-gray level sub-images;
s2, performing a binarization algorithm based on error diffusion on the multi-gray level sub-image obtained by the i Zhang Fuzhi, setting a binarization threshold value, traversing pixels of the i multi-gray level sub-image, and thresholding the traversed pixels to obtain a corresponding binarization sub-image, wherein i=1, 2.
The process of step S2 is specifically as follows:
s21, traversing pixels of the ith multi-gray level sub-image according to a certain path, and thresholding the traversed pixels;
the process of step S21 is specifically as follows:
setting a binarization threshold T epsilon [0,l-1] of an ith-level l-level multi-gray level sub-image pixel;
traversing pixels of the multi-gray level sub-image, and setting the currently accessed pixels as (x, y) and the gray values of the pixels as Q, wherein x and y respectively represent row serial numbers and column serial numbers of the pixels in the multi-gray level sub-image, and Q epsilon [0,l-1];
comparing the gray value Q of the pixel with a binarization threshold T, if the gray value Q is greater than or equal to the threshold T, setting the gray value of the pixel (x, y) as l-1, otherwise, setting the gray value of the pixel (x, y) as 0, and recording the binarized gray value as
S22, calculating quantization errors, namely gray level difference values, of the traversed pixels caused by thresholding, multiplying the quantization errors by weight values in an error diffusion template in a frame in sequence, and then superposing the weighted quantization errors on corresponding pixel gray level values which are not thresholded in the ith multiple gray level sub-image;
calculating quantization error of pixel (x, y) due to thresholdingAnd correcting the quantization error using an error correction formula:
wherein, beta is error correction coefficient, beta is [0,1];
corrected quantization errorWeighting and superposing the weights on the error diffusion templates in the frames on the corresponding pixel gray values which are not thresholded in the same image;
repeating the steps until all pixel points to be thresholded in the multi-gray level sub-image are thresholded, thereby obtaining a binarized sub-image;
s3, performing a binarization algorithm based on error diffusion between frames: sequentially multiplying the corrected gray difference value by m weight values in an inter-frame error diffusion template, and then adding the weighted gray difference value to the corresponding pixel gray value of m multi-gray level sub-images which are not binarized, wherein 1+m is less than or equal to k;
s4, repeating the steps S2-S3 for the (i+1) th multi-gray level sub-image, and the like until all the k multi-gray level sub-images are binarized, and finally obtaining k binarized sub-images.
2. The method of image binarization according to claim 1, wherein the intra-frame error diffusion template refers to a weight matrix when quantization errors generated by pixels currently undergoing thresholding propagate to pixels adjacent to pixels not yet thresholded, the number of pixels in the multi-gray level sub-image to be subjected to error diffusion depends on the number of weight values in the weight matrix, and the positions of the pixels in the multi-gray level sub-image to be subjected to error diffusion depend on row and column numbers of the weight values in the weight matrix.
3. The image binarization method according to claim 2, wherein a sum of the ownership value in the inter-frame error diffusion template and the ownership value in the intra-frame error diffusion template is 1.
4. The method according to claim 1, wherein in step S3, m weight values in the inter-frame error diffusion template refer to scale factors for sequentially diffusing quantization errors of each pixel to pixels of m multi-gray level sub-images that have not been binarized, wherein the number of weight values determines the number of multi-gray level sub-images that need to be error-diffused after the i-th multi-gray level sub-image.
5. An image display method, characterized in that k pieces of binarized sub-images are obtained by the image binarization method according to any one of claims 1 to 4, and then the k pieces of binarized sub-images are arranged continuously at equal intervals in time, and are switched to display on a binarized display device at a certain speed.
6. A computer-readable storage medium storing a program, wherein the program, when executed by a processor, implements the image binarization method according to any one of claims 1 to 4.
7. A terminal device comprising a processor and a memory for storing a program executable by the processor, characterized in that the processor implements the image binarization method according to any one of claims 1 to 4 when executing the program stored in the memory.
8. The terminal device according to claim 7, wherein the terminal device further comprises a binarized display device, the processor sequentially arranges the k binarized sub-images at equal intervals in time after generating the k binarized sub-images, and the display is switched by the binarized display device at a certain speed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110626973.6A CN113436087B (en) | 2021-06-04 | 2021-06-04 | Image binarization and display method, storage medium and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110626973.6A CN113436087B (en) | 2021-06-04 | 2021-06-04 | Image binarization and display method, storage medium and terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113436087A CN113436087A (en) | 2021-09-24 |
CN113436087B true CN113436087B (en) | 2023-05-23 |
Family
ID=77804015
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110626973.6A Active CN113436087B (en) | 2021-06-04 | 2021-06-04 | Image binarization and display method, storage medium and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113436087B (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008228101A (en) * | 2007-03-14 | 2008-09-25 | Canon Inc | Image processing apparatus and method |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3489806B2 (en) * | 1997-12-08 | 2004-01-26 | 株式会社リコー | Image processing apparatus and method |
CN1213592C (en) * | 2001-07-31 | 2005-08-03 | 佳能株式会社 | Adaptive two-valued image processing method and equipment |
JP4039395B2 (en) * | 2003-09-18 | 2008-01-30 | セイコーエプソン株式会社 | Image processing method, image processing apparatus, image processing program, printer, print instruction terminal, and image processing system |
KR20070035885A (en) * | 2005-09-28 | 2007-04-02 | 엘지전자 주식회사 | Image processing method for plasma display panel |
JP4937868B2 (en) * | 2007-09-14 | 2012-05-23 | 株式会社リコー | Image processing apparatus, image recording apparatus, program, and recording medium |
CN103957343B (en) * | 2014-04-22 | 2016-08-17 | 杭州电子科技大学 | A kind of colour errors method of diffusion |
-
2021
- 2021-06-04 CN CN202110626973.6A patent/CN113436087B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008228101A (en) * | 2007-03-14 | 2008-09-25 | Canon Inc | Image processing apparatus and method |
Also Published As
Publication number | Publication date |
---|---|
CN113436087A (en) | 2021-09-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5109282A (en) | Halftone imaging method and apparatus utilizing pyramidol error convergence | |
US5201013A (en) | Dither processing method | |
US5729663A (en) | Method and apparatus for gray screening | |
Guo et al. | Halftone-image security improving using overall minimal-error searching | |
EP0781034B1 (en) | Image processing apparatus and method | |
JP3240803B2 (en) | Image processing apparatus and image processing method | |
JP4381360B2 (en) | Image processing method, image processing apparatus, image forming apparatus, computer program, and recording medium | |
US8270750B2 (en) | Image processor, display device, image processing method, and program | |
JPH11187264A (en) | Method and device for processing image | |
Xia et al. | Deep halftoning with reversible binary pattern | |
CN113160056A (en) | Deep learning-based noisy image super-resolution reconstruction method | |
CN113436087B (en) | Image binarization and display method, storage medium and terminal equipment | |
JP4068181B2 (en) | Multilevel gradation pixel value level reduction method and system | |
Singh | Generalized error diffusion method for halftoning | |
JP2003069819A (en) | Image processor and image processing method | |
JPH0863596A (en) | Method and system for diffusion of error as well as generation method of error value | |
JP4108517B2 (en) | Halftoning processing method and halftoning processing system | |
US20030007184A1 (en) | Digital image multitoning method | |
Kouge et al. | Accelerating digital halftoning using the local exhaustive search on the GPU | |
Hu | Simple gradient-based error-diffusion method | |
JP2000270210A (en) | Picture processor | |
Zhuge et al. | Halftoning via Error Diffusion using Circular Dot-overlap Model | |
Panda et al. | A negative multiscale error diffusion technique for digital halftoning | |
Bozkurt | Novel methods in image halftoning | |
Sindhu | A Review on Image Halftone Processing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |