CN103841388A - Mosaic removing method and device - Google Patents

Mosaic removing method and device Download PDF

Info

Publication number
CN103841388A
CN103841388A CN201410077102.3A CN201410077102A CN103841388A CN 103841388 A CN103841388 A CN 103841388A CN 201410077102 A CN201410077102 A CN 201410077102A CN 103841388 A CN103841388 A CN 103841388A
Authority
CN
China
Prior art keywords
current pixel
pixel location
component
color
grad
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.)
Withdrawn
Application number
CN201410077102.3A
Other languages
Chinese (zh)
Inventor
王栋
孔晓东
茅云杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201410077102.3A priority Critical patent/CN103841388A/en
Publication of CN103841388A publication Critical patent/CN103841388A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention provides a mosaic removing method and device, and relates to the technical field of image processing. The mosaic removing method improves the color reproduction effect of pixels and is better in pixel actual color restoration effect. The method comprises the steps that gradients of a current position pixel in a plurality of preset directions are obtained and a gradient threshold is determined according to the gradients in the preset directions; relative luminance component information of the current position pixel is determined; according to the relative luminance component information of the current position pixel, color values of the current position pixel in various target directions are obtained, wherein the target directions are the directions, where the gradients of the current position pixel are smaller than the gradient threshold, in the preset directions; according to the color values of the current position pixel in all the target directions, an average color value is calculated; according to known color component values of the current position pixel and the average color value of the current position pixel, missing color component values of the current position pixel are obtained; according to the known color component values and the missing color component values, the current position pixel is output.

Description

A kind of method of demosaicing and device
Technical field
The present invention relates to technical field of image processing, relate in particular to a kind of method and device of demosaicing.
Background technology
Along with the development of the communication technology, increasing electronic equipment can be used in shooting digital image.In order to reduce light path control in the electronic equipment that can take digital image and complexity and the cost of photosensitive imaging chip, the original RAW data of imaging of most electronic products generally adopt Bayer form.
In the digital image of Bayer form, each pixel is only preserved the wherein a kind of color component in RGB (RGB, Red Green Blue) three primary colors, and another two kinds of color components are shared by its neighborhood pixels.As shown in Figure 1, the digital image of Bayer form, with the format permutation of GRGR, BGBG, presents a kind of mosaic shape.In the time showing output digital image, in order to recover the true colors information of digital image, be RGB triple channel form by digital image from Bayer format conversion, logarithmic code image carries out demosaicing (Demosaic, Decrease Mosaic).The digital image of RGB triple channel form can be stored for the RGB color of each pixel in storage colouring information, namely stores the rgb value of each pixel.As shown in Figure 2, the digital image of RGB triple channel form according to brightness from secretly representing respectively tri-passages of RGB to three kinds of bright different gray scales.
In prior art, Demosaic utilizes the correlation between pixel to recover disappearance color component information by known portions information, general selectivity weighted mean method and the convertible ladder number of degrees (VNG, Various Number of Gradients) the method scheduling algorithm logarithmic code image that adopts nearest neighbor method, weighted mean method, consideration gradient direction carries out demosaicing.Wherein, VNG method is to select the colouring information that changes less direction to average the method that obtains current pixel disappearance colouring information according to the directivity of color gradient, is a kind of actual effect better method that compares.
But, in the fast-changing while brightness of color also scene jumpy, when any algorithm logarithmic code image carries out demosaicing in employing prior art, all there will be abnormal colour bar or color point, the effect of the true colors of recovery pixel is poor.
Summary of the invention
Embodiments of the invention provide a kind of method and device of demosaicing, can effectively solve in scene brightness and the fast-changing situation of colourity, utilize traditional demosaicing method logarithmic code image to carry out the abnormal problem such as coloured silk point or colour bar occurring when demosaicing is processed, improved the colour reproduction effect of pixel, the effect of the true colors of recovery pixel is better.
For achieving the above object, embodiments of the invention adopt following technical scheme:
First aspect, the embodiment of the present invention provides a kind of method of demosaicing, and the method comprises:
Obtain the Grad of current pixel location on multiple preset directions, and determine the Grads threshold of current pixel location according to the Grad on described multiple preset directions;
Determine the relative brightness component information of described current pixel location;
According to the relative brightness component information of described current pixel location, obtain the color value on described current pixel location each target direction in described multiple preset directions, wherein, described target direction is the direction that the Grad of described current pixel location in described multiple preset directions is less than described Grads threshold, and described current pixel location has at least one target direction;
According to the color value on each target direction of described current pixel location, statistical color mean value;
According to the known color component value of described current pixel location and described color average, obtain the disappearance color component value of described current pixel location;
According to described known color component value and described disappearance color component value, export described current pixel location.
In the possible implementation of the first of first aspect, the Grad of described acquisition current pixel location on multiple preset directions, and after determining current pixel location Grads threshold according to the Grad on described multiple preset directions, before determining the relative brightness component information of described current pixel location, described method also comprises:
Grad on more described multiple preset direction and described Grads threshold;
In described multiple preset directions, described Grad is less than to the target direction that the orientation determination of described Grads threshold is described current pixel location.
In conjunction with the possible implementation of the first of aforementioned first aspect or first aspect, in the possible implementation of the second of first aspect, the described relative brightness component information of determining described current pixel location, comprising:
If described current pixel location is green G component pixel, the relative brightness component information using the G component value of described current pixel location as described current pixel location;
If described current pixel location is red R component pixel or blue B component pixel, calculate the first arithmetic mean of the G component value of described each target direction of described current pixel location, and described the first arithmetic mean is defined as to the relative brightness component information of described current pixel location.
In the third possible implementation of first aspect, before the Grad of described acquisition current pixel location on multiple preset directions, described method also comprises:
Obtain the pel array of the n × n centered by described current pixel location, wherein, n is more than or equal to 3.
In conjunction with the third possible implementation of first aspect, in the 4th kind of possible implementation of first aspect, the Grad of the described current pixel location of described acquisition on multiple preset directions, comprising:
In described pel array, if described current pixel location is G component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the first preset rules;
In described pel array, if described current location is R component pixel or B component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the second preset rules.
In conjunction with the possible four kinds of possible implementations of implementation to the of the first of aforesaid first aspect or first aspect, in the 5th kind of possible implementation of first aspect, in described pel array, obtain the relative brightness component information of the each position pixel on each target direction;
According to the relative brightness component information of the each position pixel on the relative brightness component information of described current pixel location and described each target direction, obtain the color value on each target direction of described current pixel location, the color value on described each target direction comprises the value of R component, G component and B component on target direction.
In conjunction with the 5th kind of possible implementation of first aspect, in the 6th kind of possible implementation of first aspect, described statistical color mean value, comprising:
Color value on Grad according to described current pixel location on described each target direction and each target direction of described current pixel location, calculate the weighted average of the Grad of described current pixel location on described each target direction, to obtain described color average;
Or,
The second arithmetic mean that calculates the color value on each target direction of described current pixel location, wherein, described the second arithmetic mean is described color average.
Second aspect, embodiments of the invention provide a kind of device of demosaicing, and this device comprises:
Acquiring unit, for obtaining the Grad of current pixel location on multiple preset directions, and for obtaining the color value of described current pixel location on each target direction of described multiple preset directions, wherein, described target direction is the direction that the Grad of described current pixel location in described multiple preset directions is less than described Grads threshold, described current pixel location has at least one target direction, and for according to the known color component value of described current pixel location and described color average, obtain the disappearance color component value of described current pixel location,
Determining unit, determines the Grads threshold of current pixel location for the Grad on the described multiple preset directions that get according to described acquiring unit, and for determining the relative brightness component information of described current pixel location;
Computing unit, for the color value on each target direction of the described current pixel location that gets according to described acquiring unit, statistical color mean value;
Output unit, for the described disappearance color component value getting according to described known color component value and described acquiring unit, exports described current pixel location.
In the first possibility implementation of second aspect, described determining unit, also for after definite current pixel location Grads threshold, before determining the relative brightness component information of described current pixel location, Grad on more described multiple preset direction and described Grads threshold, and in described multiple preset directions, described Grad is less than to the target direction that the orientation determination of described Grads threshold is described current pixel location.
In conjunction with the first possibility implementation of aforementioned second aspect or second aspect, in the second possibility implementation of second aspect, described determining unit, if be green G component pixel specifically for described current pixel location, the relative brightness component information using the G component value of described current pixel location as described current pixel location, if and be red R component pixel or blue B component pixel specifically for described current pixel location, described the first arithmetic mean described computing unit being calculated is defined as the relative brightness component information of described current pixel location,
Described computing unit, if be also red R component pixel or blue B component pixel for described current pixel location, calculates the first arithmetic mean of the G component value of described each target direction of described current pixel location.
In the third possibility implementation of second aspect, described acquiring unit, also, for obtaining the pel array of the n × n centered by described current pixel location, wherein, n is more than or equal to 3.
In conjunction with the third possible implementation of second aspect, in the 4th kind of possible implementation of second aspect, described computing unit, in the described pel array getting at described acquiring unit, if described current pixel location is G component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the first preset rules, and the described pel array for getting at described acquiring unit also, if described current location is R component pixel or B component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the second preset rules.
In conjunction with any implementation in the possible four kinds of possible implementations of implementation to the of the first of aforesaid second aspect or second aspect, in the 5th kind of possible implementation of second aspect, described acquiring unit, specifically in described pel array, obtain the relative brightness component information of the each position pixel on each target direction, and for according to the relative brightness component information of the each position pixel on the relative brightness component information of described current pixel location and described each target direction, obtain the color value on each target direction of described current pixel location, color value on described each target direction comprises the R component on each target direction, the value of G component and B component.
In conjunction with the 5th kind of possible implementation of second aspect, in the 6th kind of possible implementation of second aspect, described computing unit, specifically for the color value on each target direction of the Grad on described each target direction and described current pixel location according to described current pixel location, calculate the weighted average of the Grad of described current pixel location on described each target direction, to obtain described color average, and specifically for calculating the second arithmetic mean of the color value on each target direction of described current pixel location, wherein, described the second arithmetic mean is described color average.
Embodiments of the invention provide a kind of method and device of demosaicing, the device of demosaicing is by obtaining the Grad of current pixel location on multiple preset directions, determine Grads threshold and the relative brightness component information of current pixel location, then, according to the relative brightness component information of current pixel location, in multiple preset directions, determine at least one target direction of current pixel location, wherein, target direction is the direction that the Grad of current pixel location in multiple preset directions is less than Grads threshold, color value on each target direction of acquisition current pixel location, and according to the color value on each target direction of current pixel location, statistical color mean value, finally, according to known color component value and the color average of current pixel location, obtain the disappearance color component value of current pixel location, and according to known color component value and disappearance color component value, output current pixel location.By this scheme, the present invention has considered scene brightness and the fast-changing situation of colourity simultaneously, colourity and brightness have been carried out to collaborative adjustment, solve the problem of prior art at this type scene abnormal color point of appearance or colour bar, improve the colour reproduction effect of pixel, can have the true colors of efficient recovery pixel.
Brief description of the drawings
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, to the accompanying drawing of required use in embodiment or description of the Prior Art be briefly described below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the distribution schematic diagram of the digital image of Bayer form;
Fig. 2 is the distribution schematic diagram of the digital image of RGB triple channel form;
Fig. 3 is the schematic flow sheet one of the method for the demosaicing of the embodiment of the present invention;
Fig. 4 is the picture element array structure schematic diagram in 5 × 5 regions;
Fig. 5 is the schematic flow sheet two of the method for the demosaicing of the embodiment of the present invention;
Fig. 6 is 5x5 region RGB component data exemplary plot;
Fig. 7 is the structural representation one of the device of the demosaicing of the embodiment of the present invention;
Fig. 8 is the structural representation two of the device of the demosaicing of the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
From the description of background technology, can know, in the time showing output digital image, in order to recover the true colors information of digital image, need logarithmic code image to carry out demosaicing, be RGB triple channel form by digital image from Bayer format conversion.
Wherein, in the prior art, the convertible ladder number of degrees (VNG, Various Number of Gradients) method is because the variable gradient of each pixel color is different in different directions, therefore selecting the colouring information that changes less direction to average the method that obtains current pixel disappearance colouring information according to the directivity of color gradient, is the current demosaicing actual effect better method that compares.
Concrete, the step of VNG method is:
(1) calculate current pixel location 5x5 neighborhood level vertically and eight directions such as diagonal on Grad Grad (i).
(2) set Grads threshold Threshold according to the maximin of eight direction gradient values, and adopt following formula statistical gradient value to be less than the redness (R in all directions of Grads threshold, Red), green (G, Green), blue (B, Blue) the mean value Ravg of component, Gavg, Bavg:
Cavg = 1 N &Sigma;Ci Grad ( i ) < Threshold
Wherein, Ci is less than R, G, the B component value in all directions of Grads threshold at Grad, and Grad (i) is the Grad of current pixel location in any one direction of eight directions, and N is the quantitative value that Grad is less than the direction of Grads threshold.
(3), according to the difference of the known color component value of current pixel location and Ravg, Gavg, Bavg, calculate the disappearance color component value of current pixel location.
For example, if the known color component of current pixel location is G, adopt following formula to calculate the disappearance color component value of current pixel location:
R=Gori+Ravg-Gavg
B=Gori+Bavg-Gavg
G=Gori
Wherein, if when the known color component of current pixel location is R or B, the computational methods when method of disappearance color component value of calculating current pixel location and the known color component of current pixel location are G are similar, no longer describe in detail herein.
Each step by above-mentioned VNG method can be known, even a kind of better method that compares that VNG method is demosaicing actual effect in the prior art, the method is only also the variation of having considered colourity in concrete computational process, and do not consider the variation of brightness, cause in the fast-changing while brightness of color also sharply in fast-changing scene, demosaicing result there will be color point or colour bar, and the effect of the true colors of recovery pixel is poor.
For in the fast-changing while brightness of color also scene jumpy, when in employing prior art, any algorithm logarithmic code image carries out demosaicing, all there will be abnormal colour bar or color point, the poor problem of effect of recovering the true colors of pixel, the embodiment of the present invention provides a kind of method and device of demosaicing.The present invention considers the fast-changing situation of chroma luminance simultaneously, adopt the collaborative method of adjusting of chroma luminance to carry out demosaicing processing to the digital image of Bayer form, effectively improved the colour reproduction effect of pixel, the effect of the true colors of recovery pixel is better.
Various technology described herein is applicable to single lens reflex type camera, ordinary digital camera, card form camera, has in the electronic equipment that can take digital image function with camera function mobile phone, web camera, drive recorder or video monitoring equipment etc.
Embodiment mono-
The embodiment of the present invention provides a kind of method of demosaicing, and as shown in Figure 3, the method comprises:
The device of S101, demosaicing obtains the Grad of current pixel location on multiple preset directions, and determines the Grads threshold of current pixel location according to the Grad on multiple preset directions.
In order to reduce complexity and the cost of light path control and photosensitive imaging chip, the original RAW data of imaging that the overwhelming majority can be used in the electronic product of taking digital image generally adopt Bayer form.In the digital image of Bayer form, each pixel just only has a kind of color component, or R or G or B, need to carry out the other two kinds of colors of interpolation to it by current pixel color around.
Due to, natural scene colouring information is smooth change, and the variable gradient of each pixel color is different in different directions, in order to ensure that current pixel location is carried out after color interpolation, the color of current pixel location can have efficient recovery, the less direction of Array selection change color of demosaicing, the i.e. less direction of Array selection color gradient of demosaicing.
Concrete, in the time that logarithmic code image carries out demosaicing processing, change less direction in order to get color gradient, the device of demosaicing first obtains the Grad of current pixel location on multiple preset directions, and determines the Grads threshold of current pixel location according to the Grad on multiple preset directions.
Further, the device of demosaicing, according to the colouring information of current pixel location, calculates the Grad of current pixel location on multiple preset directions according to the preset rules corresponding with colouring information.Obtaining after the Grad of current pixel location on multiple preset directions, the device of demosaicing is according to the multiple Grad that acquire, determine the Grads threshold of current pixel location, to guarantee the direction of the change color minimum of determining current pixel location, and then effectively obtain the disappearance color value of current pixel location.
Wherein, the device of demosaicing is to be more than or equal to 3 at the n × n(n centered by current pixel location) pel array in obtain the Grad of current pixel location on multiple preset directions, that is to say, demosaicing device, before obtaining the Grad of current pixel location on multiple preset directions, need to first obtain the pel array of the n × n centered by current pixel location.
Exemplary, Fig. 4 is the pel array of a 5x5, Ci represents the color component value of each position in this pel array.
It should be noted that, as shown in Figure 4, preset direction can be these eight directions of East, West, South, North, northeast, the southeast, southwest and northwest of current pixel location, can be also other preset directions.
Further, the device of demosaicing is in the pel array getting, if current pixel location is G component pixel, calculates the Grad on multiple preset directions of current pixel location in pel array according to the first preset rules; If current location is R component pixel or B component pixel, calculate the Grad on multiple preset directions of current pixel location in pel array according to the second preset rules.
It should be noted that, the Grads threshold of the definite current pixel location of the device of demosaicing can be less than 2/3rds of the maximum of the Grad of current pixel location on multiple preset directions and the difference of minimum value for this Grads threshold, also can be greater than for this Grads threshold the minimum value of the Grad of current pixel location on multiple preset directions, and the median that is less than the gradient of current pixel location on multiple preset directions, the embodiment of the present invention does not limit.
The device of S102, demosaicing is determined the relative brightness component information of current pixel location.
Logarithmic code image carries out, in the process of demosaicing, not only will considering the variation of colourity, also will consider the variation of brightness.In the fast-changing scene of chroma luminance, the impact of the variation that especially needs to consider brightness on demosaicing result.
The device of demosaicing acquires after the Grads threshold of the Grad of current pixel location on multiple preset directions and current pixel location, determines the relative brightness component information of current pixel location.
The each pixel of digital image of Bayer form is only preserved the wherein a kind of color component in RGB three primary colors, and another two kinds of color components are shared by its neighborhood pixels.Can be known by Fig. 1, in the digital image of Bayer form, the distribution density of G component is the twice of R, B, all has G component arbitrarily in a row or column, and R component or B component are interval a row or column distributions.Therefore, in the field of a setting, G component all has sampled value in four or eight directions, but R or B component only exist sampled value in part direction.
The brightness of actual scene, colourity only can change fast in certain trend direction, and G component in all directions, all to have sampled value and G component be 60% for the contribution of pixel intensity, can represent the variation tendency of brightness.Therefore, the inventive method is preferentially selected the control parameter of G component as scene brightness variation tendency.
Concrete, if current pixel location is G component pixel, the relative brightness component information using the G component value of current pixel location as current pixel location; If current pixel location is R component pixel or B component pixel, calculates the first arithmetic mean of the G component value of each target direction of current pixel location, and the first arithmetic mean is defined as to the relative brightness component information of current pixel location.
The device of S103, demosaicing, according to the relative brightness component information of current pixel location, obtains the color value on current pixel location each target direction in described multiple preset directions.
Wherein, target direction is the direction that the Grad of current pixel location in multiple preset directions is less than Grads threshold, and current pixel location has at least one target direction.
Concrete, the device of demosaicing is in pel array, obtain the relative brightness component information of the each position pixel on each target direction, then, according to the relative brightness component information of the each position pixel on the relative brightness component information of current pixel location and each target direction, the color value on each target direction of calculating current pixel location.
Wherein, on each target direction, have a pixel at least, the method that the device of demosaicing obtains the method for relative brightness component information of the each position pixel on each target direction and the relative brightness component information of the device of demosaicing acquisition current pixel location is identical.
Exemplary, the method that the device of demosaicing obtains the relative brightness component information of the primary importance pixel in the east side of current pixel location is: the device of demosaicing obtains the first pel array of the n × n centered by primary importance pixel, obtains the relative brightness component information of the primary importance pixel in the east side of current pixel location according to the method for the S101 in the embodiment of the present invention and S102.
It should be noted that, the color value on each target direction comprises the value of R component, G component and B component on each target direction.
The device of S104, demosaicing is according to the color value on each target direction of current pixel location, statistical color mean value.
Target direction is the direction that Grad is less than Grads threshold, the device of demosaicing gets after color value on each target direction, according to colouring information, these color values are averaged to acquisition color average, and then utilize color average to carry out color interpolation to current pixel location, be that the device of demosaicing is according to the color value on each target direction of the current pixel location acquiring, statistical color mean value.
Concrete, the device of demosaicing gets after the value of R component, G component and B component on each target direction, and the color value getting, according to the difference of colouring information, is calculated respectively to the color average of R component, G component and B component.
Further, color value on each target direction of the device of the demosaicing Grad on each target direction and current pixel location according to current pixel location, calculate the weighted average of the Grad of current pixel location on each target direction, to obtain color average;
Or,
The second arithmetic mean of the color value on each target direction of the device calculating current pixel location of demosaicing, wherein, the second arithmetic mean is color average.
The device of S105, demosaicing, according to known color component value and the color average of current pixel location, obtains the disappearance color component value of current pixel location.
The device of demosaicing counts after color average, utilizes known color component value and the color average of current pixel location, can directly calculate the disappearance color component value of current pixel location.
The device of S106, demosaicing, according to the disappearance color component value of the known color component value of current pixel location and current pixel location, is exported current pixel location.
The digital image of RGB triple channel form can be stored for the RGB color of each pixel in storage colouring information, namely stores the rgb value of each pixel.In the time showing output digital image, in order to recover the true colors information of digital image, be RGB triple channel form by digital image from Bayer format conversion, logarithmic code image carries out Demosaic.
The device of demosaicing is acquiring after the disappearance color component value of current pixel location, the device of demosaicing obtains three kinds of color component value in the three primary colors that just obtained current pixel location, the device of demosaicing according to these three kinds of color component value outputs, has completed the demosaicing processing to current pixel location by current pixel location.
The method of existing demosaicing is only to consider the directivity of color gradient and select the colouring information that changes less direction to average the disappearance colouring information that obtains current pixel location.Different from the method for existing demosaicing, in the inventive method, the color value of each target direction obtaining due to the device of demosaicing is to obtain according to the relative brightness component information of the each position pixel on the relative brightness component information of current pixel location and each target direction, therefore the color average that, the device of demosaicing obtains also obtains according to relative brightness component information.Like this, in the inventive method, the disappearance color component value of the current pixel location that the device of demosaicing obtains is more accurate, even in the fast-changing while brightness of color also scene jumpy, also can effectively recover the true colors of pixel.
Embodiments of the invention provide a kind of method of demosaicing, the device of demosaicing is by obtaining the Grad of current pixel location on multiple preset directions, determine current pixel location with Grads threshold and relative brightness component information, then, according to the relative brightness component information of current pixel location, in multiple preset directions, determine at least one target direction of current pixel location, wherein, target direction is the direction that the Grad of current pixel location in multiple preset directions is less than Grads threshold, color value on each target direction of acquisition current pixel location, and according to the color value on each target direction of current pixel location, statistical color mean value, finally, according to known color component value and the color average of current pixel location, obtain the disappearance color component value of current pixel location, and according to known color component value and disappearance color component value, output current pixel location.By this scheme, the present invention has considered scene brightness and the fast-changing situation of colourity simultaneously, colourity and brightness have been carried out to collaborative adjustment, solve the problem of prior art at this type scene abnormal color point of appearance or colour bar, improve the colour reproduction effect of pixel, can have the true colors of efficient recovery pixel.
Embodiment bis-
The embodiment of the present invention provides a kind of method of demosaicing, and as shown in Figure 5, the method comprises:
The device of S201, demosaicing obtains the digital image of Bayer form, and in this digital image, obtains the pel array of the n × n centered by current pixel location, and wherein, n is more than or equal to 3.
In order to reduce complexity and the cost of light path control and photosensitive imaging chip, the original RAW data of imaging that the overwhelming majority can be used in the electronic product of taking digital image generally adopt Bayer form.In the digital image of Bayer form only there is the wherein a kind of color component in Red Green Blue in each pixel, need to carry out the other two kinds of colors of interpolation to it by current pixel color around.
Concrete, the device of demosaicing gets the digital image of Bayer form, in the time it being carried out to demosaicing processing, n × the n(n that need to obtain centered by current pixel location in this digital image is more than or equal to 3) pel array, to get the color dropout component of current pixel location.
Wherein, it is the optimal selection of the inventive method that n equals 5, adopts n to equal 5 and describe in the embodiment of the present invention.
Exemplary, Fig. 4 is the pel array of a 5x5, Ci represents the color component value of each position in this pel array.
The device of S202, demosaicing obtains the Grad of current pixel location on multiple preset directions, and determines the Grads threshold of current pixel location according to the Grad on multiple preset directions.
Due to, natural scene colouring information is smooth change, and the variable gradient of each pixel color is different in different directions, in order to ensure that current pixel location is carried out after color interpolation, the color of current pixel location can have efficient recovery, the less direction of Array selection change color of demosaicing, the i.e. less direction of Array selection color gradient of demosaicing.
Concrete, in the time that logarithmic code image carries out demosaicing processing, change less direction in order to get color gradient, the device of demosaicing first obtains the Grad of current pixel location on multiple preset directions, and determines Grads threshold according to the Grad on multiple preset directions.
Wherein, as shown in Figure 4, multiple preset directions can be these eight directions of East, West, South, North, northeast, the southeast, southwest and northwest of current pixel location, can be also other preset directions.
Concrete, the device of demosaicing, according to the colouring information of current pixel location, calculates the Grad of current pixel location on multiple preset directions according to the preset rules corresponding with colouring information.Obtaining after the Grad of current pixel location on multiple preset directions, the device of demosaicing is according to the multiple Grad that acquire, determine the Grads threshold of current pixel location, to guarantee the direction of the change color minimum of determining current pixel location, and then effectively obtain the disappearance color value of current pixel location.
Further, the device of demosaicing is in the pel array getting, if current pixel location is G component pixel, calculates the Grad on multiple preset directions of current pixel location in pel array according to the first preset rules; If current location is R component pixel or B component pixel, calculate the Grad on multiple preset directions of current pixel location in pel array according to the second preset rules.
Exemplary, if the array that pel array is 5x5, current location (x, y) pixel is G component pixel, multiple preset directions are these eight directions of East, West, South, North, northeast, the southeast, southwest and northwest of current pixel location, adopt following formula to calculate the Grad of current pixel location in these eight directions:
Grad _ N = abs ( BLS [ 1 ] [ 3 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 3 ] - BLS [ 4 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 2 ] ) - BLS [ 4 ] [ 2 ] + abs ( BLS [ 2 ] [ 4 ] - BLS [ 4 ] [ 4 ] ) + abs ( BLS [ 1 ] [ 2 ] - BLS [ 3 ] [ 2 ] ) + abs ( BLS [ 1 ] [ 4 ] - BLS [ 3 ] [ 4 ] ) / 4
Grad _ E = abs ( BLS [ 3 ] [ 4 ] - BLS [ 3 ] [ 2 ] ) + abs ( BLS [ 3 ] [ 5 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 4 ] ) - BLS [ 2 ] [ 2 ] + abs ( BLS [ 2 ] [ 4 ] - BLS [ 4 ] [ 4 ] ) + abs ( BLS [ 2 ] [ 5 ] - BLS [ 2 ] [ 3 ] ) + abs ( BLS [ 4 ] [ 5 ] - BLS [ 4 ] [ 3 ] ) / 4
Grad _ S = abs ( BLS [ 4 ] [ 3 ] - BLS [ 2 ] [ 3 ] ) + abs ( BLS [ 5 ] [ 3 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 4 ] [ 4 ] ) - BLS [ 2 ] [ 4 ] + abs ( BLS [ 4 ] [ 2 ] - BLS [ 2 ] [ 2 ] ) + abs ( BLS [ 5 ] [ 4 ] - BLS [ 3 ] [ 4 ] ) + abs ( BLS [ 5 ] [ 2 ] - BLS [ 3 ] [ 2 ] ) / 4
Grad _ W = abs ( BLS [ 3 ] [ 2 ] - BLS [ 3 ] [ 4 ] ) + abs ( BLS [ 3 ] [ 1 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 4 ] [ 2 ] ) - BLS [ 4 ] [ 4 ] + abs ( BLS [ 2 ] [ 2 ] - BLS [ 2 ] [ 4 ] ) + abs ( BLS [ 4 ] [ 1 ] - BLS [ 4 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 1 ] - BLS [ 2 ] [ 3 ] ) / 4
Grad_NE=abs(BLS[2][4]-BLS[4][2])+abs(BLS[1][5]-BLS[3][3])+abs(BLS[1][4]-BLS[3][2])+abs(BLS[2][5]-BLS[4][3])
Grad_SE=abs(BLS[4][4]-BLS[2][2])+abs(BLS[5][5]-BLS[3][3])+abs(BLS[4][5]-BLS[2][3])+abs(BLS[5][4]-BLS[3][2])
Grad_NW=abs(BLS[2][2]-BLS[4][4])+abs(BLS[1][1]-BLS[3][3])+abs(BLS[2][1]-BLS[4][3])+abs(BLS[1][2]-BLS[3][4])
Grad_SW=abs(BLS[4][2]-BLS[2][4])+abs(BLS[5][1]-BLS[3][3])+abs(BLS[5][2]-BLS[3][4])+abs(BLS[4][1]-BLS[2][3])
Wherein, the north that N represents current pixel location to, the east that E represents current pixel location to, the west that E represents current pixel location to, the south that S represents current pixel location to, NE represents the northeastward of current pixel location, SE represents the southeastern direction of current pixel location, northwest that NW represents current pixel location to, the southwest that SW represents current pixel location to, Grad_N, Grad_E, Grad_S, Grad_W, Grad_NE, Grad_SE, Grad_NW, Grad_SW is respectively the Grad of correspondence direction, BLS[y] [x] represent the pixel value of the capable x row of 5x5 neighborhood y of Bayer form, abs(.) represent to ask absolute value.
If the array that pel array is 5x5, current location (x, y) pixel is R component pixel or B component pixel, multiple preset directions are these eight directions of East, West, South, North, northeast, the southeast, southwest and northwest of current pixel location, adopt following formula to calculate the Grad of current pixel location in these eight directions:
Grad _ N = abs ( BLS [ 2 ] [ 3 ] - BLS [ 4 ] [ 3 ] ) + abs ( BLS [ 1 ] [ 3 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 2 ] ) - BLS [ 4 ] [ 2 ] + abs ( BLS [ 2 ] [ 4 ] - BLS [ 4 ] [ 4 ] ) + abs ( BLS [ 1 ] [ 2 ] - BLS [ 3 ] [ 2 ] ) + abs ( BLS [ 1 ] [ 4 ] - BLS [ 3 ] [ 4 ] ) / 2
Grad _ E = abs ( BLS [ 3 ] [ 4 ] - BLS [ 3 ] [ 2 ] ) + abs ( BLS [ 3 ] [ 5 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 4 ] ) - BLS [ 2 ] [ 2 ] + abs ( BLS [ 4 ] [ 4 ] - BLS [ 4 ] [ 2 ] ) + abs ( BLS [ 2 ] [ 5 ] - BLS [ 2 ] [ 3 ] ) + abs ( BLS [ 4 ] [ 5 ] - BLS [ 4 ] [ 3 ] ) / 2
Grad _ S = abs ( BLS [ 4 ] [ 3 ] - BLS [ 2 ] [ 3 ] ) + abs ( BLS [ 5 ] [ 3 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 4 ] [ 4 ] ) - BLS [ 2 ] [ 4 ] + abs ( BLS [ 4 ] [ 2 ] - BLS [ 2 ] [ 2 ] ) + abs ( BLS [ 5 ] [ 4 ] - BLS [ 3 ] [ 4 ] ) + abs ( BLS [ 5 ] [ 2 ] - BLS [ 3 ] [ 2 ] ) / 2
Grad _ W = abs ( BLS [ 3 ] [ 2 ] - BLS [ 3 ] [ 4 ] ) + abs ( BLS [ 3 ] [ 1 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 4 ] [ 2 ] ) - BLS [ 4 ] [ 4 ] + abs ( BLS [ 2 ] [ 2 ] - BLS [ 2 ] [ 4 ] ) + abs ( BLS [ 4 ] [ 1 ] - BLS [ 4 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 1 ] - BLS [ 2 ] [ 3 ] ) / 2
Grad _ NE = abs ( BLS [ 2 ] [ 4 ] - BLS [ 4 ] [ 2 ] ) + abs ( BLS [ 1 ] [ 5 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 3 ] ) - BLS [ 3 ] [ 2 ] + abs ( BLS [ 3 ] [ 4 ] - BLS [ 4 ] [ 3 ] ) + abs ( BLS [ 1 ] [ 4 ] - BLS [ 2 ] [ 3 ] ) + abs ( BLS [ 2 ] [ 5 ] - BLS [ 3 ] [ 4 ] ) / 2
Grad _ SE = abs ( BLS [ 4 ] [ 4 ] - BLS [ 2 ] [ 2 ] ) + abs ( BLS [ 5 ] [ 5 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 3 ] [ 4 ] ) - BLS [ 2 ] [ 3 ] + abs ( BLS [ 4 ] [ 3 ] - BLS [ 3 ] [ 2 ] ) + abs ( BLS [ 4 ] [ 5 ] - BLS [ 3 ] [ 4 ] ) + abs ( BLS [ 5 ] [ 4 ] - BLS [ 4 ] [ 3 ] ) / 2
Grad _ NW = abs ( BLS [ 2 ] [ 2 ] - BLS [ 4 ] [ 4 ] ) + abs ( BLS [ 1 ] [ 1 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 3 ] [ 2 ] ) - BLS [ 4 ] [ 3 ] + abs ( BLS [ 2 ] [ 3 ] - BLS [ 3 ] [ 4 ] ) + abs ( BLS [ 2 ] [ 1 ] - BLS [ 3 ] [ 2 ] ) + abs ( BLS [ 1 ] [ 2 ] - BLS [ 2 ] [ 3 ] ) / 2
Grad _ SW = abs ( BLS [ 4 ] [ 2 ] - BLS [ 2 ] [ 4 ] ) + abs ( BLS [ 5 ] [ 1 ] - BLS [ 3 ] [ 3 ] ) + abs ( BLS [ 4 ] [ 3 ] ) - BLS [ 3 ] [ 4 ] + abs ( BLS [ 3 ] [ 2 ] - BLS [ 2 ] [ 3 ] ) + abs ( BLS [ 5 ] [ 2 ] - BLS [ 4 ] [ 3 ] ) + abs ( BLS [ 4 ] [ 1 ] - BLS [ 3 ] [ 2 ] ) / 2
Wherein, the north that N represents current pixel location to, the east that E represents current pixel location to, the west that E represents current pixel location to, the south that S represents current pixel location to, NE represents the northeastward of current pixel location, SE represents the southeastern direction of current pixel location, northwest that NW represents current pixel location to, the southwest that SW represents current pixel location to, Grad_N, Grad_E, Grad_S, Grad_W, Grad_NE, Grad_SE, Grad_NW, Grad_SW is respectively the Grad of correspondence direction, BLS[y] [x] represent the pixel value of the capable x row of 5x5 neighborhood y of Bayer form, abs(.) represent to ask absolute value.
It should be noted that, the definite Grads threshold of device of demosaicing can be less than 2/3rds of the maximum of the Grad of current pixel location on multiple preset directions and the difference of minimum value for this Grads threshold, also can be greater than for this Grads threshold the minimum value of the Grad of current pixel location on multiple preset directions, and the median that is less than the Grad of current pixel location on multiple preset directions, the embodiment of the present invention does not limit.
For example, the building B ayer format-pattern that the device of demosaicing comprises parallel fence to a width carries out demosaicing processing, and Fig. 6 is one of them 5x5 region RGB component data example.Wherein, R component represents by italic, and B component underlines expression, and the overstriking of G component represents.The device of demosaicing is according to the formula of above-mentioned compute gradient value, the Grad of eight neighborhood directions of each position pixel in calculating chart, wherein, Fig. 6 center position pixel is R component pixel, the formula that calculates the Grad of current pixel location while adopting the aforementioned current pixel location of this paper to be R component pixel calculates eight Grad of this center pixel, the Grad of these eight neighborhood directions from the north of center position pixel to, be followed successively by according to the arranged clockwise of direction: 567,480,23,459,559,462,19,461.The device of demosaicing, obtaining after the Grad of center position pixel in eight directions, according to these eight Grad, adds that by the half of Grad scope 1.5 times of minimal gradient value are defined as Grads threshold, and Grads threshold is 302.
Grad on the more multiple preset directions of device of S203, demosaicing and the Grads threshold of current pixel location, and determine that at multiple preset directions Grad is less than the target direction that the direction of Grads threshold is current pixel location.
In order to ensure that current pixel location is carried out after color interpolation, the color of current pixel location can have efficient recovery, the device of demosaicing is obtaining the Grad of current pixel location on multiple preset directions, and determine according to the Grad on multiple preset directions after the Grads threshold of current pixel location, Grad on more multiple preset directions and the Grads threshold of current pixel location, determine and select the less direction of change color, the i.e. less direction of Array selection color gradient of demosaicing.
Concrete, Grad on the more multiple preset directions of device of demosaicing and the Grads threshold of current pixel location, then, the device of demosaicing, in multiple preset directions, is less than by Grad the target direction that the orientation determination of Grads threshold is current pixel location.
The device of S204, demosaicing is determined the relative brightness component information of current pixel location.
Logarithmic code image carries out, in the process of demosaicing, not only will considering the variation of colourity, also will consider the variation of brightness.In the fast-changing scene of chroma luminance, the impact of the variation that especially needs to consider brightness on demosaicing result.
The device of demosaicing acquires after the Grads threshold of the Grad of current pixel location on multiple preset directions and current pixel location, determines the relative brightness component information of current pixel location.
In the digital image of Bayer form, the distribution density of G component is the twice of R, B, all has G component arbitrarily in a row or column, and R or B component are interval a row or column distributions.Therefore, in the field of a setting, G component all has sampled value in four or eight directions, but R or B component only exist sampled value in part direction.
The brightness of actual scene, colourity only can change fast in certain trend direction, and G component in all directions, all to have sampled value and G component be 60% for the contribution of pixel intensity, can represent the variation tendency of brightness.Therefore, the inventive method is preferentially selected the control parameter of G component as scene brightness variation tendency.
Concrete, if current pixel location is G component pixel, the relative brightness component information using the G component value of current pixel location as current pixel location; If current pixel location is R component pixel or B component pixel, calculate the first arithmetic mean of the G component value of each target direction of current pixel location, and the first arithmetic mean is defined as to the relative brightness component information of current pixel location, wherein, target direction is the direction that Grad is less than Grads threshold, and the target direction of current pixel location has one at least.
Further, the device of demosaicing adopts following formula to determine the relative brightness component information of current pixel location:
Figure BDA0000472681420000191
Wherein, Y represents the relative brightness component information of current pixel location, N is the direction number that Grad is less than Grads threshold, Gi is that Grad is less than the G component value in the direction of Grads threshold, Grad(i) be the Grad on each preset direction of current pixel location, Threshold is the definite Grads threshold of the device of demosaicing
Figure BDA0000472681420000192
for the summation of the G component value of each target direction of current pixel location.
Exemplary, Fig. 6 center position pixel is R component pixel, the Grad of eight neighborhood directions of this center position pixel from the north of center position pixel to, arranged clockwise according to direction is followed successively by: 567,480,23,459,559,462,19,461, and Grads threshold is 302.In the Grad of these eight neighborhood directions, Grad 23 and 19 is all less than Grads threshold 302, the east of center position pixel to west to Grad be less than Grads threshold.The east of center position pixel to G component value be 256, west to G component value be 257, therefore, the device of demosaicing is in the time of the relative brightness component information of computer center's point position, and specific formula for calculation is: Y=(256+257)/2=256.5.
The device of S205, demosaicing is according to the relative brightness component information of current pixel location, obtains the color value on each target direction of current pixel location.
Concrete, on current pixel location each target direction in pel array, have at least a pixel to exist, the device of demosaicing is in pel array, first obtain the relative brightness component information of the each position pixel on each target direction, then, according to the relative brightness component information of the each position pixel on the relative brightness component information of current pixel location and each target direction, the color value on each target direction of calculating current pixel location.
It should be noted that, the method that the device of demosaicing obtains the method for relative brightness component information of the each position pixel on each target direction and the relative brightness component information of the device of demosaicing acquisition current pixel location is identical.
Exemplary, the method that the device of demosaicing obtains the relative brightness component information of the primary importance pixel in the east side of current pixel location is: the device of demosaicing obtains the first pel array of the n × n centered by primary importance pixel, obtains the relative brightness component information of the primary importance pixel in the east side of current pixel location according to the method for the S202 in the embodiment of the present invention and S203.
It should be noted that, the color value on each target direction comprises the value of R component, G component and B component on each target direction.
Concrete, the computing formula of the color value on each target direction of current pixel location is:
Ca ( i ) = 1 N Y &Sigma; Grad ( i ) < Threshold Ci / Yi
Wherein, Ca(i) be the color value of R component on each target direction, G component, B component, N is the number of target direction, Y is the relative brightness component information of current pixel location, Ci is the color component value of each position pixel of target direction, Yi is the relative brightness component information corresponding with Ci
Figure BDA0000472681420000202
for Ci/Yi being sued for peace on each target direction.
The device of S206, demosaicing is according to the color value on each target direction of current pixel location, statistical color mean value.
Target direction is the direction that Grad is less than Grads threshold, the device of demosaicing gets after color value on each target direction, according to colouring information, these color values are averaged to acquisition color average, and then utilize color average to carry out color interpolation to current pixel location, be that the device of demosaicing is according to the color value on each target direction of the current pixel location acquiring, statistical color mean value.
Concrete, the device of demosaicing gets after the color value of R component, G component and B component on each target direction, and the color value getting, according to the difference of colouring information, is calculated respectively to the color average of R component, G component and B component.
Further, color value on each target direction of the device of the demosaicing Grad on each target direction and current pixel location according to current pixel location, calculate the weighted average of the Grad of current pixel location on each target direction, to obtain color average;
Or,
The second arithmetic mean of the color value on each target direction of the device calculating current pixel location of demosaicing, wherein, the second arithmetic mean is color average.
Concrete, the device of demosaicing is according to the color value on each target direction of current pixel location, and statistical color mean value adopts following formula:
Cwavg = 1 N * GradSum &Sigma; Grad ( i ) < Threshold Ca ( i ) * [ GardSum - Gard ( i ) ]
Wherein, Cwavg is the color average of different colours information, N is the quantity of target direction, GradSum is that Grad is less than the Grad sum in all directions of Grads threshold, Ca (i) is the color value of R component on each target direction, G component, B component, the Grad that Grad (i) is each target direction.
Further, because method of the present invention has been set Grads threshold, only the less neighborhood direction of gradient is carried out to computing, therefore, the device of demosaicing is in the time of statistical color mean value, also can not calculate the following formula of concrete employing according to power such as the gradient weighted average of all directions are reduced to:
Cwavg = 1 N &Sigma; Grad ( i ) < Threshold Ca ( i )
Wherein, Cwavg is the color average of different colours information, the quantity that N is target direction, and Ca (i) is the color value of R component on each target direction, G component, B component, for the color value on each target direction is sued for peace.
Exemplary, according to above-mentioned formula, calculate the direction neighborhood color average that Fig. 6 center position pixel is less than Grads threshold and be: R component is that 179, G component is that 257, B component is 156.
The device of S207, demosaicing, according to known color component value and the color average of current pixel location, obtains the disappearance color component value of current pixel location.
The device of demosaicing counts after color average, utilizes known color component value and the color average of current pixel location, can directly calculate the disappearance color component value of current pixel location.
Concrete, the disappearance color component value that the device of demosaicing calculates current pixel location adopts following formula:
C1=C0+C1wavg-C0wavg
C2=C0+C2wavg-C0wavg
Wherein, C0 is the known color component value of current pixel location, C1, C2 are the disappearance color component value of current pixel location, C0wavg is the mean value of the known color component of current pixel location on each target direction, and C1wavg, C2wavg are the mean value of the disappearance color component of current pixel location on each target direction.
It should be noted that, in method of the present invention, when the device of demosaicing carries out demosaicing processing to the digital image of Bayer form, the pixel of the each position in this digital image is adopted as the method for embodiment of the present invention explanation obtains and lacks color component value.
Exemplary, according to the RGB component of the method calculating chart of the embodiment of the present invention 6 center position pixels be: 180,258,157.
Corresponding, for the RGB component of Fig. 6 center position pixel, if adopt the best VNG method of actual effect in existing demosaicing method to calculate, the RGB component of Fig. 6 center position pixel is 180,257,236.Compare with method of the present invention, adopt VNG method to carry out demosaicing, will cause B channel value significantly higher, and then cause color some exceptional value.
The device of S208, demosaicing, according to the disappearance color component value of the known color component value of current pixel location and current pixel location, is exported current pixel location.
The digital image of RGB triple channel form can be stored for the RGB color of each pixel in storage colouring information, namely stores the rgb value of each pixel.In the time showing output digital image, in order to recover the true colors information of digital image, be RGB triple channel form by digital image from Bayer format conversion, logarithmic code image carries out Demosaic.
The device of demosaicing is acquiring after the disappearance color component value of current pixel location, by this disappearance color component value storage, the device of demosaicing obtains three kinds of color component value in the three primary colors that just obtained current pixel location, the device of demosaicing is exported current pixel location according to these three kinds of color component value, be the device of demosaicing by this current pixel location according to rgb format output display, completed the demosaicing processing to current pixel location.
Further, when the device of demosaicing carries out demosaicing processing to the digital image of Bayer form, the pixel of the each position in this digital image is adopted as the method for embodiment of the present invention explanation obtains it and lacks color component value, finally, the device of demosaicing all with rgb format output, completes the demosaicing processing of the digital image to Bayer form by the pixel of the each position in the digital image of Bayer form.
The method of existing demosaicing is only to consider the directivity of color gradient and select the colouring information that changes less direction to average the disappearance colouring information that obtains current pixel location.Different from the method for existing demosaicing, in the inventive method, the color value of each target direction obtaining due to the device of demosaicing is to obtain according to the relative brightness component information of the each position pixel on the relative brightness component information of current pixel location and each target direction, therefore the color average that, the device of demosaicing obtains also obtains according to relative brightness component information.Like this, in the inventive method, the disappearance color component value of the current pixel location that the device of demosaicing obtains is more accurate, even in the fast-changing while brightness of color also scene jumpy, also can effectively recover the true colors of pixel.
Embodiments of the invention provide a kind of method of demosaicing, the device of demosaicing is by obtaining the Grad of current pixel location on multiple preset directions, determine current pixel location with Grads threshold and relative brightness component information, then, according to the relative brightness component information of current pixel location, in multiple preset directions, determine at least one target direction of current pixel location, wherein, target direction is the direction that the Grad of current pixel location in multiple preset directions is less than Grads threshold, color value on each target direction of acquisition current pixel location, wherein, the Grad of current pixel location on described target direction is less than described Grads threshold, and according to the color value on each target direction of current pixel location, statistical color mean value, finally, according to known color component value and the color average of current pixel location, obtain the disappearance color component value of current pixel location, and according to known color component value and disappearance color component value, output current pixel location.By this scheme, the present invention has considered scene brightness and the fast-changing situation of colourity simultaneously, colourity and brightness have been carried out to collaborative adjustment, solve the problem of prior art at this type scene abnormal color point of appearance or colour bar, improve the colour reproduction effect of pixel, can have the true colors of efficient recovery pixel.
Embodiment tri-
The invention provides a kind of device of demosaicing, as shown in Figure 7, comprising:
Acquiring unit 10, for obtaining the Grad of current pixel location on multiple preset directions, and for obtaining the color value of described current pixel location on each target direction of described multiple preset directions, wherein, described target direction is the direction that the Grad of described current pixel location in described multiple preset directions is less than described Grads threshold, described current pixel location has at least one target direction, and for according to the known color component value of described current pixel location and described color average, obtain the disappearance color component value of described current pixel location,
Determining unit 11, determines the Grads threshold of current pixel location for the Grad on the described multiple preset directions that get according to described acquiring unit 10, and for determining the relative brightness component information of described current pixel location;
Computing unit 12, for the color value on each target direction of the described current pixel location that gets according to described acquiring unit 10, statistical color mean value;
Output unit 13, for the described disappearance color component value getting according to described known color component value and described acquiring unit 10, exports described current pixel location.
Further, described determining unit 11, also for after definite current pixel location Grads threshold, before determining the relative brightness component information of described current pixel location, Grad on more described multiple preset direction and described Grads threshold, and in described multiple preset directions, described Grad is less than to the target direction that the orientation determination of described Grads threshold is described current pixel location.
Further, described determining unit 11, if be green G component pixel specifically for described current pixel location, the relative brightness component information using the G component value of described current pixel location as described current pixel location, if and be red R component pixel or blue B component pixel specifically for described current pixel location, described the first arithmetic mean described computing unit being calculated is defined as the relative brightness component information of described current pixel location;
Described computing unit 12, if be also red R component pixel or blue B component pixel for described current pixel location, calculates the first arithmetic mean of the G component value of described each target direction of described current pixel location.
Further, described acquiring unit 10, also, for obtaining the pel array of the n × n centered by described current pixel location, wherein, n is more than or equal to 3.
Further, described computing unit 12, in the described pel array getting at described acquiring unit 10, if described current pixel location is G component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the first preset rules, and the described pel array for getting at described acquiring unit 10 also, if described current location is R component pixel or B component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the second preset rules.
Further, described acquiring unit 10, specifically in described pel array, obtain the relative brightness component information of the each position pixel on each target direction, and for according to the relative brightness component information of the each position pixel on the relative brightness component information of described current pixel location and described each target direction, obtain the color value on each target direction of described current pixel location, the color value on described each target direction comprises the value of R component, G component and B component on target direction.
Further, described computing unit 12, specifically for the color value on each target direction of the Grad on described each target direction and described current pixel location according to described current pixel location, calculate the weighted average of the Grad of described current pixel location on described each target direction, to obtain described color average, and specifically for calculating the second arithmetic mean of the color value on each target direction of described current pixel location, wherein, described the second arithmetic mean is described color average.
Embodiments of the invention provide a kind of device of demosaicing, mainly comprise acquiring unit, determining unit and computing unit.The device of demosaicing is by obtaining the Grad of current pixel location on multiple preset directions, determine Grads threshold and the relative brightness component information of current pixel location, then, according to the relative brightness component information of current pixel location, in multiple preset directions, determine at least one target direction of current pixel location, wherein, target direction is the direction that the Grad of current pixel location in multiple preset directions is less than Grads threshold, color value on each target direction of acquisition current pixel location, and according to the color value on each target direction of current pixel location, statistical color mean value, finally, according to known color component value and the color average of current pixel location, obtain the disappearance color component value of current pixel location, and according to known color component value and disappearance color component value, output current pixel location.By this scheme, the present invention has considered scene brightness and the fast-changing situation of colourity simultaneously, colourity and brightness have been carried out to collaborative adjustment, solve the problem of prior art at this type scene abnormal color point of appearance or colour bar, improve the colour reproduction effect of pixel, can have the true colors of efficient recovery pixel.
Embodiment tetra-
The invention provides a kind of device of demosaicing, as shown in Figure 8, comprising:
Processor 20, for obtaining the Grad of current pixel location on multiple preset directions, and determine the Grads threshold of current pixel location according to the Grad on described multiple preset directions, and for determining the relative brightness component information of described current pixel location, and for according to the relative brightness component information of described current pixel location, obtain the color value on each target direction of described current pixel location, wherein, described target direction is the direction that the Grad of described current pixel location in described multiple preset directions is less than described Grads threshold, described current pixel location has at least one target direction, and for according to the known color component value of described current pixel location and described color average, obtain the disappearance color component value of described current pixel location,
Calculator 21, for the color value on each target direction of the described current pixel location that obtains according to described processor 20, statistical color mean value;
Display 22, for the described disappearance color component value getting according to described known color component value and described processor 20, exports described current pixel location.
Further, described processor 20, also for after definite current pixel location Grads threshold, before determining the relative brightness component information of described current pixel location, Grad on more described multiple preset direction and described Grads threshold, and in described multiple preset directions, described Grad is less than to the target direction that the orientation determination of described Grads threshold is described current pixel location.
Further, described processor 20, if be green G component pixel specifically for described current pixel location, the relative brightness component information using the G component value of described current pixel location as described current pixel location, if and be red R component pixel or blue B component pixel specifically for described current pixel location, described the first arithmetic mean described calculator 21 being calculated is defined as the relative brightness component information of described current pixel location;
Described calculator 21, if be also red R component pixel or blue B component pixel for described current pixel location, calculates the first arithmetic mean of the G component value of described each target direction of described current pixel location.
Further, described processor 20, also, for obtaining the pel array of the n × n centered by described current pixel location, wherein, n is more than or equal to 3.
Further, described calculator 21, in the described pel array getting at described processor 20, if described current pixel location is G component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the first preset rules, and the described pel array for getting at described processor 20 also, if described current location is R component pixel or B component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the second preset rules.
Further, described processor 20, specifically in described pel array, obtain the relative brightness component information of the each position pixel on each target direction, and for according to the relative brightness component information of the each position pixel on the relative brightness component information of described current pixel location and described each target direction, obtain the color value on each target direction of described current pixel location, the color value on described each target direction comprises the value of R component, G component and B component on target direction.
Further, described calculator 21, specifically for the color value on each target direction of the Grad on described each target direction and described current pixel location according to described current pixel location, calculate the weighted average of the Grad of described current pixel location on described each target direction, to obtain described color average, and specifically for calculating the second arithmetic mean of the color value on each target direction of described current pixel location, wherein, described the second arithmetic mean is described color average.
Embodiments of the invention provide a kind of device of demosaicing, mainly comprise processor, calculator and display.The device of demosaicing is by obtaining the Grad of current pixel location on multiple preset directions, determine Grads threshold and the relative brightness component information of current pixel location, then, according to the relative brightness component information of current pixel location, in multiple preset directions, determine at least one target direction of current pixel location, wherein, target direction is the direction that the Grad of current pixel location in multiple preset directions is less than Grads threshold, color value on each target direction of acquisition current pixel location, wherein, the Grad of current pixel location on described target direction is less than described Grads threshold, and according to the color value on each target direction of current pixel location, statistical color mean value, finally, according to known color component value and the color average of current pixel location, obtain the disappearance color component value of current pixel location, and according to known color component value and disappearance color component value, output current pixel location.By this scheme, the present invention has considered scene brightness and the fast-changing situation of colourity simultaneously, colourity and brightness have been carried out to collaborative adjustment, solve the problem of prior art at this type scene abnormal color point of appearance or colour bar, improve the colour reproduction effect of pixel, can have the true colors of efficient recovery pixel.
Those skilled in the art can be well understood to, for convenience and simplicity of description, only be illustrated with the division of above-mentioned each functional module, in practical application, can above-mentioned functions be distributed and completed by different functional modules as required, be divided into different functional modules by the internal structure of device, to complete all or part of function described above.The system of foregoing description, the specific works process of device and unit, can, with reference to the corresponding process in preceding method embodiment, not repeat them here.
In the several embodiment that provide in the application, should be understood that, disclosed system, apparatus and method, can realize by another way.For example, device embodiment described above is only schematic, for example, the division of described module or unit, be only that a kind of logic function is divided, when actual realization, can have other dividing mode, for example multiple unit or assembly can in conjunction with or can be integrated into another system, or some features can ignore, or do not carry out.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, indirect coupling or the communication connection of device or unit can be electrically, machinery or other form.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, any be familiar with those skilled in the art the present invention disclose technical scope in; can expect easily changing or replacing, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of described claim.

Claims (14)

1. a method for demosaicing, is characterized in that, comprising:
Obtain the Grad of current pixel location on multiple preset directions, and determine the Grads threshold of current pixel location according to the Grad on described multiple preset directions;
Determine the relative brightness component information of described current pixel location;
According to the relative brightness component information of described current pixel location, obtain the color value on described current pixel location each target direction in described multiple preset directions, wherein, described target direction is the direction that the Grad of described current pixel location in described multiple preset directions is less than described Grads threshold, and described current pixel location has at least one target direction;
According to the color value on each target direction of described current pixel location, statistical color mean value;
According to the known color component value of described current pixel location and described color average, obtain the disappearance color component value of described current pixel location;
According to described known color component value and described disappearance color component value, export described current pixel location.
2. the method for demosaicing according to claim 1, it is characterized in that, the Grad of described acquisition current pixel location on multiple preset directions, and after determining current pixel location Grads threshold according to the Grad on described multiple preset directions, before determining the relative brightness component information of described current pixel location, described method also comprises:
Grad on more described multiple preset direction and described Grads threshold;
In described multiple preset directions, described Grad is less than to the target direction that the orientation determination of described Grads threshold is described current pixel location.
3. the method for demosaicing according to claim 1 and 2, is characterized in that, the described relative brightness component information of determining described current pixel location, comprising:
If described current pixel location is green G component pixel, the relative brightness component information using the G component value of described current pixel location as described current pixel location;
If described current pixel location is red R component pixel or blue B component pixel, calculate the first arithmetic mean of the G component value of described each target direction of described current pixel location, and described the first arithmetic mean is defined as to the relative brightness component information of described current pixel location.
4. the method for demosaicing according to claim 1, is characterized in that, before the Grad of described acquisition current pixel location on multiple preset directions, described method also comprises:
Obtain the pel array of the n × n centered by described current pixel location, wherein, n is more than or equal to 3.
5. the method for demosaicing according to claim 4, is characterized in that, the Grad of the described current pixel location of described acquisition on multiple preset directions, comprising:
In described pel array, if described current pixel location is G component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the first preset rules;
In described pel array, if described current location is R component pixel or B component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the second preset rules.
6. according to the method for the demosaicing described in claim 1-5 any one, it is characterized in that, the color value on each target direction of the described current pixel location of described acquisition, comprising:
In described pel array, obtain the relative brightness component information of the each position pixel on each target direction;
According to the relative brightness component information of the each position pixel on the relative brightness component information of described current pixel location and described each target direction, obtain the color value on each target direction of described current pixel location, the color value on described each target direction comprises the value of R component, G component and B component on each target direction.
7. the method for demosaicing according to claim 6, is characterized in that, described statistical color mean value, comprising:
Color value on Grad according to described current pixel location on described each target direction and each target direction of described current pixel location, calculate the weighted average of the Grad of described current pixel location on described each target direction, to obtain described color average;
Or,
The second arithmetic mean that calculates the color value on each target direction of described current pixel location, wherein, described the second arithmetic mean is described color average.
8. a device for demosaicing, is characterized in that, comprising:
Acquiring unit, for obtaining the Grad of current pixel location on multiple preset directions, and for obtaining the color value of described current pixel location on each target direction of described multiple preset directions, wherein, described target direction is the direction that the Grad of described current pixel location in described multiple preset directions is less than described Grads threshold, described current pixel location has at least one target direction, and for according to the known color component value of described current pixel location and described color average, obtain the disappearance color component value of described current pixel location,
Determining unit, determines the Grads threshold of current pixel location for the Grad on the described multiple preset directions that get according to described acquiring unit, and for determining the relative brightness component information of described current pixel location;
Computing unit, for the color value on each target direction of the described current pixel location that gets according to described acquiring unit, statistical color mean value;
Output unit, for the described disappearance color component value getting according to described known color component value and described acquiring unit, exports described current pixel location.
9. the device of demosaicing according to claim 8, is characterized in that,
Described determining unit, also for after definite current pixel location Grads threshold, before determining the relative brightness component information of described current pixel location, Grad on more described multiple preset direction and described Grads threshold, and in described multiple preset directions, described Grad is less than to the target direction that the orientation determination of described Grads threshold is described current pixel location.
10. the device of demosaicing according to claim 8 or claim 9, is characterized in that,
Described determining unit, if be green G component pixel specifically for described current pixel location, the relative brightness component information using the G component value of described current pixel location as described current pixel location, if and be red R component pixel or blue B component pixel specifically for described current pixel location, described the first arithmetic mean described computing unit being calculated is defined as the relative brightness component information of described current pixel location;
Described computing unit, if be also red R component pixel or blue B component pixel for described current pixel location, calculates the first arithmetic mean of the G component value of described each target direction of described current pixel location.
The device of 11. demosaicings according to claim 8, is characterized in that,
Described acquiring unit, also, for obtaining the pel array of the n × n centered by described current pixel location, wherein, n is more than or equal to 3.
The device of 12. demosaicings according to claim 11, is characterized in that,
Described computing unit, in the described pel array getting at described acquiring unit, if described current pixel location is G component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the first preset rules, and the described pel array for getting at described acquiring unit also, if described current location is R component pixel or B component pixel, calculate the Grad on multiple preset directions of described current pixel location in described pel array according to the second preset rules.
The device of the demosaicing described in 13. according to Claim 8-12 any one, is characterized in that,
Described acquiring unit, specifically in described pel array, obtain the relative brightness component information of the each position pixel on each target direction, and for according to the relative brightness component information of the each position pixel on the relative brightness component information of described current pixel location and described each target direction, obtain the color value on each target direction of described current pixel location, the color value on described each target direction comprises the value of R component, G component and B component on each target direction.
The device of 14. demosaicings according to claim 13, is characterized in that,
Described computing unit, specifically for the color value on each target direction of the Grad on described each target direction and described current pixel location according to described current pixel location, calculate the weighted average of the Grad of described current pixel location on described each target direction, to obtain described color average, and specifically for calculating the second arithmetic mean of the color value on each target direction of described current pixel location, wherein, described the second arithmetic mean is described color average.
CN201410077102.3A 2014-03-04 2014-03-04 Mosaic removing method and device Withdrawn CN103841388A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410077102.3A CN103841388A (en) 2014-03-04 2014-03-04 Mosaic removing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410077102.3A CN103841388A (en) 2014-03-04 2014-03-04 Mosaic removing method and device

Publications (1)

Publication Number Publication Date
CN103841388A true CN103841388A (en) 2014-06-04

Family

ID=50804477

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410077102.3A Withdrawn CN103841388A (en) 2014-03-04 2014-03-04 Mosaic removing method and device

Country Status (1)

Country Link
CN (1) CN103841388A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104539919A (en) * 2014-12-31 2015-04-22 上海富瀚微电子股份有限公司 Demosaicing method and device of image sensor
CN106303474A (en) * 2016-09-29 2017-01-04 杭州雄迈集成电路技术有限公司 A kind of demosaicing methods based on G pattern color filter array and device
CN107466410A (en) * 2015-03-27 2017-12-12 英特尔公司 New edge sensing for original image processing is measured
CN107615331A (en) * 2015-05-15 2018-01-19 深圳市大疆创新科技有限公司 System and method for supporting the image denoising based on neighborhood block dimensionality reduction
CN110089103A (en) * 2016-12-28 2019-08-02 华为技术有限公司 A kind of demosaicing methods and device
CN113949850A (en) * 2020-07-17 2022-01-18 爱思开海力士有限公司 Demosaicing operation circuit, image sensing device and operation method thereof

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104539919B (en) * 2014-12-31 2017-01-25 上海富瀚微电子股份有限公司 Demosaicing method and device of image sensor
CN104539919A (en) * 2014-12-31 2015-04-22 上海富瀚微电子股份有限公司 Demosaicing method and device of image sensor
CN107466410B (en) * 2015-03-27 2021-11-05 英特尔公司 New edge sensing metrics for raw image processing
CN107466410A (en) * 2015-03-27 2017-12-12 英特尔公司 New edge sensing for original image processing is measured
CN107615331A (en) * 2015-05-15 2018-01-19 深圳市大疆创新科技有限公司 System and method for supporting the image denoising based on neighborhood block dimensionality reduction
CN107615331B (en) * 2015-05-15 2021-03-02 深圳市大疆创新科技有限公司 System and method for supporting image denoising based on neighborhood block dimension reduction
CN106303474A (en) * 2016-09-29 2017-01-04 杭州雄迈集成电路技术有限公司 A kind of demosaicing methods based on G pattern color filter array and device
CN110089103A (en) * 2016-12-28 2019-08-02 华为技术有限公司 A kind of demosaicing methods and device
CN110089103B (en) * 2016-12-28 2020-08-07 华为技术有限公司 Demosaicing method and device
US11017501B2 (en) 2016-12-28 2021-05-25 Huawei Technologies Co., Ltd. Demosaicing method and apparatus
CN113949850A (en) * 2020-07-17 2022-01-18 爱思开海力士有限公司 Demosaicing operation circuit, image sensing device and operation method thereof
CN113949850B (en) * 2020-07-17 2023-08-01 爱思开海力士有限公司 Demosaicing operation circuit, image sensing device and operation method thereof
US11750783B2 (en) 2020-07-17 2023-09-05 SK Hynix Inc. Demosaic operation circuit, image sensing device and operation method of the same

Similar Documents

Publication Publication Date Title
US8891866B2 (en) Image processing apparatus, image processing method, and program
CN103841388A (en) Mosaic removing method and device
CN100414964C (en) Color filter lens array interpolation method
US9131174B2 (en) Image processing device, image processing method, and program for detecting and correcting defective pixel in image
US20160125630A1 (en) System and Method to Align and Merge Differently Exposed Digital Images to Create a HDR (High Dynamic Range) Image
KR100992362B1 (en) Color interpolation apparatus
US9036047B2 (en) Apparatus and techniques for image processing
KR20060131083A (en) Method and apparatus for edge adaptive color interpolation
CN110572637B (en) Image anomaly detection method, terminal device and storage medium
CN103053163A (en) Image generation device, and image generation system, method, and program
CN113168669B (en) Image processing method, device, electronic equipment and readable storage medium
EP3361376A1 (en) Image processing method and device for led display screen
KR20070103229A (en) Method and apparatus for color interpolation
KR100866187B1 (en) Region adaptive directional demosaicing method
CN103327220A (en) Denoising method oriented by green channel on low illumination Bayer image
JP2000134634A (en) Image converting method
EP2800381A1 (en) Image processing device and method, and imaging device
CN103747222B (en) A kind of method that color artifact of image suppresses and device
US20050058361A1 (en) Image processing apparatus
CN114331916A (en) Image processing method and electronic device
CN109285113B (en) Improved color image interpolation method based on gradient
CN103259960B (en) The interpolation method of data and device, image output method and device
CN113068011A (en) Image sensor, image processing method and system
CN105704363B (en) Image data processing method and device
US10863148B2 (en) Tile-selection based deep demosaicing acceleration

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C04 Withdrawal of patent application after publication (patent law 2001)
WW01 Invention patent application withdrawn after publication

Application publication date: 20140604