Embodiment
Being described below in detail embodiments of the invention, the example of described embodiment is shown in the drawings, and wherein same or similar label represents same or similar element or has element that is identical or similar functions from start to finish. It is exemplary below by the embodiment being described with reference to the drawings, only for explaining the present invention, and limitation of the present invention can not be interpreted as.
Disclosing hereafter provides many different embodiments or example is used for realizing the different structure of the present invention. In order to simplify disclosing of the present invention, hereinafter parts and setting to specific examples are described. Certainly, they are only example, and object is not restriction the present invention. In addition, the present invention can in different example repeat reference numerals and/or letter. This kind repeats to be to simplify and clearly object, itself does not indicate the relation between discussed various embodiment and/or setting. In addition, various specific technique that the present invention provides and the example of material, but those of ordinary skill in the art can recognize the property of can be applicable to of other techniques and/or the use of other materials. In addition, fisrt feature described below second feature it " on " structure can comprise the embodiment that the first and second features are formed as directly contact, can also comprising the embodiment that other feature is formed between the first and second features, such first and second features may not be direct contact.
In describing the invention, it should be noted that, unless otherwise prescribed and limit, term " installation ", " being connected ", " connection " should be interpreted broadly, such as, can be mechanically connected or electrical connection, can also be the connection of two element internals, it is possible to be directly be connected, it is also possible to be indirectly connected by intermediary, for the ordinary skill in the art, it is possible to understand the concrete implication of above-mentioned term according to particular case.
With reference to description below and accompanying drawing, it will be clear that these and other aspects of embodiments of the invention. Describe at these and in accompanying drawing, specifically disclose the particular implementation of some in embodiments of the invention, represent some modes of the principle implementing embodiments of the invention, it is understood that the scope of embodiments of the invention is not limited. On the contrary, embodiments of the invention comprise all changes within the scope of the spirit and intension falling into attached claim book, amendment and etc. jljl.
The image dithering process method and device that propose according to embodiments of the present invention are described with reference to the accompanying drawings.
As shown in Figure 1, the image dithering process method that first aspect present invention embodiment proposes comprises the following steps:
S101, obtains view data.
Wherein, this view data belongs to YCbCr color space. Wherein, Y refers to brightness component, and Cb refers to chroma blue component, and Cr refers to red color component.
Further, in an embodiment of the present invention, owing to input image data is the data of YCbCr, if demand does dithering process at YCbCr color space, then image dithering process process is directly entered; If demand does dithering process at rgb space, then need by view data from YCbCr color space conversion to RGB color, and then enter image dithering process process. Wherein, R is red, and G is green, and B is blue.
S102, generates N number of random array according to the N number of pixel value in view data, wherein, N be greater than 0 integer.
Further, in one embodiment of the invention, as N=1, step S102 is specially: using the value corresponding to the default position of first pixel value as first random array, for the process of the 2nd pixel value. In embodiments of the present invention, the dither functions adjusting strength in dithering process process can be selected according to the image effect of the image obtained, because the view data obtained is the binarized pixel value of 0 ~ 255, so such as low 2 or low 3, the default position of view data can be selected to do dithering process according to image effect, if such as picture colour band this kind of situation is obvious, default position can be selected low 3, otherwise, preset position and select low 2. Wherein, when selecting default position to be low 2, dithering process is relatively weak.
In an example of the present invention, selection according to dither functions intensity, when N value is 1, the value of low 2 or low 3 of record first pixel, as random array YG_DELTA, CB_DELTA and CR_DELTA of the first pixel, for the calculating of the 2nd pixel. And the value of the first pixel does not process, directly export.
S103, according to N number of random array, carries out dithering process to the N+1 pixel value, wherein, the N+1 pixel value is carrying out generating in dithering process process the intermediate value of the N+1 pixel value.
In one embodiment of the invention, by following formula, the N+1 pixel value is carried out dithering process to generate the intermediate value of the N+1 pixel value:
YG_GRE_M=YG_GRE+YG_DELTA;
CB_BLU_M=CB_BLU+CB_DELTA;
CR_RED_M=CR_RED+CR_DELTA;
Wherein, YG_GRE, CB_BLU and CR_RED are the N+1 pixel value, YG_DELTA, CB_DELTA and CR_DELTA are N number of random array, YG_GRE_M, CB_BLU_M and CR_RED_M are the intermediate value of the N+1 pixel value of YCbCr or RGB produced in treating processes, determine by above-mentioned color-space choosing.
That is, in an example of the present invention, random array according to first pixel also processes current the 2nd pixel value by above-mentioned formula, thus obtain intermediate value YG_GRE_M, CB_BLU_M, CR_RED_M of the 2nd pixel, wherein YG_GRE_M, CB_BLU_M, CR_RED_M value can represent the value of Y, CB, CR or R, G, B respectively, determines by the selection of color space before. Meanwhile, if the value of YG_GRE_M, CB_BLU_M, CR_RED_M generated is greater than 255, then it is 255 by this variable assignment, otherwise does not process.
In an embodiment of the present invention, according to N number of random array, the N+1 pixel value is carried out dithering process to comprise further: export after the value of the default position of YG_GRE_M, CB_BLU_M and CR_RED_M being reset. Namely say, the value YG_GRE_M, the value of low 2 or low 3 of CB_BLU_M, CR_RED_M that are produced by step S103 reset, assignment is to new pixel value YG_GRE_DEAL, CB_BLU_DEAL, CR_RED_DEAL, and its value is the result of dithering process, as final output.
S104, generates N+1 random array according to the intermediate value of the N+1 pixel value.
In one embodiment of the invention, using the value of the default position of YG_GRE_M, CB_BLU_M and CR_RED_M as N+1 random array. That is, process intermediate value YG_GRE_M, CB_BLU_M, CR_RED_M of N+1 pixel value is obtained by step S103. The default position getting them respectively is such as low 2 or low 3, obtain the random array of N+1 pixel value, then assignment is to YG_DELTA, CB_DELTA and CR_DELTA respectively, and the value of the random array N number of pixel value generated overrides, for the calculating of the N+2 pixel value.
S105, according to N+1 random array, carries out dithering process to the N+2 pixel value, until the pixel value of view data all processes complete.
In one embodiment of the invention, after obtaining view data, it is possible to by selecting the switch of dither functions to judge whether this view data is carried out dithering process. As shown in Figure 2, after input YCbCr data, the flow process that dither functions switch is selected comprises the following steps:
S201, judges whether to need dithering process. If it does, then perform next step S202; If not, then step S203 is performed.
S202, enters image dithering process process.
S203, directly carries out image output.
In the present embodiment, that is, after obtaining YCbCr data, it is possible to select the switch of dither functions as required. When such as taking image, colour band is relatively more serious, then can select to open the switch of dither functions thus view data is carried out dithering process, increases the dynamicrange of image, eliminates colour band to the impact of image effect. Otherwise, it is possible to select to close dither functions, directly carry out image output.
Wherein, in one embodiment of the invention, as shown in Figure 3, the N+1 pixel value is carried out dithering process further comprising the steps:
S301, judges whether that the Y value to the N+1 pixel value carries out dithering process. If it does, then perform step S302; If not, then step S303 is performed.
S302, exports YG_GRE_DEAL.
S303, directly exports the Y value of the N+1 pixel value, namely exports YG_GRE.
S304, judges whether that the Cb value to the N+1 pixel value and Cr value carry out dithering process. If it does, then perform step S305; If not, then step S306 is performed.
S305, exports CB_BLU_DEAL, CR_RED_DEAL.
S306, directly exports Cb value and the Cr value of the N+1 pixel value, namely exports CB_BLU, CR_RED.
S307, exports the image of YCbCr format.
In the present embodiment, it is possible to the Y value of the N+1 pixel value directly exported, that is, Cb value and Cr value and to the N+1 pixel value carry out dithering process thus CB_BLU_DEAL, CR_RED_DEAL value of obtaining replaces exporting; Or, for black white image, brightness has the image that water ripples shape changes, it is possible to the Y value of the N+1 pixel value is carried out dithering process, eliminates water ripple phenomenon, and the Cb value of the N+1 pixel value and Cr value is directly exported.
Specifically, in one embodiment of the invention, as shown in Figure 4, above-mentioned image dithering process method also comprises the following steps:
S401, obtains YCbCr data.
S402, selects color space, such as YCbCr color space. That is, it is possible to select YCbCr color space that view data is carried out dithering process, it is also possible to select RGB color that view data is carried out dithering process.
S403, judge whether Y��Y_TH, namely being compared by the brightness value Y and luminance threshold Y_TH of data image, judge whether the pixel value in view data is carried out dithering process according to comparative result, wherein Y_TH selects the good Y_TH value of image effect according to practical situation. If it does, then perform step S404; If not, then step S410 is performed.
S404, selects dithering process intensity. Dither functions adjusting strength is selected according to image effect, the YCbCr view data obtained is the binarized pixel value of 0 ~ 255, can by selecting such as low 2 or low 3, the default position of data to do dithering process, if such as picture colour band this kind of situation is obvious, default position can be selected low 3, otherwise, preset position and select low 2.
S405, determines whether first pixel of YCbCr image. If it does, then perform step S407; If not, then step S406 is performed.
S406, record YG_DELTA, CB_DELTA and CR_DELTA.
S407, calculates YG_GRE_M, CB_BLU_M and CR_RED_M.
S408, upgrades YG_DELTA, CB_DELTA and CR_DELTA.
S409, calculates YG_GRE_DEAL, CB_BLU_DEAL, CR_RED_DEAL.
S410, output image.
In another embodiment of the present invention, as shown in Figure 5, for, when requiring finally to export the image for RGB color, this image dithering process method mainly comprises the following steps:
S501, obtains YCbCr data.
S502, judges whether to select RGB color to carry out dithering process. If it does, then perform step S503; If not, then step S504 is performed.
S503, carries out color space conversion, by view data from YCbCr color space conversion to RGB color.
S504, carries out dithering process at YCbCr color space, then performs step S506.
S505, carries out dithering process at RGB color.
S506, carries out color space conversion, and after being about to process, view data is from YCbCr color space conversion to RGB color.
S507, exports the image of rgb format.
Therefore, for the image requiring that last output is RGB color, it is possible to select after Y, Cb, Cr are carried out dithering process by YCbCr color space, be then converted to RGB color and export. Can also select to be first RGB color by YCbCr color space conversion, after then R, G, B being carried out dithering process, directly export.
Image dithering process method according to embodiments of the present invention, adopts the process of the intensity according to the adjustment shake of adjacent pixel, while increasing Randomized Quantizing error, keeps the dependency of neighbor. Meanwhile, participate in Jitter Calculation by multiple pixel, enhance the kinetic characteristic of image. In addition, this treatment process while effectively removing the problems such as colour band, can keep the consistence of adjacent pixels color.
As shown in Figure 6, the image dithering process device that second aspect present invention embodiment proposes comprises acquisition module 10 and dithering process module 20. If this image dithering process device is by judging the brightness information of the pixel value of the image of acquisition, select the process range of shake, and select color space according to demand, the value of the details part of the preceding pixel of record sign, in order to process current pixel value, finally export.
Wherein, acquisition module 10 is for obtaining view data. Dithering process module 20 is for generating N number of random array according to the N number of pixel value in view data, and according to N number of random array, the N+1 pixel value carried out dithering process, and the intermediate value according to the N+1 the pixel value carrying out the N+1 pixel value in dithering process process producing generates N+1 random array, finally according to N+1 random array, the N+2 pixel value is carried out dithering process, until the pixel value of this view data all processes complete, wherein, N be greater than 0 integer.
In an embodiment of the present invention, the view data of acquisition belongs to YCbCr color space.
In one embodiment of the invention, as shown in Figure 6, this image dithering process device also comprises register 30. Register 30 is connected with acquisition module 10, and register 30 internal memory contains luminance threshold Y_TH, for the switch of the brightness according to the view data obtained and the comparative result control dithering process module 20 of this luminance threshold Y_TH. Wherein, Y_TH selects the good Y_TH value of image effect according to practical situation. Namely saying, when the brightness value Y of data image is less than or equal to luminance threshold Y_TH, register 30 controls to open the dither functions of dithering process module 20.
In the present embodiment, that is, register 30 can select the switch of dither functions as required. When such as taking image, colour band is relatively more serious, then can select to open dither functions and carry out dithering process, increases the dynamicrange of image, eliminates colour band to the impact of image effect. Otherwise, it is possible to select to close dither functions such as bypass dithering process module 20, directly carry out image output.
In another embodiment of the present invention, as shown in Figure 7 A, this image dithering process device also comprises space transforming module 40. Space transforming module 40 is connected with acquisition module 10, space transforming module 40 for will obtain view data from YCbCr color space conversion to RGB color. Owing to input image data is YCbCr data, if demand does dithering process at YCbCr color space, then directly carry out dithering process; If demand does dithering process at rgb space, then needing space transforming module 40 by view data from YCbCr color space conversion to RGB color, then dithering process module 20 carries out dithering process again.
Further, in one embodiment of the invention, as N=1, dithering process module 20 also for using the value corresponding to the default position of first pixel value as first random array, for the process of the 2nd pixel value. In embodiments of the present invention, dither functions adjusting strength can be selected according to the image effect of the image obtained, because the view data obtained is the binarized pixel value of 0 ~ 255, so such as low 2 or low 3, the default position of view data can be selected to do dithering process according to image effect, if such as picture colour band this kind of situation is obvious, default position can be selected low 3, otherwise, preset position and select low 2. Wherein, when selecting default position to be low 2, dithering process is relatively weak.
In an example of the present invention, dithering process module 20 according to the selection of dither functions intensity, when N value is 1, the value of low 2 or low 3 of record first pixel, as random array YG_DELTA, CB_DELTA and CR_DELTA of the first pixel, for the calculating of the 2nd pixel. And the value of the first pixel does not process, directly export.
In one embodiment of the invention, the N+1 pixel value is also carried out dithering process to generate the intermediate value of the N+1 pixel value by following formula by dithering process module 20:
YG_GRE_M=YG_GRE+YG_DELTA;
CB_BLU_M=CB_BLU+CB_DELTA;
CR_RED_M=CR_RED+CR_DELTA;
Wherein, YG_GRE, CB_BLU and CR_RED are the N+1 pixel value, YG_DELTA, CB_DELTA and CR_DELTA are N number of random array, YG_GRE_M, CB_BLU_M and CR_RED_M are the intermediate value of the N+1 pixel value of YCbCr or RGB produced in treating processes, determine by above-mentioned color-space choosing.
That is, in an example of the present invention, random array according to first pixel also processes current the 2nd pixel value by above-mentioned formula, thus obtain intermediate value YG_GRE_M, CB_BLU_M, CR_RED_M of the 2nd pixel, wherein YG_GRE_M, CB_BLU_M, CR_RED_M value can represent the value of Y, CB, CR or R, G, B respectively, determines by the selection of color space before. Meanwhile, if the value of YG_GRE_M, CB_BLU_M, CR_RED_M generated is greater than 255, then it is 255 by this variable assignment, otherwise does not process.
In an embodiment of the present invention, dithering process module 20 also exports after the value of the default position of YG_GRE_M, CB_BLU_M and CR_RED_M being reset. That is, the value of low 2 or low 3 of intermediate value YG_GRE_M, CB_BLU_M, CR_RED_M is reset by dithering process module 20, assignment is to new pixel value YG_GRE_DEAL, CB_BLU_DEAL, CR_RED_DEAL, its value is the result of dithering process module 20 dithering process, as final output.
In one embodiment of the invention, dithering process module 20 also for the Y value of the N+1 pixel value is directly exported, and the Cb value and Cr value to the N+1 pixel value carries out dithering process thus CB_BLU_DEAL, CR_RED_DEAL value of obtaining replaces exporting; Or, for black white image, brightness has the image that water ripples shape changes, and the Y value of the N+1 pixel value can be carried out dithering process by dithering process module 20, eliminates water ripple phenomenon, and the Cb value of the N+1 pixel value and Cr value is directly exported.
In one embodiment of the invention, dithering process module 20 also for using the value of the default position of YG_GRE_M, CB_BLU_M and CR_RED_M as the random array of N+1. That is, dithering process module 20 choose respectively the process intermediate value YG_GRE_M of the N+1 pixel value obtained above, CB_BLU_M, CR_RED_M default position such as low 2 or low 3, as the random array of N+1 pixel value, then assignment is distinguished to YG_DELTA, CB_DELTA and CR_DELTA, override with the value of the random array that N number of pixel value is generated, for the calculating of the N+2 pixel value.
Analogizing successively, the N+2 pixel value is also carried out dithering process according to N+1 random array by dithering process module 20, until the pixel value of view data all processes complete.
In yet another embodiment of the present invention, as shown in Figure 7 B, for the image requiring that last output is RGB color, register 30 can control dithering process module 20 and select after Y, Cb, Cr are carried out dithering process by YCbCr color space, then controls space transforming module 40 and the view data after process is exported to RGB color from YCbCr color space conversion. In another embodiment of the present invention, as shown in Figure 7 A, register 30 can also be selected first to control space transforming module 40 by data image from YCbCr color space conversion to RGB color, after then R, G, B are carried out dithering process by control dithering process module 20, directly exports.
Image dithering process device according to embodiments of the present invention, it is possible to according to the intensity of adjacent pixel adjustment shake, while increasing Randomized Quantizing error, keep the dependency of neighbor. Meanwhile, participate in Jitter Calculation by multiple pixel, enhance the kinetic characteristic of image. In addition, this treatment unit while effectively removing the problems such as colour band, can keep the consistence of adjacent pixels color.
Describe and can be understood in schema or in this any process otherwise described or method, represent and comprise one or more for realizing the module of the code of the performed instruction of the step of specific logical function or process, fragment or part, and the scope of the preferred embodiment of the present invention comprises other realization, wherein can not according to order that is shown or that discuss, comprise according to involved function by the mode while of basic or by contrary order, carrying out n-back test, this should be understood by embodiments of the invention person of ordinary skill in the field.
In flow charts represent or in this logic otherwise described and/or step, such as, the sequencing list of the performed instruction for realizing logic function can be considered as, may be embodied in any computer-readable medium, for instruction execution system, device or equipment (as based on system for computer, the system comprising treater or other can from instruction execution system, device or equipment instruction fetch and perform the system of instruction) use, or use in conjunction with these instruction execution systems, device or equipment. With regard to this specification sheets, " computer-readable medium " can be any can comprise, store, communicate, propagate or transmission program for instruction execution system, device or equipment or the device that uses in conjunction with these instruction execution systems, device or equipment. The example more specifically (non-exhaustive list) of computer-readable medium comprises following: the electrical connection section (electronic installation) with one or more wiring, portable computer diskette box (magnetic device), random access memory (RAM), read-only storage (ROM), erasable edit read-only storage (EPROM or dodge speed storer), fiber device, and portable optic disk read-only storage (CDROM). In addition, computer-readable medium is it is even possible that be paper or other the suitable media that can print described program thereon, because can such as by paper or other media be carried out optical scanning, then carry out editing, decipher or carry out process with other suitable methods if desired and electronically obtain described program, then store it in computer memory.
It is to be understood that each several part of the present invention can realize with hardware, software, firmware or their combination. In the above-described embodiment, multiple step or method can realize with the software stored in memory and perform by suitable instruction execution system or firmware. Such as, if realized with hardware, the same with in another enforcement mode, can realize with the arbitrary item in following technology well known in the art or their combination: the discrete logic with the logic gates for data signal being realized logic function, there is the application specific integrated circuit of suitable combinational logic gating circuit, programmable gate array (PGA), field-programmable gate array (FPGA) etc.
Those skilled in the art are appreciated that realizing all or part of step that above-described embodiment method carries is can be completed by the hardware that program carrys out instruction relevant, described program can be stored in a kind of computer-readable recording medium, this program perform time, step comprising embodiment of the method one or a combination set of.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing module, it is also possible to is that the independent physics of each unit exists, it is also possible to two or more unit are integrated in a module. Above-mentioned integrated module both can adopt the form of hardware to realize, it is also possible to adopts the form of software function module to realize. If described integrated module realize using the form of software function module and as independent production marketing or when using, it is also possible to be stored in a computer read/write memory medium.
The above-mentioned storage media mentioned can be read-only storage, disk or CD etc.
In the description of this specification sheets, at least one embodiment that the description of reference term " embodiment ", " some embodiments ", " example ", " concrete example " or " some examples " etc. means to be contained in the present invention in conjunction with concrete feature, structure, material or feature that this embodiment or example describe or example. In this manual, the schematic representation of above-mentioned term is not necessarily referred to identical embodiment or example. And, the concrete feature of description, structure, material or feature can combine in an appropriate manner in any one or more embodiment or example.
Although it has been shown and described that embodiments of the invention, for the ordinary skill in the art, being appreciated that and these embodiments can be carried out multiple change, amendment, replacement and modification without departing from the principles and spirit of the present invention, the scope of the present invention is by claims and equivalent limits.