Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a set of perfect calibration process.
In order to solve the technical problem, the invention is solved by the following technical scheme:
a solid state noise calibration method comprises the following steps:
acquiring image data under a plurality of different gains;
taking n groups of image frames under each gain, superposing each group of image frames and averaging to obtain an average value of the n groups of image frames;
taking the numerical values of odd rows and odd columns, the numerical values of even rows and even columns, the numerical values of odd rows and odd columns and the numerical values of even rows and even columns of the average value of each group of image frames, and calculating all column direction average values of four groups of numerical values; obtaining n groups of screening data, wherein each group of screening data comprises four groups of column-direction mean values; calculating four groups of image mean values in each group of screening data according to the transverse pixels of the column mean values; calculating four groups of overall mean values according to the four groups of image mean values;
taking each line of data in the column direction mean value in the n groups of screening data to respectively form u groups of line data sets; calculating a weight coefficient of each group of column data sets, and processing u groups of column data sets through the weight coefficient to obtain four groups of column matrix arrays after weight processing;
and calculating the standard solid-state noise calibration value as the difference between the array of the column matrix and the overall average value.
As an embodiment, the method for calculating the weight coefficient of each group of column data sets includes:
sorting the numerical values in each group of column data sets from small to large respectively, and marking sequence numbers;
calculating a weight coefficient for each group of sorted row data sets, and if the sequence number is less than or equal to the median of the row data number of each group of sets, taking the sequence number by the weight coefficient;
and if the sequence number is greater than the median of the data quantity of each group of the aggregation columns, the weight coefficient is the difference between the quantity value and the sequence number plus one.
As one embodiment, the column-wise mean calculation method includes:
dividing the image frame average data into four groups, wherein the first group takes the numerical values of odd rows and even columns, the second group takes the numerical values of odd rows and odd columns, the third group takes the numerical values of odd rows and odd columns, and the fourth group takes the numerical values of even rows and even columns; and accumulating all the pixels in the column direction of each group respectively to generate a column direction addition pixel sum, and dividing the column direction addition pixel sum by one half width of the image frame to obtain a column direction average value.
As an embodiment, the method for calculating four sets of image means according to four sets of column-wise means includes:
and accumulating all the horizontal pixels of the four groups of column-direction mean values respectively to generate horizontal addition pixel sums, and dividing the horizontal addition pixel sums by half of the length of the image frame to obtain four groups of image mean values.
As an embodiment, the method for calculating the four sets of overall mean values according to the four sets of image mean values includes:
and accumulating n values in the four groups of image mean value arrays respectively, and averaging to obtain the integral mean value.
As an embodiment, the method for obtaining four sets of column matrix arrays after weight coefficient processing by processing u sets of column data sets with weight coefficients includes:
and multiplying the numerical value points in the row data sets by the corresponding weight coefficients, dividing the numerical value points by the sum of the weight coefficients to obtain all the row data sets after being processed by the weight coefficients, and combining the row data sets into a row matrix array.
As one of the embodiments, u is from 1 to x/2, where x is the length of the image frame.
As one embodiment, the method for acquiring image data under a plurality of different gains comprises:
taking a pure white background plate and an adjustable light source;
adjusting the intensity of a light source, aligning the light source to a pure white background plate, and collecting n groups of bayer format data under different gain multiples;
and setting the length and width of each acquired frame of bayer format data image.
As one embodiment, the method for displaying calibration values under different gain multiples further includes:
taking the length of each group of four groups of images in each frame as an abscissa and taking the mean value of each group of column-direction pixels of each frame of image as an ordinate;
observing the floating range of the mean value of each group of column-direction pixels under each gain, and if the floating range regularly and uniformly rises, calculating the calibration values under different gain multiples correctly; if not, the calculation is wrong.
The invention also provides a video stream processing method, which comprises the following steps:
acquiring a video stream to be processed and a gain of the video stream to be processed;
calling the solid-state noise calibration value with the same gain as the video to be processed, or calling the solid-state noise calibration value with the different gain from the video to be processed to calculate the solid-state noise calibration value with the same gain as the video to be processed;
and calculating the difference between the video stream data to be processed and the solid-state noise calibration value, and outputting a processing result.
As an embodiment, the odd-numbered columns and the odd-numbered rows of the video stream subtract the odd-numbered columns and the odd-numbered rows of the video stream from the solid-state noise calibration value under the corresponding gain, the odd-numbered rows and the even-numbered columns subtract the odd-numbered rows and the even-numbered rows of the video stream from the solid-state noise calibration value under the corresponding gain, and the even-numbered columns and the even-numbered rows subtract the even-numbered rows and the even-numbered rows of the video stream from the solid-state noise calibration value under the corresponding gain.
As one of the implementation manners, if there is no gain of the video stream to be processed, then two groups of solid-state noise calibration values corresponding to gains adjacent to each other before and after the gain of the video stream to be processed are called; and averaging the solid-state noise calibration values of the two groups of gains adjacent to each other to obtain the solid-state noise calibration value corresponding to the gain of the video stream to be processed.
The invention also provides a solid-state noise calibration system, comprising:
the first processing unit is used for acquiring image data under a plurality of different gains;
the second processing unit is used for acquiring n groups of image frames under each gain, and averaging each group of image frames to obtain an average value of the n groups of image frames;
the third processing unit is used for calculating all column direction mean values of the four groups of numerical values by taking the numerical values of odd columns and odd rows, the numerical values of odd rows and even rows, the numerical values of even rows and odd columns and the numerical values of even rows of each group of image frame mean values; obtaining n groups of screening data, wherein each group of screening data comprises four groups of column-direction mean values; calculating four groups of image mean values according to the column mean values; taking each line of data in the column direction mean value in the n groups of screening data to respectively form u groups of line data sets;
the fourth processing unit is used for calculating the weight coefficient of each group of column data sets, and obtaining four groups of column matrix arrays after weight processing after the u groups of column data sets are processed by the weight coefficient; calculating four groups of overall average values according to the image average values;
and the fifth processing unit is used for calculating a standard solid-state noise calibration value, namely calculating the difference between the array of the column matrix and the overall mean value.
The invention also provides a video stream processing system, which comprises a solid-state noise calibration value calculated according to the solid-state noise calibration method, and an acquisition unit used for acquiring the video stream to be processed and the gain of the video stream to be processed;
a sixth processing unit, configured to invoke the solid-state noise calibration value with the same gain as the video stream to be processed, or invoke a solid-state noise calibration value with a different gain from the video stream to be processed to calculate the solid-state noise calibration value with the same gain as the video stream to be processed;
and the seventh processing unit is used for calculating the difference between the video stream data to be processed and the solid-state noise calibration value and outputting a processing result.
The invention has the beneficial effects that:
1. the solid-state noise processing module has a set of perfect calibration process, and has better effect on subsequent solid-state noise processing.
2. The processing process of the invention is more high-speed and effective, the characteristic of solid-state noise is grasped, the whole isp effect is more effectively improved by combining the video stream processing, and the image quality displayed by the video stream recovery is better.
Detailed Description
The present invention will be described in further detail with reference to examples, which are illustrative of the present invention and are not to be construed as being limited thereto.
Example 1:
the embodiment discloses a solid-state noise calibration method, as shown in fig. 1, including the following steps:
acquiring image data under a plurality of different gains;
taking n groups of image frames under each gain, and averaging each group of image frames to obtain an average value of the n groups of image frames;
taking the numerical values of odd rows and odd columns, the numerical values of even rows and even columns, the numerical values of odd rows and odd columns and the numerical values of even rows and even columns of the average value of each group of image frames, and calculating all column-direction average values of four groups of numerical values; obtaining n groups of screening data, wherein each group of screening data comprises four groups of column-direction mean values; calculating four groups of image mean values according to the column mean values; taking each line of data in the column direction mean value in the n groups of screening data to respectively form u groups of line data sets;
calculating a weight coefficient of each group of column data sets, and processing u groups of column data sets through the weight coefficient to obtain four groups of column matrix arrays after weight processing;
calculating four groups of overall average values according to the image average values; and calculating the standard solid-state noise calibration value as the difference between the array of the column matrix and the overall average value.
The method for acquiring the image data under the plurality of different gains comprises the following steps:
taking a pure white background plate and an adjustable light source;
adjusting the intensity of a light source, aligning the light source to a pure white background plate, and collecting n groups of bayer format data under different gain multiples;
and setting the length and width of each acquired frame of bayer format data image.
The specific scheme adopted in the embodiment is as follows:
preparing a pure white paperboard and adjusting a light source (such as a lamp box) to regulate and control the light source.
Adjusting the intensity of a light source, aligning a lens to a pure white paper board, and respectively acquiring nmax groups of 100-frame bayer format data under 1, 4, 16, 64, 128 and 256-time gains (sensor gains), wherein nmax is a self-defined number, and the larger the numerical value is, the higher the subsequent processing accuracy is. Wherein nmax takes an odd value.
Let each frame of image data be
N represents the number of groups captured at the gain, nmax is the number of groups captured in total and is set to be only odd, o represents the data at several gains, and p represents the number of frames in 100 frames, e.g., data at several gains
Representing the 12 th frame data in the captured 2 nd group of 100 frame data under 1-time gain;
further, the length of each frame of data is set to be x, and the width is set to be y.
The method for obtaining the average value of the n groups of image frames comprises the following steps:
data under each captured gain is extracted, and the following example is to process the 1 st group of data of 1-time gain data, namely to extract
To
The data of (1). The data of 1-nmax groups can be calculated by taking the data of the 1 st group of the 1-time gain data as an example, and the calculation methods under different gains can be calculated.
Firstly, 100 captured images are overlapped and averaged to obtain an image, namely
Wherein
Multiplying the calculated average value of the image frames of the following group 1 data for 1 catch data, wherein
Representative matrix
To the matrix
Directly adding each other in a superposition way.
(III) then calculating a column-wise mean: the column-wise mean calculation method comprises the following steps: dividing the image frame average value data into four groups of small images, wherein the first group takes the numerical values of odd rows and even columns; the second group takes the numerical values of odd rows and odd columns, and the third group takes the numerical values of even rows and odd columns and the fourth group takes the numerical values of even rows and even columns; and accumulating all the pixels in the column direction of each group respectively to generate a column direction addition pixel sum, and dividing the column direction addition pixel sum by the width of the image frame to obtain a column direction average value.
Specifically, the method comprises the following steps: will be provided with
The calculation is divided into 4 small images, i.e. into
、
、
And
4 groups of data are calculated in the following way:
the above formula is in matlab function form, and is specifically expressed
Get
The value of the odd column and the odd row of,
get
The value of the odd rows and even columns,
get
The value of the odd column of the even row,
get
Even columns and even rows.
Are respectively paired
、
、
、
Is accumulated to generate a column-wise summed pixel sum, and divided by one-half of the width y of the image frame to obtain a column-wise mean for each column, i.e.
Wherein the content of the first and second substances,
representation handle matrix
The summation is carried out in the column direction,
、
、
the same is true.
The method for calculating four groups of image mean data according to four groups of column-wise means comprises the following steps: and accumulating all the horizontal pixels of the four groups of column-direction mean values respectively to generate horizontal addition pixel sums, and dividing the horizontal addition pixel sums by one half of the length x of the image frame to obtain four groups of image mean value data. Namely:
wherein the content of the first and second substances,
representation handle matrix
The summation is carried out in the row direction,
,
,
the same is true.
Thus, all the above values are calculated at 1-fold gain, i.e. all
,
,
,
And
,
,
,
where n is the nth set of data captured at the current gain of 1.
Since the averaging is performed to avoid the influence of random noise in the time domain, 100 frames of image data are superimposed, and only the influence of solid-state noise in the spatial domain is obtained after the superimposition.
Taking each line of data in the mean value of the column directions in the n groups of screening data to respectively form u groups of line data sets; calculating a weight coefficient of each group of column data sets, and processing u groups of column data sets through the weight coefficient to obtain four groups of column matrix arrays after weight processing; and multiplying the numerical value points in the row data sets by the corresponding weight coefficients, dividing the numerical value points by the sum of the weight coefficients to obtain all the row data sets after being processed by the weight coefficients, and combining the row data sets into a row matrix array. Following to process
These n sets of screening data are illustrated as examples.
Now there are n groups
Where n is 1 to nmax, extracting
Divide each column of data into a set named
Where u is a half-length per frame, i.e., u is 1 to x/2, where x is the length of the image frame.
As u =2 represents
Set of all
data column 2 data, i.e. to be ready
、
The number of the 2 nd column in each matrix is extracted as a set. For each one now
The data in the matrix are respectively sorted from small to large, and the sorting result is
J denotes a sequence number, e.g.
The number of the 4 th decimal in the 3 rd column data set in the first histogram is shown with a gain of 1.
Calculating a weight coefficient for each group of sorted row data sets, and if the sequence number is less than or equal to the median of the row data number of each group of sets, taking the sequence number by the weight coefficient; and if the sequence number is greater than the median of the data quantity of each group of the collection columns, the weight coefficient is the difference between the total quantity value nmax and the sequence number plus one.
Kj is calculated separately for each column set below, kj being the weighting factor, taking the first column set as an example.
Wherein
Representation handle matrix
Summing according to the row direction;
the final weight processing result in column 1 is
Is 1 number and is combined into a matrix as follows:
I.e. the column-wise mean solid state noise value of the first histogram at 1 time of gain obtained by calculation, and so on
、
、
And (6) calculating.
,
I.e. the overall mean of the first small graph at 1 time of gain obtained by calculation, and so on
、
、
And (6) calculating.
Finally, the
All standard solid-state noise calibration values of the first group under the gain of 1 multiplication can be calculated,
i.e. the calculated solid state noise calibration value, the same principle can be used
、
、
And (6) calculating.
According to the method, the solid-state noise calibration values under the residual 4, 16, 64, 128 and 256 multiplication gain factors are calculated, and the whole calibration process is finished by analogy.
According to the characteristics of the solid noise, the solid noise is removed, the weight is calculated, the numerical values are sequenced and then subjected to weight processing, the calibration value with large difference occupies smaller weight, and therefore the final calibration effect of the solid noise is good.
Further, this embodiment also provides a method for displaying calibration values under different gain multiples by using a line graph, including:
taking the length of each group of four groups of images in each frame as an abscissa and taking the mean value of each group of column-direction pixels of each frame of image as an ordinate;
observing the floating range of the mean value of each group of column-direction pixels under each gain, and if the floating range regularly and uniformly rises (for example, whether the solid-state noise calibration value has a uniformly rising trend along with the increase of the gain or not), calculating the calibration values under different gain multiples correctly; if not, the calculation is wrong.
And (3) displaying the calibration curve values under several multiples by using a broken line diagram, wherein the abscissa is the length of each group of four groups of images in each frame, and the ordinate is the mean value of column-direction pixels of each group of each frame of image. The purpose of this process is to observe whether the foregoing processing flow has errors and find whether there is a certain rule, in the example of fig. 2, the expression of the first group of image columns to the mean value of the pixels in each frame of image is obtained under 1, 4, 8 times of gain, each gain in the figure captures 5 groups of data, and the expression graph of the mean value of the pixels in the first group of image columns under 8 times of gain, 4 times of gain, 1 time of gain is displayed from top to bottom.
Through the line graph, the column-direction mean value of the image and the approximate floating range of the column vector mean value under each gain can be seen, the approximate floating is compared with the solid-state noise calibration value floating rule finally obtained by the user, whether the solid-state noise calibration value is similar or not is observed, and if the solid-state noise calibration value is similar, no error occurs.
Example 2:
a video stream processing method, comprising the steps of:
acquiring a video stream to be processed and the gain of the video to be processed;
calling the solid-state noise calibration value with the same gain as the video stream to be processed, or calling the solid-state noise calibration value with the different gain from the video stream to be processed to calculate the solid-state noise calibration value with the same gain as the video stream to be processed;
and calculating the difference between the video stream data to be processed and the solid-state noise calibration value, and outputting a processing result.
Specifically, the odd-numbered columns and the odd-numbered rows of the video stream subtract the odd-numbered columns and the odd-numbered rows of the video stream from the solid-state noise calibration value under the corresponding gain, the odd-numbered rows and the even-numbered rows of the video stream subtract the odd-numbered rows and the even-numbered rows of the video stream from the solid-state noise calibration value under the corresponding gain, the even-numbered rows and the odd-numbered rows of the video stream subtract the even-numbered rows and the odd-numbered rows of the video stream from the solid-state noise calibration value under the corresponding gain, and the even-numbered rows of the video stream subtract the even-numbered rows and the even-numbered rows of the video stream from the solid-state noise calibration value under the corresponding gain.
If the gain of the video stream to be processed does not exist, calling solid-state noise calibration values corresponding to two groups of gains adjacent to the front and back of the gain of the video stream to be processed; and taking a weighted average value of the solid-state noise calibration values of the two groups of gains adjacent to each other in front and back, or calculating the solid-state noise calibration value of the gain between the two groups of gains adjacent to each other by adopting other interpolation calculation, wherein the specific calculation logic can also adopt other mathematical means.
In particular, it may be that the final video stream solid state noise processing, e.g. under 1-fold gain, uses the above calculated
、
、
、
This is a 1-fold gain calibration of solid state noise. During video stream processing, odd column paritySubtraction of several lines
Odd rows and even columns minus
Odd columns of even rows minus
Even columns and even rows minus
Namely, the solid-state noise processing with 1-time gain is completed.
Since the embodiment calibrates and calculates the standard value of solid state noise under all gains, if the solid state noise processing under 4-fold gain is selected
The scaled value, if it is 2 times gain, will be based on the weight, such as for the gain that has been set
And
and taking a weighted average, performing certain interpolation in the process of analogizing other gains, and finally realizing solid-state noise processing of all video streams.
For the
、
This calibration is an example, which is a calibration of 4 times gain and 1 time gain, if required
Is that
Calculated in this way, if a value of 3 times the gain is to be calculated, it is
The calculation is performed in this way, and so on, and will not be described herein.
Other specific remarks are that although the median of 1 and 4 is not 2, in practice the gain interpolation is performed by adding multiples, and 1, 2, 4, 8, 16, i.e. 2 multiples is 1 stage.
The above is the column term mean minus the whole graph, i.e. the solid state noise characteristic we have found. In normal video streams, the scaling value is directly subtracted according to the solid-state noise characteristic. The solid state noise of the video stream is removed.
Example 3:
a solid state noise calibration system, comprising:
the first processing unit is used for acquiring image data under a plurality of different gains;
the second processing unit is used for acquiring n groups of image frames under each gain, and averaging each group of image frames to obtain an average value of the n groups of image frames;
the third processing unit is used for calculating all column direction mean values of the four groups of numerical values by taking the numerical values of odd columns and odd rows, the numerical values of odd rows and even rows, the numerical values of even rows and odd columns and the numerical values of even rows of each group of image frame mean values; obtaining n groups of screening data, wherein each group of screening data comprises four groups of column-direction mean values; calculating four groups of image mean values according to the column mean values; taking each line of data in the column direction mean value in the n groups of screening data to respectively form u groups of line data sets;
the fourth processing unit is used for calculating the weight coefficient of each group of column data sets, and obtaining four groups of column matrix arrays after weight processing after the u groups of column data sets are processed by the weight coefficient; calculating four groups of overall average values according to the image average values;
and the fifth processing unit is used for calculating a standard solid-state noise calibration value, namely calculating the difference between the array of the column matrix and the overall mean value.
Example 4:
a video stream processing system, comprising: a solid-state noise calibration value calculated according to the solid-state noise calibration method disclosed in embodiment 1, and an acquisition unit configured to acquire a video stream to be processed and a gain of the video stream to be processed;
a sixth processing unit, configured to invoke the solid-state noise calibration value with the same gain as the video stream to be processed, or invoke a solid-state noise calibration value with a different gain from the video stream to be processed to calculate the solid-state noise calibration value with the same gain as the video stream to be processed;
and the seventh processing unit is used for calculating the difference between the video stream data to be processed and the solid-state noise calibration value and outputting a processing result.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical functional division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed.
The units may or may not be physically separate, and components displayed as units may be one physical unit or a plurality of physical units, that is, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solution of the embodiments of the present invention may be essentially or partially contributed to by the prior art, or all or part of the technical solution may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions within the technical scope of the present invention are intended to be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.