CN116029938A - Image flat field correction method and device based on linear fitting - Google Patents

Image flat field correction method and device based on linear fitting Download PDF

Info

Publication number
CN116029938A
CN116029938A CN202310160209.3A CN202310160209A CN116029938A CN 116029938 A CN116029938 A CN 116029938A CN 202310160209 A CN202310160209 A CN 202310160209A CN 116029938 A CN116029938 A CN 116029938A
Authority
CN
China
Prior art keywords
image
matrix
value
signal
pixel
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.)
Granted
Application number
CN202310160209.3A
Other languages
Chinese (zh)
Other versions
CN116029938B (en
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.)
Zhejiang Shuangyuan Technology Co ltd
Original Assignee
Zhejiang Shuangyuan Technology 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 Zhejiang Shuangyuan Technology Co ltd filed Critical Zhejiang Shuangyuan Technology Co ltd
Priority to CN202310160209.3A priority Critical patent/CN116029938B/en
Publication of CN116029938A publication Critical patent/CN116029938A/en
Application granted granted Critical
Publication of CN116029938B publication Critical patent/CN116029938B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

The invention discloses an image flat field correction method and device based on linear fitting, wherein the method comprises the following steps: collecting a plurality of images of a photographed object; acquiring an original pixel value of each pixel point in each image; establishing a signal gain matrix and a signal offset matrix for each pixel point in each image; establishing a linear equation set of corrected pixel values for each image according to the original pixel values, the signal gain matrix and the signal offset matrix; performing linear fitting based on a least square method to obtain each signal gain value in a signal gain matrix and each signal offset value in a signal offset matrix; and calculating and obtaining the correction pixel value of each image according to the signal gain matrix, the signal offset matrix and the linear equation set which are obtained by fitting. Performing flat field correction on each image according to the corrected pixel values; the method can effectively reduce the production cost.

Description

Image flat field correction method and device based on linear fitting
Technical Field
The invention relates to the technical field of image processing, in particular to an image flat field correction method and device based on linear fitting.
Background
In general, in an image acquired by an actual camera, due to factors such as uneven illumination, inconsistent response of the lens center and the lens edge, inconsistent response of each pixel of an imaging device, fixed image background noise and the like, each pixel value in the image often has larger error compared with the actual situation, which is very unfavorable for the subsequent use of the picture, so that flat field correction is performed first, and the problem of nonuniform response of each pixel is solved. The flat field correction is to make the response lines of all pixels identical by changing the slope and offset of the response line of each pixel, i.e. the signal gain and signal offset. Generally, two steps of dark field correction and open field correction are needed for flat field correction, firstly, a camera performs one-time exposure on the dark field to obtain the offset of each pixel; then, imaging the gray level uniform object under the uniform illumination condition for one time to obtain a uniform field image, and preferably enabling all points in the image to approach the maximum gray level value; and finally subtracting the dark field image from the uniform light field image, and correcting the image gain by a relative calibration method. This method is time consuming and cannot be used without dark field images, since two images under different parameters need to be acquired.
Patent document CN109660736a discloses a flat field correction method and apparatus, and an image verification method and apparatus, first, adjusting exposure time and camera gain to obtain a dark field image and a standby bright field image, then performing mean filtering on the standby bright field image to obtain a bright field image, and finally correcting the image by using a flat field correction algorithm in combination with the dark field image and the bright field image, so as to improve correction accuracy of flat field correction, but because camera parameters need to be adjusted to obtain the dark field image and the bright field image, efficiency is lower, and the experimental apparatus and environment are also depended.
Patent document CN106204492B discloses a real-time flat field correction method of an area array camera based on an FPGA, performing a blocking operation on a sensor array, and performing an operation on each point by combining an interpolation algorithm on the basis of the blocking. The invention provides higher output image quality for high-resolution high-frame rate application occasions, but can not cope with ultra-high resolution pictures due to the limitation of the storage capacity of the FPGA, and the additional use of an area-array camera and the FPGA also increases the cost of flat-field correction.
Patent document CN115037922a discloses a uniform light source platform for camera calibration, a non-uniformity measurement, correction method, and a flat field correction of a camera using a field dark field image obtained by the platform. The platform has simple structure and low cost, realizes uniformity of a light source, has high requirements on the precision of the arrangement position of devices such as a camera, a baffle plate, an integrating sphere and the like, and can give larger error to a correction result in actual operation.
In summary, the image flat field correction method in the prior art is time-consuming in calculation and high in equipment requirement, so that the production cost is high.
Disclosure of Invention
The invention provides an image flat field correction method and device based on linear fitting, which can realize image flat field correction on the algorithm level without dark field images or other devices, and can effectively reduce production cost.
An image flat field correction method based on linear fitting, comprising:
collecting a plurality of images of a photographed object;
acquiring an original pixel value of each pixel point in each image;
establishing a signal gain matrix and a signal offset matrix for each pixel point in each image;
establishing a linear equation set of corrected pixel values for each image according to the original pixel values, the signal gain matrix and the signal offset matrix;
performing linear fitting based on a least square method to obtain each signal gain value in a signal gain matrix and each signal offset value in a signal offset matrix;
calculating and obtaining a correction pixel value of each image according to the signal gain matrix, the signal offset matrix and the linear equation set which are obtained by fitting;
and carrying out flat field correction on each image according to the correction pixel value.
Further, in the plurality of images, the number of row pixel points is the same, the number of column pixel points is the same, and gray values are different between different images.
Further, the number of the plurality of images is K, and each image includes n×m pixels; the signal gain matrix is:
Figure SMS_1
the signal offset matrix is:
Figure SMS_2
wherein i=0, 1,2, … … n-1, j=0, 1,2, … … m-1, a ij Signal gain value, b, representing pixel point of ith row and jth column in image ij And the signal offset value of the pixel point in the ith row and the jth column in the image is represented.
Further, the linear equation of the ith row and jth column pixel points of the kth image is:
Figure SMS_3
wherein x is ij_k Representing the original pixel value, y, of the ith row and jth column pixel points in the kth image k Corrected pixel values representing the kth image, i=0, 1,2, … … n-1, j=0, 1,2, … … m-1, a ij Signal gain value, b, representing pixel point of ith row and jth column in image ij A signal offset value representing an ith row and jth column of pixels in the image;
the linear equation set comprises a linear equation of each pixel point of each image.
Further, performing linear fitting based on a least square method to obtain each signal gain value in the signal gain matrix, including:
subtracting the linear equations of two adjacent columns of pixel points in the same row in each image in the linear equation set to obtain a first equation set for eliminating correction pixel values;
sequentially subtracting the equations in the first equation set to obtain a second equation set for eliminating the signal offset value;
setting a signal gain value of a 0 th column in a second equation set, and converting the second equation set into a matrix form to obtain a first matrix;
performing linear fitting on elements in the first matrix as coordinate points to obtain a first linear equation about a signal gain value to be solved;
transpose the first matrix to obtain a first transpose matrix;
and solving a signal gain value to be solved in the first linear equation according to the first transfer matrix.
Further, the range of the signal gain value of the 0 th column in the second equation set is (0, 1).
Further, performing linear fitting based on a least square method to obtain each signal offset value in the signal offset matrix, including:
subtracting the linear equations of two adjacent columns of pixel points in the same row in each image in the linear equation set to obtain a first equation set for eliminating correction pixel values;
designating a signal offset value of a 0 th column in the first equation set, and converting the first equation set into a matrix form to obtain a second matrix;
performing linear fitting on elements in the second matrix as coordinate points to obtain a second linear equation about the signal offset value to be solved;
transposing the second matrix to obtain a second transposed matrix;
and solving a signal offset value to be solved in the second linear equation according to the second transposed matrix.
Further, the value of the signal offset value of the 0 th column in the first equation set is the average value of the original pixels of the 0 th image, and the product of the signal gain value of the 0 th column and the original pixel value of the 0 th row and the 0 th column in the second equation set is subtracted;
or,
the value of the signal offset value of the 0 th row in the first equation set is the preset correction pixel value of the 0 th image, and the product of the signal gain value of the 0 th row and the pixel value of the 0 th row in the second equation set and the pixel value of the 0 th row and the 0 th column in the 0 th image is subtracted.
Further, performing flat field correction on each image according to the corrected pixel value, including:
the pixel value of each image is set as the calculated corrected pixel value.
An image flat field correction device based on linear fitting, comprising:
the acquisition module is used for acquiring a plurality of images of the shot object;
the original pixel acquisition module is used for acquiring an original pixel value of each pixel point in each image;
a matrix establishing module for establishing a signal gain matrix and a signal offset matrix about each pixel point in each image;
the equation building module is used for building a linear equation set of corrected pixel values of each image according to the original pixel values, the signal gain matrix and the signal offset matrix;
the fitting module is used for carrying out linear fitting based on a least square method to obtain each signal gain value in the signal gain matrix and each signal offset value in the signal offset matrix;
the calculating module is used for calculating and obtaining a correction pixel value of each image according to the signal gain matrix, the signal offset matrix and the linear equation set which are obtained by fitting;
and the correction module is used for carrying out flat field correction on each image according to the correction pixel value.
The image flat field correction method and device based on linear fitting provided by the invention at least comprise the following beneficial effects:
(1) The built-in parameters of the camera are not required to be obtained or changed, so that the flat field correction can be performed only by obtaining a group of images shot by the camera, and the universality is strong;
(2) All parameters can be fitted through a group of pictures without additionally shooting dark field images by using a camera, and the efficiency is high.
(3) Only a least square method linear fitting method is used, the method is easy to understand and realize, and accumulated errors superposed by a plurality of methods are avoided, so that the image precision after flat field correction is high;
(4) And the flat field correction can be completed only at the algorithm level without additional experiment platforms and devices, the operation is convenient and simple, and the production cost is effectively reduced.
Drawings
Fig. 1 is a flowchart of an embodiment of an image flat field correction method based on linear fitting according to the present invention.
Fig. 2 is a schematic diagram of an embodiment of an original image pixel in the linear fitting-based image flat field correction method according to the present invention.
Fig. 3 is a flowchart of an embodiment of obtaining a signal gain by fitting in the image flat field correction method based on linear fitting according to the present invention.
Fig. 4 is a flowchart of an embodiment of obtaining a signal offset by fitting in the image flat field correction method based on linear fitting according to the present invention.
Fig. 5 is a schematic diagram of linear fitting under an application scenario of the image flat field correction method based on linear fitting provided by the invention.
Fig. 6 is a schematic diagram of a signal gain value obtained by fitting in an application scenario according to the image flat field correction method based on linear fitting provided by the invention.
Fig. 7 is a schematic diagram of a signal offset obtained by fitting in an application scenario according to the image flat field correction method based on linear fitting provided by the invention.
Fig. 8 is a schematic structural diagram of an embodiment of an image flat field correction device based on linear fitting according to the present invention.
Description of the embodiments
In order to better understand the above technical solutions, the following detailed description will be given with reference to the accompanying drawings and specific embodiments.
Referring to fig. 1, in some embodiments, an image flat field correction method based on linear fitting is provided, comprising:
s1, collecting a plurality of images of a shot object;
s2, acquiring an original pixel value of each pixel point in each image;
s3, establishing a signal gain matrix and a signal offset matrix which act on each pixel point in each image;
s4, establishing a linear equation set of corrected pixel values of each image according to the original pixel values, the signal gain matrix and the signal offset matrix;
s5, performing linear fitting based on a least square method to obtain each signal gain value in a signal gain matrix and each signal offset value in a signal offset matrix;
s6, calculating and obtaining a correction pixel value of each image according to the signal gain matrix, the signal offset matrix and the linear equation set which are obtained by fitting;
s7, carrying out flat field correction on each image according to the correction pixel value.
Further, in step S1, the camera captures a certain object to obtain a set of images for flat field correction, and two conditions need to be satisfied: firstly, the shot object needs to have uniform gray value in the whole image range; secondly, the exposure time of the camera needs to be adjusted so that the gray values of different images are different. In the multiple images, the number of row pixel points is the same and the number of column pixel points is the same for different images.
Further, in step S2, an original pixel value of each pixel in each image is obtained, and the original pixel values of each pixel in each image form an original pixel matrix.
For example, the number of the plurality of images is K, each image includes n (row) ×m (column) pixels, where the original pixel matrix of the 0 th image is:
Figure SMS_4
wherein x is ij_0 Representing the original pixel value of the ith row and jth column of the 0 th image;
the original pixel matrix of the 1 st image is:
Figure SMS_5
wherein x is ij_1 Representing the original pixel value of the ith row and jth column of the 1 st image;
the original pixel matrix for the K-1 th image is:
Figure SMS_6
wherein x is ij_(K-1) Representing the original pixel values of the ith row and jth column of the K-1 th image, i=0, 1,2, … … n-1, j=0, 1,2, … … m-1.
Further, the pixel values of any position of an image should be equal everywhere, but are affected by different camera exposure at different moments, and the pixel value error of each image is relatively large, as shown in fig. 2. In order to eliminate the dark field and the field effect of the camera, a flat field correction is required to be performed on each image, each image is n (row) x m (column) pixel points, then a signal gain matrix a formed by n x m signal gain values and a signal offset matrix b formed by n x m signal offset values, which are subjected to flat field correction, of each pixel point are fitted by using the pixel values of the original K images, and then y=ax+b transformation is performed on all pixel values x of the image to obtain a corrected pixel value y, namely a flat field correction result. For all pixels of the same image, it is desirable that the corrected pixel values are substantially equal, i.e., in an ideal state, the same image has only 1 corrected pixel y value. For different images, it is desirable to correct with the same model, i.e. all images use the same set of signal gain matrix a and signal offset matrix b.
Specifically, in step S3, the number of the plurality of images is K, and each image includes n×m pixels; the signal gain matrix is:
Figure SMS_7
the signal offset matrix is:
Figure SMS_8
wherein i=0, 1,2, … … n-1, j=0, 1,2, … … m-1, a ij Signal gain value, b, representing pixel point of ith row and jth column in image ij And the signal offset value of the pixel point in the ith row and the jth column in the image is represented.
Specifically, in step S4, the linear equation of the pixel point in the ith row and the jth column of the kth image is:
Figure SMS_9
wherein x is ij_k Representing the original pixel value, y, of the ith row and jth column pixel points in the kth image k A corrected pixel value representing the kth image;
the linear equation set comprises a linear equation of each pixel point of each image.
The linear system of equations for image 0 can be expressed as:
line 0:
Figure SMS_10
line 1:
Figure SMS_11
;
line (n-1):
Figure SMS_12
the system of linear equations for image 1 can be expressed as:
line 0:
Figure SMS_13
;/>
line 1:
Figure SMS_14
line (n-1):
Figure SMS_15
the linear system of equations for the k-1 th image can be expressed as:
line 0:
Figure SMS_16
line 1:
Figure SMS_17
line (n-1):
Figure SMS_18
wherein:
Figure SMS_19
the signal gain matrix is the signal gain applied to n x m pixels of the image;
Figure SMS_20
the signal offset matrix is the signal offset applied to n x m pixels of the image;
Figure SMS_21
pixel value for the 0 th image;
Figure SMS_22
pixel value for 1 st image;
Figure SMS_23
pixel values for the k-1 th image;
Figure SMS_24
corrected pixel values for the 0 th, 1 st.
The linear equations for each pixel of all images are listed as follows:
table 1: linear equation set for 0 th row and m column of k images
Figure SMS_25
;
Table 2: flat field correction linear equation system for 1 st row and m column of k images
Figure SMS_26
;
Table 3: flat field correction linear equation set for (n-1) th row and m column of k images
Figure SMS_27
Further, as shown in fig. 3, in step S5, linear fitting is performed based on a least square method, to obtain each signal gain value in the signal gain matrix, including:
s501, subtracting the linear equations of two adjacent columns of pixel points of the same row in each image in the linear equation set to obtain a first equation set for eliminating correction pixel values;
s502, sequentially subtracting equations in the first equation set to obtain a second equation set for eliminating signal offset values;
s503, setting a signal gain value of a 0 th column in a second equation set, and converting the second equation set into a matrix form to obtain a first matrix;
s504, performing linear fitting by taking elements in the first matrix as coordinate points to obtain a first linear equation about a signal gain value to be solved;
s505, transpose the first matrix to obtain a first transpose matrix;
s506, according to the first transfer matrix, solving a signal gain value to be solved in the first linear equation.
Specifically, the signal gains are fitted first:
Figure SMS_28
according to the linear equation set of tables 1-3, the first equation set for eliminating the corrected pixel value is obtained by first subtracting the 0 st column from the 1 st column by using the same signal offset b of the same column of different images and the same corrected pixel value y of the same image and different columns, as follows:
Figure SMS_29
;(1)
Figure SMS_30
; (2)
Figure SMS_31
; (k)
then subtracting equation (1) from equation (2), subtracting equation (2) from equation (3.) equation (k) subtracting equation (k-1), a second system of equations may be obtained:
Figure SMS_32
Figure SMS_33
Figure SMS_34
from the above, it can be seen that a 00 、a 01 ...a 0(m-1) The values of (a) cannot be obtained by fitting all the above formulae, and a must be specified 00 The value a can be calculated in turn 01 ...a 0(m-1) Is a value of (2). Designation a 00 After the values, the second equation set is written in the form of a matrix, and a first matrix is obtained:
Figure SMS_35
the handle is arranged on the side of the handle,
Figure SMS_36
Figure SMS_37
,...
Figure SMS_38
viewed as coordinate points, these pointsObtaining a linear equation y=a about the signal gain value to be solved through linear fitting 01 x. Fitting a 01 The least squares method can be used: transpose the first matrix to obtain a first transpose matrix:
Figure SMS_39
order the
Figure SMS_40
Figure SMS_41
The above can be written as a 01 X=Y,a 01 The expression of (2) is: a, a 01 =YX T (XX T ) -1
Similarly, all adjacent two columns of the table 1 are subjected to the operation, namely, k equations are obtained by subtracting the two columns, then adjacent two rows of the equations are sequentially subtracted, and then a is obtained by using a least square fitting method 02 ,a 03 ,...a 0(m-1) . The same operation is performed on table 2, table 3. All n x m a values are finally solved to obtain each signal gain value in the signal gain matrix.
The range of the signal gain value of the 0 th column in the second equation set is (0, 1). Further, as shown in fig. 4, in step S5, linear fitting is performed based on a least square method, to obtain each signal offset value in the signal offset matrix, including:
s507, subtracting the linear equations of two adjacent columns of pixel points of the same row in each image in the linear equation set to obtain a first equation set for eliminating correction pixel values;
s508, designating a signal offset value of a 0 th column in the first equation set, and converting the first equation set into a matrix form to obtain a second matrix;
s509, performing linear fitting by taking elements in the second matrix as coordinate points to obtain a second linear equation about the signal offset value to be solved;
s510, transposing the second matrix to obtain a second transposed matrix;
s511, according to the second transposed matrix, solving a signal offset value to be solved in the second linear equation.
Specifically, after the signal gain matrix is obtained, the signal offset is fitted:
Figure SMS_42
to find b 00 ,b 01 ...b 0(m-1) From the system of equations in table 1, subtracting the k equations for the 1 st column image from the k equations for the 0 th column image may result in a first system of equations:
Figure SMS_43
Figure SMS_44
Figure SMS_45
and find a 00 , a 01 ...a 0(m-1) In the same way as above, a b must be specified first 00 Value b can be calculated sequentially 01 ...b 0(m-1) Is a value of (2). Designation b 00 After the value, the first equation set performs the term transfer:
Figure SMS_46
Figure SMS_47
Figure SMS_48
wherein C is 00 , C 01 ... C 0(k-1) Are all constant.
Writing the first equation set into a matrix form to obtain a second matrix:
Figure SMS_49
handle
Figure SMS_50
Figure SMS_51
...
Figure SMS_52
Seen as coordinate points, which are linearly fitted to obtain a linear equation y=b for the signal gain value to be solved 01 x. Fitting b 01 The least squares method can be used: and transposing the second matrix to obtain a second transposed matrix:
Figure SMS_53
order the
Figure SMS_54
Figure SMS_55
,b 01 Can pass through b 01 =YX T (XX T ) -1 And (5) solving.
And so on, subtracting the k equations of the jth image from the (j=1, 2..m-1) equation of the jth image from the (j-1) image to obtain a new equation set, and fitting by using a least square method to obtain b 02 ,b 03 ,...b 0(m-1) . Table 2, table 3. The same operation was performed and finally all n x m b values were solved.
The value of the signal offset value of the 0 th column in the first equation set is the average value of the original pixels of the 0 th image, and the product of the signal gain value of the 0 th column and the original pixel value of the 0 th row and the 0 th column in the second equation set is subtracted.
In some embodiments, the signal offset value of the 0 th column in the first equation set may be a preset correction pixel value of the 0 th image, which is subtracted from the product of the signal gain value of the 0 th column in the second equation set and the pixel value of the 0 th column and the 0 th row of the 0 th image.
In some application scenarios, there may be a requirement for the corrected pixel value of the image, for example, the pixel value after the correction of the 0 th image is required to be 200, and then the preset corrected pixel value may be set to be 200, and the product of the signal gain value of the 0 th column in the second equation set multiplied by the pixel value of the 0 th row and the 0 th column in the second equation set is subtracted from 200, so that the final calculated corrected pixel value is ensured to be about 200.
The original pixel value of each image is:
Figure SMS_56
the corrected pixel values after calibration are:
Figure SMS_57
the corrected pixel value is obtained according to the following formula:
Figure SMS_58
further, performing flat field correction on each image according to the corrected pixel value, including:
the pixel value of each image is set as the calculated corrected pixel value.
The method provided in this embodiment is further described below through a specific application scenario.
Assume that a camera shoots 12 original images, and each image is composed of 1000 x 15552 pixels.
1. Acquiring 12X 1000X 15552 pixel values, and marking a pixel matrix of the ith picture as X i Then:
Figure SMS_59
;
Figure SMS_60
;
Figure SMS_61
2. a linear system of equations is listed for all pixels to perform flat field correction, resulting in 12 x 1000 x 15552 equations, as shown in tables 4-6 below:
table 4: linear equation set of line 0, 15552, column for 12 images
Figure SMS_62
;
Table 5: linear equation set of line 1, 15552 column for 12 images
Figure SMS_63
;
Table 6: linear equation set of 999 th row 15552 column for k images
Figure SMS_64
3. Fitting signal gain:
Figure SMS_65
designation a 00 Taking the first 2 columns of 12 x 15552 equations of table 4, subtracting the 1 st column equation set from the 0 th column equation set, and subtracting the i-1 th row equation from the i-1 th row equation in turn (i=1, 2,..11), 11 equations can be obtained:
Figure SMS_66
handle
Figure SMS_67
Figure SMS_68
...
Figure SMS_69
Seen as coordinate points, these points are subjected to a linear fit, as shown in fig. 5, by the least squares method: writing the above equation set in the form of a matrix can result in:
Figure SMS_70
and (3) making:
Figure SMS_71
Figure SMS_72
the above can be written as a 01 X=Y,a 01 The expression of (2) is: a, a 01 =YX T (XX T ) -1
Other a were obtained by fitting in the same manner.
4. Fitting signal offset:
Figure SMS_73
calculating the pixel mean value of the 0 th image as x avg Designation b 00 =x avg -a 00 *x 00_0 Then, taking the first 2 columns of 12 x 15552 equations of table 4, subtracting the 1 st column equation set from the 0 th column equation set, we can get 12 equations:
Figure SMS_74
Figure SMS_75
Figure SMS_76
fitting a to 01 The method is the same, and the equation set is written in a matrix form, so that the following steps are obtained:
Figure SMS_77
order the
Figure SMS_78
Figure SMS_79
,b 01 Can be represented by formula b 01 =YX T (XX T ) -1 And (5) solving. />
Other b values were obtained by fitting in the same manner.
Taking a and b of row 0 as an example, fig. 6 and 7 respectively show values of a and b corresponding to 15552 columns of row 0 of each image, wherein the abscissa shows the values of a and b respectively from row 0 to column 0 and the ordinate shows the values of b and the abscissa shows the values of a, and it can be seen that the values of a obtained by fitting are relatively large and the values of b obtained by fitting relatively small pixel points on row 0 of the same photo.
5. Performing flat field correction on an image:
the original pixel value of each image is
Figure SMS_80
According to the formula:
Figure SMS_81
;
the corrected pixel value of each point after the flat field correction can be obtained:
Figure SMS_82
the image after flat field correction based on linear fitting has substantially uniform pixel values at each pixel point.
Referring to fig. 8, in some embodiments, there is also provided an image flat field correction device based on linear fitting, comprising:
an acquisition module 201, configured to acquire a plurality of images of a photographic subject;
an original pixel obtaining module 202, configured to obtain an original pixel value of each pixel point in each image;
a matrix creation module 203 for creating a signal gain matrix and a signal offset matrix for each pixel point in each image;
an equation building module 204 for building a linear equation set for the corrected pixel values for each image based on the raw pixel values, the signal gain matrix and the signal offset matrix;
a fitting module 205, configured to perform linear fitting based on a least square method, to obtain each signal gain value in the signal gain matrix and each signal offset value in the signal offset matrix;
a calculation module 206, configured to calculate a correction pixel value of each image according to the signal gain matrix, the signal offset matrix, and the linear equation set obtained by fitting;
a correction module 207 for performing a flat field correction on each image based on the correction pixel values.
The image flat field correction method and device based on linear fitting provided by the embodiment at least comprise the following beneficial effects:
(1) The built-in parameters of the camera are not required to be obtained or changed, so that the flat field correction can be performed only by obtaining a group of images shot by the camera, and the universality is strong;
(2) All parameters can be fitted through a group of pictures without additionally shooting dark field images by using a camera, and the efficiency is high.
(3) Only a least square method linear fitting method is used, the method is easy to understand and realize, and accumulated errors superposed by a plurality of methods are avoided, so that the image precision after flat field correction is high;
(4) And the flat field correction can be completed only at the algorithm level without additional experiment platforms and devices, the operation is convenient and simple, and the production cost is effectively reduced.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention. It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (10)

1. An image flat field correction method based on linear fitting, comprising:
collecting a plurality of images of a photographed object;
acquiring an original pixel value of each pixel point in each image;
establishing a signal gain matrix and a signal offset matrix for each pixel point in each image;
establishing a linear equation set of corrected pixel values for each image according to the original pixel values, the signal gain matrix and the signal offset matrix;
performing linear fitting based on a least square method to obtain each signal gain value in a signal gain matrix and each signal offset value in a signal offset matrix;
calculating and obtaining a correction pixel value of each image according to the signal gain matrix, the signal offset matrix and the linear equation set which are obtained by fitting;
and carrying out flat field correction on each image according to the correction pixel value.
2. The method of claim 1, wherein the number of row pixels and the number of column pixels are the same for different ones of the plurality of images, and wherein the gray scale values are different between different ones of the plurality of images.
3. The method according to claim 1 or 2, wherein the number of the plurality of images is K, each image comprising n x m pixels; the signal gain matrix is:
Figure QLYQS_1
the signal offset matrix is:
Figure QLYQS_2
wherein i=0, 1,2, … … n-1, j=0, 1,2, … … m-1, a ij Signal gain value, b, representing pixel point of ith row and jth column in image ij And the signal offset value of the pixel point in the ith row and the jth column in the image is represented.
4. A method according to claim 3, wherein the linear equation for the ith row and jth column pixels of the kth image is:
Figure QLYQS_3
wherein x is ij_k Representing the original pixel value, y, of the ith row and jth column pixel points in the kth image k Corrected pixel values representing the kth image, i=0, 1,2, … … n-1, j=0, 1,2, … … m-1, a ij Signal gain value, b, representing pixel point of ith row and jth column in image ij A signal offset value representing an ith row and jth column of pixels in the image;
the linear equation set comprises a linear equation of each pixel point of each image.
5. The method of claim 4, wherein obtaining each signal gain value in the signal gain matrix based on a linear fit by least squares method comprises:
subtracting the linear equations of two adjacent columns of pixel points in the same row in each image in the linear equation set to obtain a first equation set for eliminating correction pixel values;
sequentially subtracting the equations in the first equation set to obtain a second equation set for eliminating the signal offset value;
setting a signal gain value of a 0 th column in a second equation set, and converting the second equation set into a matrix form to obtain a first matrix;
performing linear fitting on elements in the first matrix as coordinate points to obtain a first linear equation about a signal gain value to be solved;
transpose the first matrix to obtain a first transpose matrix;
and solving a signal gain value to be solved in the first linear equation according to the first transfer matrix.
6. The method of claim 5, wherein the signal gain value in column 0 of the second set of equations is in the range of (0, 1).
7. The method of claim 5, wherein obtaining each signal offset value in the signal offset matrix based on a linear fit based on a least squares method comprises:
subtracting the linear equations of two adjacent columns of pixel points in the same row in each image in the linear equation set to obtain a first equation set for eliminating correction pixel values;
designating a signal offset value of a 0 th column in the first equation set, and converting the first equation set into a matrix form to obtain a second matrix;
performing linear fitting on elements in the second matrix as coordinate points to obtain a second linear equation about the signal offset value to be solved;
transposing the second matrix to obtain a second transposed matrix;
and solving a signal offset value to be solved in the second linear equation according to the second transposed matrix.
8. The method of claim 7, wherein the value of the signal offset value of column 0 in the first system of equations is the average value of the original pixels of the 0 th image, and the product of the signal gain value of column 0 and the original pixel value of column 0 of the 0 th image in the second system of equations is subtracted; or,
the value of the signal offset value of the 0 th row in the first equation set is the preset correction pixel value of the 0 th image, and the product of the signal gain value of the 0 th row and the original pixel value of the 0 th row in the second equation set are subtracted.
9. The method of claim 1, wherein performing a flat field correction on each image based on the corrected pixel values comprises:
the pixel value of each image is set as the calculated corrected pixel value.
10. An image flat field correction device based on linear fitting, comprising:
the acquisition module is used for acquiring a plurality of images of the shot object;
the original pixel acquisition module is used for acquiring an original pixel value of each pixel point in each image;
a matrix establishing module for establishing a signal gain matrix and a signal offset matrix about each pixel point in each image;
the equation building module is used for building a linear equation set of corrected pixel values of each image according to the original pixel values, the signal gain matrix and the signal offset matrix;
the fitting module is used for carrying out linear fitting based on a least square method to obtain each signal gain value in the signal gain matrix and each signal offset value in the signal offset matrix;
the calculating module is used for calculating and obtaining a correction pixel value of each image according to the signal gain matrix, the signal offset matrix and the linear equation set which are obtained by fitting;
and the correction module is used for carrying out flat field correction on each image according to the correction pixel value.
CN202310160209.3A 2023-02-24 2023-02-24 Image flat field correction method and device based on linear fitting Active CN116029938B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310160209.3A CN116029938B (en) 2023-02-24 2023-02-24 Image flat field correction method and device based on linear fitting

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310160209.3A CN116029938B (en) 2023-02-24 2023-02-24 Image flat field correction method and device based on linear fitting

Publications (2)

Publication Number Publication Date
CN116029938A true CN116029938A (en) 2023-04-28
CN116029938B CN116029938B (en) 2023-06-23

Family

ID=86081429

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310160209.3A Active CN116029938B (en) 2023-02-24 2023-02-24 Image flat field correction method and device based on linear fitting

Country Status (1)

Country Link
CN (1) CN116029938B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116709046A (en) * 2023-07-03 2023-09-05 深圳市度申科技有限公司 Fixed pattern noise calculation and compensation method
CN116777999A (en) * 2023-06-28 2023-09-19 深圳市度申科技有限公司 Multi-adaptability high-level flat field correction method for area array camera

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1469312A (en) * 2002-05-30 2004-01-21 ������������ʽ���� Apparatus and method for correcting image data obtained from image detector
US20070177032A1 (en) * 2006-01-27 2007-08-02 Nethra Imaging Automatic color calibration of an image sensor
CN101442608A (en) * 2008-12-31 2009-05-27 中国资源卫星应用中心 Method for improving relative radiation correction of CCD camera
CN102521797A (en) * 2011-11-04 2012-06-27 华中科技大学 Scene non-uniform correction method for scanning type infrared imaging system
US20130182934A1 (en) * 2012-01-13 2013-07-18 Carestream Health, Inc. Self correcting portable digital radiography detector, methods and systems for same
CN105929340A (en) * 2016-06-30 2016-09-07 四川普力科技有限公司 Method for estimating battery SOC based on ARIMA
CN108986170A (en) * 2018-07-03 2018-12-11 武汉精测电子集团股份有限公司 A kind of line-scan digital camera method for correcting flat field suitable for field working conditions
CN109660736A (en) * 2017-10-10 2019-04-19 凌云光技术集团有限责任公司 Method for correcting flat field and device, image authentication method and device
CN109767403A (en) * 2019-01-23 2019-05-17 西安科技大学 A kind of infrared focal plane array strip noise cancellation method based on scene
CN113808046A (en) * 2021-09-18 2021-12-17 凌云光技术股份有限公司 Method and device for acquiring flat field correction parameters
CN115361494A (en) * 2022-10-09 2022-11-18 浙江双元科技股份有限公司 High-speed stroboscopic image processing system and method of multi-line scanning image sensor
CN115665579A (en) * 2022-10-17 2023-01-31 长春长光辰芯光电技术有限公司 Optical response nonuniformity correction method on COMS image sensor

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1469312A (en) * 2002-05-30 2004-01-21 ������������ʽ���� Apparatus and method for correcting image data obtained from image detector
US20070177032A1 (en) * 2006-01-27 2007-08-02 Nethra Imaging Automatic color calibration of an image sensor
CN101442608A (en) * 2008-12-31 2009-05-27 中国资源卫星应用中心 Method for improving relative radiation correction of CCD camera
CN102521797A (en) * 2011-11-04 2012-06-27 华中科技大学 Scene non-uniform correction method for scanning type infrared imaging system
US20130182934A1 (en) * 2012-01-13 2013-07-18 Carestream Health, Inc. Self correcting portable digital radiography detector, methods and systems for same
CN105929340A (en) * 2016-06-30 2016-09-07 四川普力科技有限公司 Method for estimating battery SOC based on ARIMA
CN109660736A (en) * 2017-10-10 2019-04-19 凌云光技术集团有限责任公司 Method for correcting flat field and device, image authentication method and device
CN108986170A (en) * 2018-07-03 2018-12-11 武汉精测电子集团股份有限公司 A kind of line-scan digital camera method for correcting flat field suitable for field working conditions
CN109767403A (en) * 2019-01-23 2019-05-17 西安科技大学 A kind of infrared focal plane array strip noise cancellation method based on scene
CN113808046A (en) * 2021-09-18 2021-12-17 凌云光技术股份有限公司 Method and device for acquiring flat field correction parameters
CN115361494A (en) * 2022-10-09 2022-11-18 浙江双元科技股份有限公司 High-speed stroboscopic image processing system and method of multi-line scanning image sensor
CN115665579A (en) * 2022-10-17 2023-01-31 长春长光辰芯光电技术有限公司 Optical response nonuniformity correction method on COMS image sensor

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KUANGMING YAP 等: "Gain Error Correction for CMOS Image Sensor Using Delta-Sigma Modulation", 《IEEE》 *
闫苏琪 等: "基于最小二乘拟合的科学级CMOS传感器非均匀性校正", 《电子设计工程》, pages 151 - 155 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116777999A (en) * 2023-06-28 2023-09-19 深圳市度申科技有限公司 Multi-adaptability high-level flat field correction method for area array camera
CN116709046A (en) * 2023-07-03 2023-09-05 深圳市度申科技有限公司 Fixed pattern noise calculation and compensation method
CN116709046B (en) * 2023-07-03 2023-12-15 深圳市度申科技有限公司 Fixed pattern noise calculation and compensation method

Also Published As

Publication number Publication date
CN116029938B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
CN116029938B (en) Image flat field correction method and device based on linear fitting
CN107071234B (en) Lens shadow correction method and device
US8659685B2 (en) Method and apparatus for calibrating and correcting shading non-uniformity of camera systems
CN108871588A (en) A kind of infrared imaging system various dimensions joint asymmetric correction method
CN110738707A (en) Distortion correction method, device, equipment and storage medium for cameras
CN108495101B (en) A kind of method for correcting image, device, image capture device and readable storage medium storing program for executing
CN110533618B (en) Lens distortion correction method and photographic device
TWI638149B (en) Luminance measurement method, luminance measurement device, and image quality adjustment technique using the method and device
US20180063454A1 (en) Method and apparatus for correcting fixed pattern noise of an infrared image
CN110501025B (en) On-orbit calibration method of rolling shutter area array CMOS camera
CN110766615B (en) Picture correction method, device, terminal and computer readable storage medium
GB2442050A (en) Image pixel value correction
CN107403410B (en) Splicing method of thermal infrared images
US9143756B2 (en) Camera module, photographing method, and electronic apparatus
CN105869129B (en) For the thermal infrared images residue non-uniform noise minimizing technology after nonuniformity correction
US20080278613A1 (en) Methods, apparatuses and systems providing pixel value adjustment for images produced with varying focal length lenses
CN112489137A (en) RGBD camera calibration method and system
CN111652815B (en) Mask plate camera image restoration method based on deep learning
US8542919B2 (en) Method and system for correcting lens shading
JP2012204856A (en) Image processing method and camera module
CN113808046B (en) Flat field correction parameter acquisition method and device
US20100110241A1 (en) Multi illuminant shading correction using singular value decomposition
US8331722B2 (en) Methods, apparatuses and systems providing pixel value adjustment for images produced by a camera having multiple optical states
CN107203150B (en) Non-uniformity correction method based on infrared semi-physical simulation system
CN110536066B (en) Panoramic camera shooting method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant