Image sensor module correction method, device and medium
Through the combination of pixel correction model and light intensity coefficient, the light leakage problem of CMOS image sensors during global shutter operation is solved, and the odd and even row horizontal stripes are corrected, which improves the image quality. It is suitable for the existing CMOS image sensor structure and reduces the cost. production costs.
Patent Information
- Application Number
- CN202410940762.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-07-15
AI Technical Summary
Existing CMOS image sensors have light leakage during global shutter operation, resulting in odd and even row horizontal stripes, which affects image quality. It is difficult to effectively correct the light leakage inconsistency caused by the pixel structure and arrangement using existing technology.
By obtaining the first image with the optical center facing the light source, determine the correction coefficient of the pixel correction model, correct the pixels of the second image one by one based on the pixel correction model and the light intensity coefficient, and output the third image. The grayscale values of the pixels in odd rows are equal to The grayscale values of pixels in odd-numbered rows of the second image are the same, and the grayscale values of pixels in even-numbered rows are the same as the grayscale values of pixels in even-numbered rows of the second image. The principle of light leakage is used to realize image correction.
It effectively eliminates parasitic light induction and improves the quality of the image output by the CMOS image sensor. It is suitable for the original structure of the CMOS image sensor without changing the sensor structure and reduces production costs.
Smart Images

Figure CN118488330B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image sensor module correction method, device and medium. Background Art
[0002] Image sensors are devices that convert light signals into electrical signals. Existing mature image sensors include two categories: charge coupled devices (CCDs) and complementary metal oxide semiconductors (CMOS). These two types of sensors adjust the exposure time by operating the shutter, where the operation of the shutter is to adjust the amount of light by starting and / or ending the exposure. The shutter can operate under various electronic shutter mechanisms (such as, for example, rolling shutters and global shutters).
[0003] In the rolling shutter method, all pixels in a row of the image sensor collect light in the same period of time, but the exposure start time of each row is different. The rolling shutter will produce a smear phenomenon when shooting high-speed moving objects. In the global shutter method, exposure starts at the same time in all pixels of the image sensor, and after the appropriate exposure time, exposure ends at the same time in all pixels, using the memory provided to each pixel to store the charge formed by photoelectric conversion.
[0004] In the composition structure of the pixel unit, the photoelectric conversion node is responsible for performing the photoelectric conversion process and converting the light signal into electric charge. The storage node is responsible for storing the charge before the pixel is read out. In fact, the storage node will also produce a photoelectric effect, which is called a parasitic response.
[0005] When the global shutter is in operation, after the photogenerated charge is stored in the pixel-level storage until the charge is read out, light leakage may occur due to parasitic response, so the photogenerated charge in the pixel-level storage may leak into the surrounding pixels associated with the high-brightness object. In the case of the last pixel read out, the light leakage phenomenon is positively correlated with the time to perform the readout. However, CMOS sensors generally use row-by-row readout, which causes the image to wait for readout in the row direction. The time gradually increases, which in turn causes the degree of light leakage to be inconsistent in the row direction and distorts the image.
[0006] Furthermore, when the pixel design adopts an odd-even row symmetrical design, the odd-even row storage nodes are symmetrically distributed relative to the photoelectric conversion nodes. Due to the angle, the leakage light in the odd and even rows will have a large difference, causing the CMOS sensor output image to have obvious odd-even row horizontal stripes, which seriously distorts the image and has a very large impact on machine vision applications.
[0007] The problem that the existing horizontal stripe correction algorithm needs to solve is the horizontal stripes caused by the inconsistent ADC gain and bias during the charge readout amplification process. The difference between rows = light intensity × exposure time × gain difference + bias difference, which can be corrected by grayscale linear method, and has nothing to do with pixel structure, lens or light angle. However, this solution solves the problem of correcting odd and even row horizontal stripes caused by inconsistent light leakage caused by the arrangement of pixel structure, and the technical problem solved by this solution occurs in the light leakage after the end of exposure. The difference between rows is not related to the exposure time, but to the light intensity; therefore, it is impossible to directly use the grayscale linear correction method (i.e. the above-mentioned horizontal stripe correction algorithm) to solve the technical problem of this solution.
[0008] In order to reduce light leakage, CMOS sensors usually use an opaque metal layer to cover the storage node to isolate it from light. However, due to the refraction and reflection of the microlens and light guide on the pixel surface, there will still be a certain degree of light leakage on the side of the storage node. Chinese patents CN201811208495.1, CN 201410482610.X, and CN201410838624.0 improve the light leakage phenomenon by changing the structural design of the CMOS sensor. However, changing the structure of the CMOS sensor requires more complex and more expensive process production lines, which leads to high application costs of these technologies. At the same time, it is impossible to improve and apply a large number of old process products that have already been produced.
[0009] In addition, there are some correction methods based on acquired images, as follows:
[0010] Chinese patent CN108174127A discloses a relative radiation correction method for area array CMOS, which solves the problems of greater noise, smaller dynamic range, poor pixel response uniformity, and gradually lower grayscale values of each row in a single image due to light leakage when the existing area array CMOS detector works in global shutter mode. The technical problem of this patent is different from that of the present application.
[0011] Chinese patent CN102316283B discloses a real-time device for eliminating light leakage in a spatial inter-row transfer area array CCD camera. The patent extracts light leakage signals from dark pixel areas to correct the corresponding columns of the original image data, with a small amount of calculation; and because the light leakage signal can accurately represent the light leakage charge generated in the high-brightness area, the light leakage phenomenon is well eliminated without changing the working conditions of the CCD. The technical issues of this patent are different from those of the present application.
[0012] Chinese patent CN 117319819 A discloses a parasitic light induction correction method for multi-exposure large dynamic range transient images. Through the original structure of the multi-exposure large dynamic range transient imaging system, the parasitic light induction is eliminated and the accuracy of the acquired transient images is improved. The technical problem of this patent is different from that of the present application.
[0013] Chinese patent CN112019780A discloses a readout circuit of a CMOS image sensor and a method for removing horizontal stripe noise from the readout circuit. The patent introduces a pseudo pixel array to eliminate horizontal stripe noise introduced by power supply interference, thereby effectively improving the image readout quality of the CMOS image sensor. The technical problem of the patent is different from that of the present application.
[0014] Chinese patent CN 105847712 B discloses a photographing device and a method for light leakage correction, wherein the photographing device quickly detects an area where light leakage has occurred while reading out charges stored in a plurality of pixels in an image sensor; and corrects the detected light leakage, thereby improving the deterioration of image quality. The patent compares the charge value of the pixel of the image sensor with a predetermined threshold value, and then corrects the charge value to generate an image. The patent has different technical means from the present application.
[0015] Chinese patent CN 104125421 B discloses a CMOS image sensor and a row noise correction method thereof. In the correction method, the CMOS image sensor adds a reference array on the basis of a pixel array, and uses each pixel unit of the reference array as a reference pixel unit. The row noise can be calculated by reading the output value of the reference pixel unit, thereby achieving row noise reduction, so that the image quality of the CMOS image sensor can be improved. The technical means of this patent are different from those of the present application. Summary of the invention
[0016] The present invention provides an image sensor module correction method, device and medium, which can solve at least one of the above-mentioned technical problems.
[0017] To achieve the above object, the present invention proposes the following technical solutions:
[0018] A method for correcting an image sensor module, wherein the image sensor module is composed of a CMOS image sensor and a lens, and comprises:
[0019] Acquire a first image in which the optical center of the module faces the light source, the number of rows of the CMOS image sensor is H, and the height of the first image is H rows;
[0020] Based on the first image, determining correction coefficients of a pixel correction model;
[0021] Selecting the same module to capture a second image, obtaining a maximum grayscale value of a pixel of the second image, and determining a light intensity coefficient of any pixel of the second image;
[0022] Based on the pixel correction model and the light intensity coefficient, correct the pixels of the second image one by one, and output a third image;
[0023] The correction value of the grayscale value of any pixel in the pixel correction model is proportional to the row coordinate of the pixel and the light intensity of the pixel.
[0024] Furthermore, the light intensity coefficient includes a ratio of a gray value of any pixel in the current image to a maximum gray value of a pixel in the current image as the light intensity coefficient of the pixel in the current image.
[0025] Furthermore, it also includes: in the third image, the grayscale values of the pixels in the odd rows are calculated by the pixel correction model, and the grayscale values of the pixels in the even rows are the same as the grayscale values of the pixels in the even rows of the second image.
[0026] Furthermore, it also includes: in the third image, the grayscale values of the pixels in the even-numbered rows are calculated by the pixel correction model, and the grayscale values of the pixels in the odd-numbered rows are the same as the grayscale values of the pixels in the odd-numbered rows of the second image.
[0027] Furthermore, based on the first image, a correction coefficient of the pixel correction model is determined, including: calculating the difference between the mean grayscale value of pixels in the (H-1)th row and the mean grayscale value of pixels in the (H-2)th row of the first image as a correction value for the grayscale value of pixels in the (H-1)th row, setting the light intensity coefficient of the (H-1)th row, and obtaining the correction coefficient based on the pixel correction model.
[0028] Further, based on the first image, a correction coefficient of the pixel correction model is determined, including: calculating the difference between the grayscale value mean of the pixels in the yth row and the grayscale value mean of the pixels in the (y+1)th row as the correction coefficient of the yth row; wherein y<(H-1).
[0029] Based on the same inventive concept, the present invention also proposes an image sensor module correction device, comprising:
[0030] Image sensor module, consisting of a CMOS image sensor and a lens;
[0031] The image processor is configured to determine a correction coefficient of a pixel correction model based on the first image; or to obtain a maximum grayscale value of a pixel of the second image based on the second image, and determine a light intensity coefficient of any pixel of the second image; and to correct pixels of the second image one by one based on the pixel correction model and the light intensity coefficient, and output a third image;
[0032] A memory for storing correction coefficients;
[0033] The correction value of the grayscale value of any pixel in the pixel correction model is proportional to the row coordinate of the pixel and the light intensity of the pixel.
[0034] Furthermore, it also includes a host computer, which is used to issue instructions to control the CMOS image sensor to capture images and / or control the image processor to perform correction.
[0035] Furthermore, it also includes: a light source for providing spatially uniform illumination characteristics.
[0036] On the other hand, the present invention further provides a computer-readable storage medium, comprising a computer program, wherein when the computer program is executed by a processor, the image sensor module correction method as described above is implemented.
[0037] The beneficial effects of the present invention are as follows:
[0038] The present application discloses a method for correcting an image sensor module. Based on the principle and law of light leakage, the collected image is analyzed and processed through a pixel correction model to achieve image correction, thereby eliminating parasitic light induction and improving the quality of the image output by the CMOS image sensor. In addition, the method uses the principle and law of light leakage to achieve image correction. For complex actual scenes, such as various exposure conditions formed by the combination of lens focal length and aperture, a pixel correction model suitable for the exposure conditions is constructed to solve the light leakage problem at the scene of use and improve the accuracy of obtaining the corrected image. Finally, the correction method of the present application is applicable to the original structure of the CMOS image sensor, does not make design improvements to the CMOS sensor structure, and does not incur the production cost of the new structure. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a schematic diagram of a flow chart of an image sensor module correction method in the present invention;
[0040] Figure 2 is a schematic diagram of a process for obtaining a correction coefficient in Embodiment 1 of the present invention;
[0041] Figure 3 is a schematic diagram of a process for obtaining a correction coefficient in Embodiment 2 of the present invention;
[0042] Figure 4 is a schematic diagram of the device structure of Example 3 of the present invention;
[0043] Figure 5 It is a schematic diagram of the device structure of Example 4 of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0045] like Figure 1 As shown, the present invention proposes an image sensor module correction method, the image sensor module is composed of a CMOS image sensor and a lens, including:
[0046] A first image is acquired in which the optical center of the module faces the light source, the number of rows of the CMOS image sensor is H, and the height of the first image is H rows.
[0047] Based on the first image, a correction coefficient of a pixel correction model is determined; wherein the correction value of the grayscale value of any pixel in the pixel correction model is proportional to the row coordinate of the pixel and the light intensity of the pixel.
[0048] The same module is selected to capture the second image, the maximum grayscale value of the pixel of the second image is obtained, and the light intensity coefficient of any pixel of the second image is determined. The light intensity coefficient includes: taking the ratio of the grayscale value of any pixel in the second image to the maximum grayscale value of the pixel of the second image as the light intensity coefficient of any pixel.
[0049] Based on the pixel correction model and the light intensity coefficient, the pixels of the second image are corrected one by one, and a third image is output.
[0050] In the third image, the grayscale values of the pixels in the odd-numbered rows are calculated by the pixel correction model, and the grayscale values of the pixels in the even-numbered rows are the same as the grayscale values of the pixels in the even-numbered rows of the second image.
[0051] Alternatively, in the third image, the grayscale values of the pixels in the even-numbered rows are calculated by the pixel correction model, and the grayscale values of the pixels in the odd-numbered rows are the same as the grayscale values of the pixels in the odd-numbered rows of the second image.
[0052] In this application, odd-numbered rows and even-numbered rows are relative concepts used to express their adjacent relationship.
[0053] In the method proposed in the present invention, the grayscale value of the odd-numbered row pixels is taken as an example to further illustrate the specific process of the present invention. The grayscale value of the even-numbered row pixels can also be corrected without changing the grayscale value of the odd-numbered row pixels to implement the correction method of the image sensor module; the specific implementation process can be achieved by exchanging the calculation process of the odd-numbered row and the even-numbered row in this application. Example 1
[0054] This embodiment proposes an image sensor module correction method, the image sensor module is composed of a CMOS image sensor and a lens, including:
[0055] A first image is acquired in which the optical center of the module faces the light source, the number of rows of the CMOS image sensor is H, and the height of the first image is H rows.
[0056] The first image is a calibration image of the currently selected image sensor module. The correction coefficient of the pixel correction model corresponding to the image sensor module is determined by acquiring the first image of uniform light collected by the image sensor module.
[0057] A specific point in the optical center of the image sensor module. The light passing through this point is not deflected when passing through the image sensor module, that is, this point is the center of the light beam. The optical center of the image sensor module refers to both the center point of the photosensitive surface of the CMOS image sensor and the center point of the lens, that is, the center of the imaging plane. Ideally, the light passing through the optical center will be perpendicular to the imaging plane.
[0058] The optical center of the image sensor module faces the light source so that the light projected by the light source is evenly distributed on the photosensitive surface of the CMOS image sensor after passing through the lens, avoiding the adverse effect of uneven light itself on the correction. If it is not facing, the light reaching the photosensitive surface of the CMOS image sensor may be uneven, and the light of the first image obtained at this time is uneven, resulting in incorrect correction results.
[0059] like Figure 2 As shown, based on the first image, the correction coefficient of the pixel correction model is determined. By calculating the difference between the mean grayscale value of the pixels in the (H-1)th row (the last row) and the mean grayscale value of the pixels in the (H-2)th row of the first image, as the correction value of the grayscale value of the pixels in the (H-1)th row, the light intensity coefficient of the (H-1)th row is set, and the correction coefficient is obtained based on the pixel correction model.
[0060] When the global shutter is in operation, after the photogenerated charge is stored in the pixel-level storage until the charge is read out, light leakage may occur due to parasitic response, so the photogenerated charge in the pixel-level storage can leak into the surrounding pixels associated with high-brightness objects. In the case of the last pixel read out, the charge leaked from the sensor is the result of the charge integration for a certain period of time under the light intensity felt by the pixel, so the light leakage is proportional to the light intensity. CMOS sensors generally use row-by-row readout, resulting in a gradual increase in the waiting time for the image to be read out in the row direction. Therefore, the last two rows of pixels in the CMOS image sensor respond more strongly to light than other rows.
[0061] In summary, based on the scene setting of acquiring the first image, that is, the light intensity of the last two rows of the first image is the largest. In this embodiment, the ratio of the gray value of any pixel in the current image to the maximum gray value of the pixel in the current image is used as the light intensity coefficient of any pixel. Therefore, the light intensity coefficient of the last two rows of pixels in the first image is set to 1.
[0062] In this embodiment, the pixel correction model is used to correct the grayscale values of pixels in odd rows. The correction values of the grayscale values of pixels in odd rows in the pixel correction model are respectively proportional to the row coordinates of the pixel and the light intensity of the pixel.
[0063] Given a first image acquired by the image sensor module, the difference L between the mean grayscale values of the last two rows of pixels in the first image is calculated, and the light intensity coefficient k2 of the last two rows of pixels in the first image is set to 1.
[0064] At the same time, based on the light leakage principle and law, and under the current exposure conditions, the correction value of the grayscale value of the odd-numbered row pixels in the pixel correction model is proportional to the row coordinate of the pixel.
[0065] In summary, the correction coefficient of the pixel correction model is set Here, Row represents the row coordinate of the current pixel, and α is used to represent the pixel design factor of the CMOS image sensor. Indicates the correction value of the current pixel grayscale value. In this embodiment, Row=H-1; .
[0066] The following are some examples:
[0067] The average gray value of the pixels in the (H-1)th row (the last row) of the CMOS image sensor is A H-1 , the mean gray value of the pixels in the (H-2)th row is A H-2 , the difference between the mean gray values of the last two rows of pixels in the first image is L=A H-1 -A H-2 , light intensity coefficient k2=1, then the correction coefficient .
[0068] Preferably, for a CMOS image sensor with symmetrically designed odd and even rows of pixels, the larger the incident light angle, the greater the difference in light leakage between odd and even rows, so the light leakage difference (i.e., the grayscale value difference between odd and even rows of pixels) is proportional to the distance from the center of the pixel principle image sensor. .
[0069] In summary, the calculation formula for the correction coefficient of the CMOS image sensor with symmetrical design of odd and even rows of pixels is as follows:
[0070]
[0071] In the formula, the difference between the mean gray values of the last two rows of pixels in the first image is L=A H-1 -A H-2 , or replace it with L=A H-2 -A H-1 , L can be a positive number or a negative number, and the positive or negative value of L is reflected in the calculation result of k1; similarly, k1 can be a positive number or a negative number.
[0072] Through the above calculation process, the exposure condition of the image sensor module when capturing the first image and the correction coefficient of the corresponding pixel correction model can be determined.
[0073] The same image sensor module is selected to capture a second image, the maximum grayscale value of a pixel of the second image is obtained, and the light intensity coefficient of any pixel of the second image is determined.
[0074] The second image is an image of the object to be measured, or an image of other scenes. The second image and the first image are acquired by the same image sensor module. The same (same) image sensor module refers to the same CMOS image sensor, the same lens, and the aperture, focal length and other parameters used by the CMOS image sensor and the lens are consistent. At this time, the optical center of the image sensor module may not be directly opposite to the light source, and the position of the light source is adjusted according to the light requirements of the second image; or no light source is set.
[0075] Based on the acquired second image, the maximum grayscale values of pixels in the second image are counted to determine the light intensity coefficient of any pixel in the second image.
[0076] In this embodiment, a conventional method is adopted to count the maximum value of the grayscale of pixels in the second image, specifically as follows: the initial value of the maximum value of the grayscale of pixels in the second image is set to 0, and each pixel grayscale value is compared with the maximum value one by one. If the current pixel grayscale value is greater than the maximum value, the current grayscale value is assigned to the maximum value, and the maximum value can be obtained by traversing all pixels in this way. Preferably, the initial value may not be set to 0, and the grayscale value of the first pixel in the second image is used as the initial value.
[0077] In this embodiment, based on the definition of the light intensity coefficient, the ratio of the gray value of any pixel in the current image to the maximum gray value of the pixel in the current image is used as the light intensity coefficient of the pixel. , where M is the maximum grayscale value of the pixel in the second image, G(x,y) is the grayscale value of the pixel point (x,y) in the second image, where x represents the column number of the pixel point in the second image, and y represents the row number of the pixel point in the second image.
[0078] Based on the pixel correction model and the light intensity coefficient, the pixels of the second image are corrected one by one, and a third image is output.
[0079] In this embodiment, the pixel correction model is used to correct the grayscale values of pixels in odd rows. The correction values of the grayscale values of pixels in odd rows in the pixel correction model are respectively proportional to the row coordinates of the pixel and the light intensity of the pixel.
[0080] Using the light intensity coefficient and correction coefficient of the second image obtained by the above calculation, the correction values of the grayscale values of the odd-numbered rows of pixels in the second image are calculated one by one. , to correct the grayscale values of the odd-numbered rows of pixels of the second image, and output the corrected image (third image). The grayscale values of the even-numbered rows of pixels of the third image are the same as the grayscale values of the even-numbered rows of pixels of the second image.
[0081] The following are some examples:
[0082] Corrected values of grayscale values of pixels in odd-numbered rows in the second image ;
[0083] Preferably, for a CMOS image sensor with symmetrically designed odd-numbered and even-numbered rows of pixels, the correction value of the grayscale value of the odd-numbered rows of pixels in the second image is ;
[0084] Then the gray value GC(x,y) of the pixel in the corrected image (third image) is:
[0085]
[0086] The principle of the pixel correction model of this embodiment is:
[0087] According to the physical principle of light leakage, the light leakage of the storage node of the CMOS image sensor occurs when the charge storage is waiting to be read out. Due to the characteristics of row-by-row readout, the time each row of pixels waits to be read out is proportional to the row coordinate. Therefore, the charge accumulated by the light leakage is proportional to the row coordinate Row, that is, the gray value difference of adjacent row pixels of the CMOS image sensor is proportional to the row coordinate Row.
[0088] Under the action of the lens, different positions of the CMOS image sensor receive different angles of light. The angle of light received at the center of the CMOS image sensor is close to vertical to the sensor plane, while the angle of light received at the edge of the CMOS image sensor is at an angle to the sensor plane. For CMOS image sensors with symmetrical design of odd and even rows of pixels, the larger the angle of incident light, the greater the difference in light leakage between odd and even rows. Therefore, the light leakage inconsistency is proportional to the distance from the center of the pixel principle sensor, that is, the difference in grayscale values of pixels in adjacent rows of the CMOS image sensor is proportional to (Row-H / 2).
[0089] Taking into account the differences in exposure conditions caused by the focal length, aperture and other parameter designs involved in the image acquisition of the CMOS image sensor and the lens, and the influence of this factor on the grayscale values of adjacent rows of pixels of the CMOS image sensor, a correction coefficient k1 is added to the pixel correction model to represent this factor, thereby ensuring the accuracy of the correction result.
[0090] The charge of light leakage of CMOS image sensor is the result of charge integration for a certain period of time under the light intensity perceived by the pixel, so the light leakage is proportional to the light intensity. This application uses the light intensity coefficient k2 to represent the light intensity effect. In this application, the ratio of the gray value of any pixel in the current image to the maximum gray value of the pixel in the current image is used as the light intensity coefficient of any pixel. Then the gray value difference of adjacent row pixels of CMOS image sensor is proportional to k2.
[0091] In summary, this embodiment proposes a pixel correction model for correcting the grayscale values of pixels in odd rows.
[0092] The mathematical representation of the model is: , where ∆ is the grayscale value difference of pixels in adjacent rows of the CMOS image sensor; H is the height of the CMOS image sensor; Row is the row coordinate, ranging from 0 to (H-1); k1 is the correction coefficient; k2 is the light intensity coefficient. Example 2
[0093] This embodiment provides an image sensor module correction method.
[0094] like Figure 3 As shown, based on Example 1, this embodiment proposes another exemplary method for the calculation process of the correction coefficient in the pixel correction model, which is as follows:
[0095] In this embodiment, based on the first image, the correction coefficient of the pixel correction model is determined, specifically including: calculating the difference between the grayscale value mean of the pixels in the yth row and the grayscale value mean of the pixels in the (y+1)th row as the correction coefficient of the yth row; wherein y<(H-1).
[0096] In this embodiment, the grayscale value mean A(y) of each row of pixels of the first image is calculated in sequence, and the range of y is 0~(H-1); the difference A(y+1)-A(y) between the grayscale mean of the y-th row and the grayscale mean of the (y+1)-th row is calculated as the correction coefficient of the y-th row; wherein y<(H-1).
[0097] Select the same image sensor module to capture the second image, obtain the maximum grayscale value of the second image pixels, and determine the light intensity coefficient of any pixel in the second image. , where M is the maximum grayscale value of the pixel in the second image, G(x,y) is the grayscale value of the pixel point (x,y) in the second image, where x represents the column number of the pixel point in the second image, and y represents the row number of the pixel point in the second image.
[0098] Using the light intensity coefficient and correction coefficient of the second image obtained by the above calculation, the correction values of the grayscale values of the odd-numbered rows of pixels in the second image are calculated one by one. , to correct the grayscale values of the odd-numbered rows of pixels of the second image, and output the corrected image (third image). The grayscale values of the even-numbered rows of pixels of the third image are the same as the grayscale values of the even-numbered rows of pixels of the second image.
[0099] Preferably, for a CMOS image sensor with symmetrically designed odd- and even-row pixels, the correction value of the grayscale value of the odd-row pixels in the second image is \Delta G(x,y)=[A(y+1)-A(y)]\cdot \frac {G(x,y)} {M} ;
[0100] Then the gray value GC(x,y) of the pixel in the corrected image (third image) is:
[0101]
[0102] In this embodiment, the setting principle of the correction coefficient in the pixel correction model is: based on the light leakage principle, the lens effect and the current exposure conditions, the grayscale value difference of the odd and even rows of pixels is caused. Therefore, in this embodiment, the difference in the grayscale value of the odd and even rows of pixels under uniform light conditions in the first image is directly used to represent the relationship between the correction value and the light intensity and the row coordinate. In summary, in this embodiment, the grayscale value difference of the adjacent rows of pixels in the first image is used as the correction coefficient. Example 3
[0103] like Figure 4 As shown, this embodiment proposes an image sensor module correction device for implementing the method of the above embodiment.
[0104] The device includes:
[0105] The image sensor module is composed of a CMOS image sensor and a lens. The CMOS image sensor is a CMOS image sensor used for correction, and the lens images the object onto the CMOS image sensor.
[0106] The image processor is configured to determine the correction coefficient of the pixel correction model based on the first image; or to obtain the maximum grayscale value of the pixel of the second image based on the second image, and determine the light intensity coefficient of any pixel of the second image; and to correct the pixels of the second image one by one based on the pixel correction model and the light intensity coefficient, and output a third image. Preferably, the image processor can be an FPGA, an FPGA-SoC, an FPGA with an MCU, etc., to facilitate real-time statistics of image data and calculation of correction parameters. In this embodiment, a control unit is provided on the image processor, which can control the image processor to execute the correction method described in embodiment 1 or 2.
[0107] The correction value of the grayscale value of any pixel in the pixel correction model is proportional to the row coordinate of the pixel and the light intensity of the pixel.
[0108] In the third image, the grayscale values of the pixels in the odd-numbered rows are calculated by the pixel correction model, and the grayscale values of the pixels in the even-numbered rows are the same as the grayscale values of the pixels in the even-numbered rows of the second image.
[0109] Alternatively, in the third image, the grayscale values of the pixels in the even-numbered rows are calculated by the pixel correction model, and the grayscale values of the pixels in the odd-numbered rows are the same as the grayscale values of the pixels in the odd-numbered rows of the second image.
[0110] The memory is used to store the correction coefficient. Preferably, the memory is a non-volatile memory device, such as SPI Flash.
[0111] In this embodiment, the correction device further includes a light source for providing a spatially uniform illumination characteristic. Preferably, the light source is a flat surface light source.
[0112] The implementation method of the correction device in Example 3 is:
[0113] Adjust the positional relationship between the light source and the lens so that the optical center of the image sensor module faces the light source.
[0114] A specific point in the optical center of the image sensor module. The light passing through this point is not deflected when passing through the image sensor module, that is, this point is the center of the light beam. The optical center of the image sensor module refers to both the center point of the photosensitive surface of the CMOS image sensor and the center point of the lens, that is, the center of the imaging plane. Ideally, the light passing through the optical center will be perpendicular to the imaging plane.
[0115] The optical center of the image sensor module faces the light source so that the light projected by the light source is evenly distributed on the photosensitive surface of the CMOS image sensor after passing through the lens, avoiding the adverse effect of uneven light itself on the correction. If it is not facing, the light reaching the photosensitive surface of the CMOS image sensor may be uneven, and the light of the first image obtained at this time is uneven, resulting in incorrect correction results.
[0116] The CMOS image sensor collects N first image data, and uses an image processor to perform an average operation on the N images to reduce the noise impact of the thermal noise of the light source on the image, and obtains the first image. Wherein, N≥1, N is a positive integer.
[0117] An image processor is used to execute the calculation method of determining the correction coefficient of the pixel correction model based on the first image described in Embodiment 1 or Embodiment 2. A memory is used to store the correction coefficient.
[0118] The CMOS image sensor collects N second image data. According to the collection requirements, the light source position and whether the light source is needed are determined. At the same time, the object to be measured is placed to obtain the second image containing the object to be measured.
[0119] Use an image processor to execute the method described in Example 1 or Example 2 based on the second image, obtain the maximum pixel grayscale value of the second image, and determine the light intensity coefficient of any pixel of the second image; and based on the pixel correction model and the light intensity coefficient, correct the pixels of the second image one by one, and output a third image. Example 4
[0120] like Figure 5 As shown, this embodiment proposes an image sensor module correction device for implementing the correction method of the above embodiment.
[0121] Compared with Example 3, the correction device of this embodiment further includes:
[0122] The host computer is used to issue instructions to control the CMOS image sensor to capture images and / or control the image processor to perform correction.
[0123] A communication interface is used to connect the image processor to communicate with the host computer to obtain the corrected image (third image). Preferably, the communication interface is an Ethernet interface.
[0124] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method described above is implemented.
[0125] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0126] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for correcting an image sensor module, wherein the image sensor module is composed of a CMOS image sensor and a lens, characterized in that: include: Acquire a first image in which the optical center of the module faces the light source, the number of rows of the CMOS image sensor is H, and the height of the first image is H rows; Based on the first image, determining correction coefficients of a pixel correction model; Selecting the same module to capture a second image, obtaining a maximum grayscale value of a pixel of the second image, and determining a light intensity coefficient of any pixel of the second image; Based on the pixel correction model and the light intensity coefficient, correct the pixels of the second image one by one, and output a third image; The correction value of the grayscale value of any pixel in the second image is proportional to the row coordinate of the pixel, the light intensity coefficient of the pixel, the correction coefficient and the pixel design factor of the CMOS image sensor.
2. The image sensor module correction method according to claim 1, characterized in that: The light intensity coefficient includes: taking the ratio of the gray value of any pixel in the current image to the maximum gray value of the pixel in the current image as the light intensity coefficient of the pixel in the current image.
3. The image sensor module correction method according to claim 2, characterized in that: Also includes: In the third image, the grayscale values of the pixels in the odd-numbered rows are calculated by the pixel correction model, and the grayscale values of the pixels in the even-numbered rows are the same as the grayscale values of the pixels in the even-numbered rows of the second image.
4. The image sensor module correction method according to claim 2, characterized in that: Also includes: In the third image, the grayscale values of the pixels in the even-numbered rows are calculated by the pixel correction model, and the grayscale values of the pixels in the odd-numbered rows are the same as the grayscale values of the pixels in the odd-numbered rows of the second image.
5. The image sensor module correction method according to claim 2, characterized in that: Based on the first image, a correction coefficient of a pixel correction model is determined, including: calculating a difference between a mean grayscale value of pixels in the (H-1)th row and a mean grayscale value of pixels in the (H-2)th row of the first image as a correction value for the grayscale value of pixels in the (H-1)th row, setting a light intensity coefficient of the (H-1)th row, and obtaining a correction coefficient based on the pixel correction model.
6. The image sensor module correction method according to claim 2, characterized in that: Based on the first image, determining the correction coefficient of the pixel correction model includes: calculating the difference between the grayscale value mean of the pixels in the y-th row and the grayscale value mean of the pixels in the (y+1)-th row as the correction coefficient of the y-th row; wherein y<(H-1); wherein the correction value of the grayscale value of any pixel in the second image is proportional to the light intensity coefficient and the correction coefficient of the pixel, respectively.
7. An image sensor module correction device, characterized in that: include: Image sensor module, consisting of a CMOS image sensor and a lens; The image processor is configured to determine a correction coefficient of a pixel correction model based on the first image; or to obtain a maximum grayscale value of a pixel of the second image based on the second image, and determine a light intensity coefficient of any pixel of the second image; and to correct pixels of the second image one by one based on the pixel correction model and the light intensity coefficient, and output a third image; A memory for storing correction coefficients; The correction value of the grayscale value of any pixel in the second image is proportional to the row coordinate of the pixel, the light intensity coefficient of the pixel, the correction coefficient and the pixel design factor of the CMOS image sensor.
8. The image sensor module correction device according to claim 7, characterized in that: Also includes: The host computer is used to issue instructions to control the CMOS image sensor to capture images and / or control the image processor to perform correction.
9. The image sensor module correction device according to claim 7, characterized in that: Also includes: A light source is used to provide spatially uniform illumination characteristics.
10. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed by a processor, an image sensor module correction method as described in any one of claims 1 to 6 is implemented.
