Microscope, image correction method, and electronic device
By dividing the microscope image into grids and processing its brightness values, and using gain coefficients for image correction, the problem of uneven brightness caused by vignetting in the microscope image was solved, thus improving image quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2024-12-20
- Publication Date
- 2026-06-23
AI Technical Summary
Dark corners often appear in images acquired by microscopes, resulting in uneven image brightness, which requires effective correction methods.
The processor divides the image into grids, determines the image region within the center of the vignetting and its neighborhood, calculates the reference brightness value and the brightness value to be used, and performs image correction using gain coefficients, including fusion processing and interpolation processing, to determine the center of the vignetting to correct the problem of uneven image brightness.
It effectively corrects vignetting in microscope images, improving the uniformity of image brightness and overall quality.
Smart Images

Figure CN122269149A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a microscope, an image correction method, and an electronic device. Background Technology
[0002] Due to manufacturing errors in microscope lenses, the compatibility between the lens and the target surface, and the influence of factors such as the light source in the microscope's environment, images acquired by microscopes often exhibit a phenomenon where the center is bright and the edges are dark; this phenomenon is known as vignetting. To ensure uniform brightness throughout the image, it is necessary to correct the vignetting. Therefore, how to effectively correct vignetting in microscope-acquired images is a problem that urgently needs to be solved. Summary of the Invention
[0003] The purpose of this application is to provide a microscope, an image correction method, and an electronic device to effectively correct vignetting in images acquired by the microscope. The specific technical solution is as follows:
[0004] A first aspect of this application provides a microscope, comprising:
[0005] A lens is used to acquire multiple images of the object to be observed, all of which are of the same size.
[0006] The processor is used to obtain the brightness value to be corrected at each pixel position in each image to be corrected captured by the lens.
[0007] The processor is further configured to, for each preset length, determine, from each image region obtained by dividing the image to be corrected according to a grid, an image region within the neighborhood of the position traversed by a circle with the center of the vignetting corner of the image to be corrected as the center and the preset length as the radius, and obtain an image region corresponding to the preset length; wherein, there is no intersection between image regions corresponding to different preset lengths, and each image region corresponding to a preset length contains all image regions in the image to be corrected.
[0008] The processor is further configured to calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length;
[0009] The processor is further configured to calculate, for each image region in the image to be corrected, the average level of the brightness value to be corrected at the effective pixel position in the image region, and obtain the brightness value to be utilized in the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference.
[0010] The processor is further configured to perform fusion and interpolation processing based on the brightness values of the image regions in each image to be corrected, to obtain a first gain coefficient at each pixel position in each image to be corrected; wherein the first gain coefficient at the same pixel position in each image to be corrected is the same.
[0011] The processor is further configured to, for each image to be corrected, use a first gain coefficient at each pixel location in the image to be corrected to increase the brightness value at that pixel location, thereby obtaining a corrected image.
[0012] Optionally, the processor is specifically used to calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, so as to obtain the initial brightness value of the image region corresponding to the preset length;
[0013] Determine whether the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction; wherein, the specified monotonic direction represents the trend of change from the initial brightness value of the image region corresponding to the smallest preset length to the initial brightness value of the image region corresponding to the largest preset length.
[0014] If the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction, then the initial brightness value of the image region corresponding to the preset length is determined as the reference brightness value of the image region corresponding to the preset length.
[0015] If the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction, then the initial brightness value of the image region corresponding to other preset lengths within the neighborhood of the preset length that conforms to the specified monotonic direction is determined, and interpolation is performed based on the determined initial brightness value to obtain the reference brightness value of the image region corresponding to the preset length.
[0016] Optionally, the processor is specifically configured to determine, from each preset length, a plurality of preset lengths adjacent to the preset length, as adjacent preset lengths;
[0017] From multiple adjacent preset lengths, the trend of change between the initial brightness value of the corresponding image region and the initial brightness value of the image region corresponding to the preset length is selected, and does not conform to the adjacent preset length with the specified monotonic direction.
[0018] If the proportion of the selected adjacent preset length in the plurality of adjacent preset lengths is greater than a preset ratio, then it is determined that the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction.
[0019] If the proportion of the selected adjacent preset length among the plurality of adjacent preset lengths is not greater than the preset ratio, then the initial brightness value of the image region corresponding to the preset length is determined to conform to the specified monotonic direction.
[0020] Optionally, the processor is specifically configured to determine, from the image region corresponding to the preset length, an image region containing pixel positions whose brightness values to be corrected are greater than a first preset brightness and less than a second preset brightness, as the effective image region corresponding to the preset length;
[0021] Based on the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, the average level of the brightness values to be corrected at each pixel position in the image region corresponding to the preset length is calculated to obtain the initial brightness value of the image region corresponding to the preset length.
[0022] Optionally, the processor is specifically configured to determine, for each pixel position in the effective image region corresponding to the preset length, the brightness value interval to which the brightness value to be corrected at the pixel position belongs from multiple consecutive brightness value intervals, and use it as the brightness value interval corresponding to the pixel position.
[0023] Calculate the average level of the brightness values to be corrected at the pixel positions corresponding to the target brightness value range to obtain the initial brightness value of the image region corresponding to the preset length; wherein, the number of pixel positions corresponding to the target brightness value range is the largest.
[0024] Optionally, the processor is specifically configured to perform interpolation processing based on the usable brightness values of the image regions in each image to be corrected, and to perform fusion processing according to the confidence level of the image regions in each image to be corrected, to obtain a first gain coefficient at each pixel position in each image to be corrected; wherein, the confidence level of the image region containing effective pixel positions in each image to be corrected is greater than the confidence level of the image region not containing effective pixel positions.
[0025] Optionally, in each image to be corrected, the brightness value to be corrected at any valid pixel location is greater than a first preset brightness and less than a second preset brightness.
[0026] Optionally, the processor is specifically used to fuse the brightness values of multiple image regions with the same corresponding pixel positions in each image to be corrected according to the confidence level of the multiple image regions, so as to obtain the fused brightness value corresponding to the multiple image regions.
[0027] Interpolation is performed on the obtained fused brightness values to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0028] Optionally, the processor is specifically configured to interpolate the obtained fused brightness values according to the size of each image to be corrected, to obtain an estimated brightness value at each pixel position in each image to be corrected; for each pixel position, the ratio of the maximum value among the obtained estimated brightness values to the estimated brightness value at that pixel position is calculated as the first gain coefficient at that pixel position in each image to be corrected.
[0029] or,
[0030] For each fused brightness value, the ratio of the maximum value among the calculated fused brightness values to the fused brightness value is used as the region gain coefficient of multiple image regions with the same pixel position corresponding to the fused brightness value; the obtained region gain coefficients are interpolated according to the size of each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0031] Optionally, the processor is specifically configured to, for multiple image regions with corresponding pixel positions in each image to be corrected, fuse the brightness values of the multiple image regions according to the confidence level of the multiple image regions using a preset formula, to obtain the fused brightness value corresponding to the multiple image regions; wherein, the preset formula is as follows:
[0032]
[0033] This represents the fused brightness value corresponding to the multiple image regions. Indicates the number of images to be corrected. This indicates that the multiple image regions belong to the first... Confidence of the image region of the image to be corrected This indicates that the multiple image regions belong to the first... The brightness values to be utilized for the image region of the image to be corrected.
[0034] Optionally, the processor is further configured to acquire a calibration image of a preset calibration board acquired by the lens before acquiring the brightness value to be corrected at each pixel position in each image to be corrected acquired by the lens; wherein the calibration image has the same size as any image to be corrected.
[0035] Based on the brightness value at each pixel position in the calibration image, the gain coefficient at each pixel position in the calibration image is calculated and used as the second gain coefficient at the corresponding pixel position in each image to be corrected.
[0036] The processor is specifically used to, for each image to be corrected captured by the lens, use a second gain coefficient at each pixel position in the image to be corrected to increase the original brightness value at that pixel position, so as to obtain the brightness value to be corrected at that pixel position in the image to be corrected.
[0037] Optionally, the calibration image is an image of different parts of the preset calibration board;
[0038] The processor is specifically used to calculate the gain coefficient at each pixel position in the calibration image based on the brightness value at each pixel position in the calibration image for each calibration image.
[0039] The gain coefficients at the same pixel location in each calibration image are fused to obtain the second gain coefficient at the corresponding pixel location in each image to be corrected.
[0040] Optionally, the processor is further configured to, for each image to be corrected, determine from each gain coefficient interval the gain coefficient of the second gain coefficient at each pixel position in the image to be corrected belongs to, and use it as the gain coefficient interval corresponding to the pixel position.
[0041] For each gain coefficient interval, ellipse fitting is performed based on the pixel position corresponding to that gain coefficient interval to obtain the ellipse to be utilized.
[0042] Based on the center of the ellipse to be used that meets the preset conditions, the vignetting center of the image to be corrected is determined; wherein the difference between the lengths of the major and minor axes of the ellipse to be used that meets the preset conditions is less than a preset difference.
[0043] Optionally, the processor is specifically used to vote based on the centers of the ellipses to be used that meet the preset conditions, and to obtain the center of the ellipse to be used with the most votes, which is used as the vignetting center of the image to be corrected.
[0044] Optionally, each image to be corrected is an image of a different part of the object to be observed;
[0045] The processor is further configured to, after amplifying the brightness value to be corrected at each pixel position using a first gain coefficient in each image to be corrected to obtain a corrected image, stitch the corrected images together according to the local positions corresponding to each corrected image to obtain a complete image of the object to be observed.
[0046] A second aspect of this application provides an image correction method, the method comprising:
[0047] For each image of the object to be observed acquired using a microscope, the brightness value to be corrected at each pixel position in the image to be corrected is obtained; wherein, the acquired images to be corrected are of the same size.
[0048] For each preset length, from each image region obtained by dividing the image to be corrected according to the grid, the image region within the neighborhood range of the position traversed by the circle with the center of the dark corner of the image to be corrected as the center and the preset length as the radius is determined, and the image region corresponding to the preset length is obtained; wherein, there is no intersection between the image regions corresponding to different preset lengths, and the image region corresponding to each preset length contains all the image regions of the image to be corrected.
[0049] Calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length;
[0050] For each image region in the image to be corrected, the average level of the brightness value to be corrected at the effective pixel position in the image region is calculated to obtain the brightness value to be utilized in the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference.
[0051] Based on the brightness values of the image regions to be used in each image to be corrected, fusion and interpolation processes are performed to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein, the first gain coefficient at the same pixel position in each image to be corrected is the same.
[0052] For each image to be corrected, the brightness value to be corrected at each pixel position is increased using the first gain coefficient at that pixel position to obtain the corrected image.
[0053] Optionally, calculating the average level of the brightness values to be corrected at pixel positions in the image region corresponding to the preset length, to obtain the reference brightness value of the image region corresponding to the preset length, includes:
[0054] Calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the initial brightness value of the image region corresponding to the preset length;
[0055] Determine whether the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction; wherein, the specified monotonic direction represents the trend of change from the initial brightness value of the image region corresponding to the smallest preset length to the initial brightness value of the image region corresponding to the largest preset length.
[0056] If the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction, then the initial brightness value of the image region corresponding to the preset length is determined as the reference brightness value of the image region corresponding to the preset length.
[0057] If the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction, then the initial brightness value of the image region corresponding to other preset lengths within the neighborhood of the preset length that conforms to the specified monotonic direction is determined, and interpolation is performed based on the determined initial brightness value to obtain the reference brightness value of the image region corresponding to the preset length.
[0058] Optionally, determining whether the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction includes:
[0059] From each preset length, determine a plurality of preset lengths that are adjacent to the preset length, and use them as adjacent preset lengths;
[0060] From multiple adjacent preset lengths, the trend of change between the initial brightness value of the corresponding image region and the initial brightness value of the image region corresponding to the preset length is selected, and does not conform to the adjacent preset length with the specified monotonic direction.
[0061] If the proportion of the selected adjacent preset length in the plurality of adjacent preset lengths is greater than a preset ratio, then it is determined that the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction.
[0062] If the proportion of the selected adjacent preset length among the plurality of adjacent preset lengths is not greater than the preset ratio, then the initial brightness value of the image region corresponding to the preset length is determined to conform to the specified monotonic direction.
[0063] Optionally, calculating the average level of the brightness values to be corrected at pixel positions in the image region corresponding to the preset length, to obtain the initial brightness value of the image region corresponding to the preset length, includes:
[0064] From the image region corresponding to the preset length, determine the image region containing the pixel positions whose brightness value to be corrected is greater than the first preset brightness and less than the second preset brightness, and use it as the effective image region corresponding to the preset length;
[0065] Based on the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, the average level of the brightness values to be corrected at each pixel position in the image region corresponding to the preset length is calculated to obtain the initial brightness value of the image region corresponding to the preset length.
[0066] Optionally, the step of calculating the average level of the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, based on the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, to obtain the initial brightness value of the image region corresponding to the preset length, includes:
[0067] For each pixel position in the effective image area corresponding to the preset length, the brightness value interval to which the brightness value to be corrected at the pixel position belongs is determined from multiple consecutive brightness value intervals, and is used as the brightness value interval corresponding to the pixel position.
[0068] Calculate the average level of the brightness values to be corrected at the pixel positions corresponding to the target brightness value range to obtain the initial brightness value of the image region corresponding to the preset length; wherein, the number of pixel positions corresponding to the target brightness value range is the largest.
[0069] Optionally, the step of performing fusion and interpolation processing based on the brightness values of the image regions in each image to be corrected to obtain the first gain coefficient at each pixel location in each image to be corrected includes:
[0070] Based on the usable brightness values of the image regions in each image to be corrected, interpolation processing and fusion processing according to the confidence of the image regions in each image to be corrected are performed to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein, the confidence of the image region containing effective pixel positions in each image to be corrected is greater than the confidence of the image region not containing effective pixel positions.
[0071] Optionally, in each image to be corrected, the brightness value to be corrected at any valid pixel location is greater than a first preset brightness and less than a second preset brightness.
[0072] Optionally, the step of performing interpolation processing based on the usable brightness values of image regions in each image to be corrected and performing fusion processing according to the confidence level of image regions in each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected includes:
[0073] For multiple image regions with the same corresponding pixel position in each image to be corrected, the brightness values of the multiple image regions to be used are fused according to the confidence of the multiple image regions to obtain the fused brightness value corresponding to the multiple image regions.
[0074] Interpolation is performed on the obtained fused brightness values to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0075] Optionally, the interpolation process based on the obtained fused brightness values to obtain the first gain coefficient at each pixel location in each image to be corrected includes:
[0076] Interpolate the obtained fused brightness values according to the size of each image to be corrected to obtain the estimated brightness value at each pixel position in each image to be corrected; for each pixel position, calculate the ratio of the maximum value among the obtained estimated brightness values to the estimated brightness value at that pixel position, and use it as the first gain coefficient at that pixel position in each image to be corrected.
[0077] or,
[0078] For each fused brightness value, the ratio of the maximum value among the calculated fused brightness values to the fused brightness value is used as the region gain coefficient of multiple image regions with the same pixel position corresponding to the fused brightness value; the obtained region gain coefficients are interpolated according to the size of each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0079] Optionally, the step of fusing the brightness values of multiple image regions with corresponding pixel positions in each image to be corrected according to the confidence level of the multiple image regions to obtain the fused brightness value corresponding to the multiple image regions includes:
[0080] For multiple image regions with corresponding pixel positions in each image to be corrected, the brightness values of these multiple image regions are fused according to their confidence levels using a preset formula to obtain the fused brightness values corresponding to these multiple image regions; wherein the preset formula is as follows:
[0081]
[0082] This represents the fused brightness value corresponding to the multiple image regions. Indicates the number of images to be corrected. This indicates that the multiple image regions belong to the first... Confidence of the image region of the image to be corrected This indicates that the multiple image regions belong to the first... The brightness values to be utilized for the image region of the image to be corrected.
[0083] Optionally, before acquiring the brightness value to be corrected at each pixel location in each image to be corrected for the object to be observed acquired using a microscope, the method further includes:
[0084] Acquire a calibration image of a preset calibration plate obtained using the microscope; wherein the calibration image has the same size as any image to be calibrated;
[0085] Based on the brightness value at each pixel position in the calibration image, the gain coefficient at each pixel position in the calibration image is calculated and used as the second gain coefficient at the corresponding pixel position in each image to be corrected.
[0086] The step of obtaining the brightness value to be corrected at each pixel position in each image of the object to be observed acquired using a microscope includes:
[0087] For each image of the object to be observed acquired using a microscope, the original brightness value at each pixel location in the image to be corrected is increased using the second gain coefficient at that pixel location to obtain the brightness value to be corrected at that pixel location in the image to be corrected.
[0088] Optionally, the calibration image is an image of different parts of the preset calibration board;
[0089] The step of calculating the gain coefficient at each pixel location in the calibration image based on the brightness value at each pixel location in the calibration image, and using these coefficients as the second gain coefficients at the corresponding pixel locations in each image to be corrected, includes:
[0090] For each calibration image, the gain coefficient at each pixel location in the calibration image is calculated based on the brightness value at each pixel location in the calibration image.
[0091] The gain coefficients at the same pixel location in each calibration image are fused to obtain the second gain coefficient at the corresponding pixel location in each image to be corrected.
[0092] Optionally, the vignetting center of each image to be corrected is determined by the following steps:
[0093] For each image to be corrected, the gain coefficient interval to which the second gain coefficient at each pixel position in the image to be corrected belongs is determined from each gain coefficient interval, and is used as the gain coefficient interval corresponding to that pixel position.
[0094] For each gain coefficient interval, ellipse fitting is performed based on the pixel position corresponding to that gain coefficient interval to obtain the ellipse to be utilized.
[0095] Based on the center of the ellipse to be used that meets the preset conditions, the vignetting center of the image to be corrected is determined; wherein the difference between the lengths of the major and minor axes of the ellipse to be used that meets the preset conditions is less than a preset difference.
[0096] Optionally, determining the vignetting center of the image to be corrected based on the center of the obtained ellipse that meets preset conditions includes:
[0097] Based on the centers of the ellipses that meet the preset conditions, a vote is taken to obtain the center of the ellipse with the most votes, which is then used as the vignetting center of the image to be corrected.
[0098] Optionally, each image to be corrected is an image of a different part of the object to be observed;
[0099] After obtaining a corrected image by amplifying the brightness value at each pixel location using a first gain coefficient for each image to be corrected, the method further includes:
[0100] The corrected images are stitched together according to their corresponding local positions to obtain a complete image of the object to be observed.
[0101] A third aspect of this application also provides an image correction apparatus, the apparatus comprising:
[0102] The brightness value acquisition module is used to acquire the brightness value to be corrected at each pixel position in each image of the object to be observed acquired using a microscope; wherein the acquired images to be corrected are of the same size.
[0103] The image region determination module is used to determine, for each preset length, the image region within the neighborhood of the position traversed by the circle with the center of the dark corner of the image to be corrected as the center and the preset length as the radius from each image region obtained by dividing the image to be corrected according to the grid. The image region corresponding to the preset length is obtained. There is no intersection between the image regions corresponding to different preset lengths, and each image region corresponding to the preset length contains all the image regions in the image to be corrected.
[0104] The reference brightness value calculation module is used to calculate the average level of the brightness value to be corrected at the pixel position in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length.
[0105] The brightness value calculation module is used to calculate the average level of the brightness value to be corrected at the effective pixel position in each image region of the image to be corrected, and obtain the brightness value to be used in the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference.
[0106] The first gain coefficient calculation module is used to perform fusion and interpolation processing based on the brightness values to be utilized in the image regions of each image to be corrected, so as to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein, the first gain coefficient at the same pixel position in each image to be corrected is the same.
[0107] The image correction module is used to increase the brightness value at each pixel location in each image to be corrected by using a first gain coefficient at each pixel location in the image to obtain a corrected image.
[0108] Optionally, the reference brightness value calculation module includes:
[0109] The initial brightness value calculation submodule is used to calculate the average level of the brightness value to be corrected at the pixel position in the image region corresponding to the preset length, and obtain the initial brightness value of the image region corresponding to the preset length.
[0110] The monotonic direction determination submodule is used to determine whether the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction; wherein, the specified monotonic direction represents the trend of change between the initial brightness value of the image region corresponding to the smallest preset length and the initial brightness value of the image region corresponding to the largest preset length.
[0111] The first determining submodule is used to determine the initial brightness value of the image region corresponding to the preset length as the reference brightness value of the image region corresponding to the preset length if the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction.
[0112] The second determining submodule is used to determine the initial brightness values of other image regions corresponding to the preset length within the neighborhood of the preset length that conform to the specified monotonic direction if the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction, and to perform interpolation based on the determined initial brightness value to obtain the reference brightness value of the image region corresponding to the preset length.
[0113] Optionally, the monotonic direction determination submodule is specifically used to determine multiple preset lengths adjacent to the preset length from each preset length, as adjacent preset lengths; from the multiple adjacent preset lengths, select adjacent preset lengths whose trend of change between the initial brightness value of the corresponding image region and the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction; if the proportion of the selected adjacent preset length in the multiple adjacent preset lengths is greater than a preset ratio, then it is determined that the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction; if the proportion of the selected adjacent preset length in the multiple adjacent preset lengths is not greater than the preset ratio, then it is determined that the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction.
[0114] Optionally, the initial brightness value calculation submodule includes:
[0115] The effective image region determination unit is used to determine, from the image region corresponding to the preset length, an image region containing the pixel positions whose brightness value to be corrected is greater than the first preset brightness and less than the second preset brightness, as the effective image region corresponding to the preset length;
[0116] The initial brightness value determination unit is used to calculate the average level of the brightness values to be corrected at the pixel positions in the effective image region corresponding to the preset length based on the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, and obtain the initial brightness value of the image region corresponding to the preset length.
[0117] Optionally, the initial brightness value determination unit is specifically used to determine, for each pixel position in the effective image region corresponding to the preset length, the brightness value interval to which the brightness value to be corrected at the pixel position belongs from multiple consecutive brightness value intervals, as the brightness value interval corresponding to the pixel position; calculate the average level of the brightness value to be corrected at the pixel position corresponding to the target brightness value interval, and obtain the initial brightness value of the image region corresponding to the preset length; wherein, the number of pixel positions corresponding to the target brightness value interval is the largest.
[0118] Optionally, the first gain coefficient calculation module includes:
[0119] The gain coefficient calculation submodule is used to perform interpolation processing based on the usable brightness values of the image regions in each image to be corrected, and to perform fusion processing according to the confidence of the image regions in each image to be corrected, to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein, the confidence of the image region containing effective pixel positions in each image to be corrected is greater than the confidence of the image region not containing effective pixel positions.
[0120] Optionally, in each image to be corrected, the brightness value to be corrected at any valid pixel location is greater than a first preset brightness and less than a second preset brightness.
[0121] Optionally, the gain coefficient calculation submodule includes:
[0122] The brightness value fusion unit is used to fuse the brightness values of multiple image regions with the same corresponding pixel positions in each image to be corrected according to the confidence level of the multiple image regions, so as to obtain the fused brightness value corresponding to the multiple image regions.
[0123] The gain coefficient calculation unit is used to perform interpolation processing based on the obtained fused brightness values to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0124] Optionally, the gain coefficient calculation unit is specifically used to interpolate the obtained fused brightness values according to the size of each image to be corrected, to obtain an estimated brightness value at each pixel position in each image to be corrected; for each pixel position, the ratio of the maximum value among the estimated brightness values to the estimated brightness value at that pixel position is used as the first gain coefficient at that pixel position in each image to be corrected; or, for each fused brightness value, the ratio of the maximum value among the fused brightness values to the fused brightness value is used as the region gain coefficient of multiple image regions with the same pixel position as the fused brightness value; and to interpolate the obtained region gain coefficients according to the size of each image to be corrected, to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0125] Optionally, the brightness value fusion unit is specifically used to fuse the brightness values of multiple image regions with corresponding pixel positions in each image to be corrected, according to a preset formula and based on the confidence level of the multiple image regions, to obtain the fused brightness value corresponding to the multiple image regions; wherein, the preset formula is as follows:
[0126]
[0127] This represents the fused brightness value corresponding to the multiple image regions. Indicates the number of images to be corrected. This indicates that the multiple image regions belong to the first... Confidence of the image region of the image to be corrected This indicates that the multiple image regions belong to the first... The brightness values to be utilized for the image region of the image to be corrected.
[0128] Optionally, the device further includes:
[0129] The calibration image acquisition module is used to acquire a calibration image of a preset calibration plate acquired by the microscope before acquiring the brightness value to be corrected at each pixel position in each image to be corrected for each image to be corrected of the object to be observed acquired by the microscope; wherein the calibration image has the same size as any image to be corrected.
[0130] The second gain coefficient calculation module is used to calculate the gain coefficient at each pixel position in the calibration image based on the brightness value at each pixel position in the calibration image, and use them as the second gain coefficient at the corresponding pixel position in each image to be corrected.
[0131] The brightness value acquisition module is specifically used to, for each image of the object to be observed acquired by a microscope, use the second gain coefficient at each pixel position in the image to be corrected to increase the original brightness value at that pixel position, thereby obtaining the brightness value to be corrected at that pixel position in the image to be corrected.
[0132] Optionally, the calibration image is an image of different parts of the preset calibration board;
[0133] The second gain coefficient calculation module is specifically used to calculate the gain coefficient of each pixel position in each calibration image based on the brightness value of each pixel position in the calibration image; and to fuse the gain coefficients of the same pixel position in each calibration image to obtain the second gain coefficient of the corresponding pixel position in each image to be corrected.
[0134] Optionally, the device further includes:
[0135] The vignetting center determination module is used to determine, for each image to be corrected, the gain coefficient interval to which the second gain coefficient at each pixel position in the image to be corrected belongs from each gain coefficient interval, as the gain coefficient interval corresponding to that pixel position; for each gain coefficient interval, ellipse fitting is performed based on the pixel position corresponding to the gain coefficient interval to obtain an ellipse to be used; based on the center of the obtained ellipse to be used that meets the preset conditions, the vignetting center of the image to be corrected is determined; wherein, the difference between the lengths of the major axis and the minor axis of the ellipse to be used that meets the preset conditions is less than a preset difference.
[0136] Optionally, the vignetting center determination module is specifically used to vote based on the centers of the ellipses to be used that meet the preset conditions, and to obtain the center of the ellipse to be used with the most votes, which is then used as the vignetting center of the image to be corrected.
[0137] Optionally, each image to be corrected is an image of a different part of the object to be observed;
[0138] The device further includes:
[0139] The image stitching module is used to stitch together the corrected images according to the local positions corresponding to each corrected image after amplifying the brightness value of the pixel position at each pixel position in the corrected image to obtain a corrected image.
[0140] A fourth aspect of the embodiments of this application also provides an electronic device, including:
[0141] Memory, used to store computer programs;
[0142] The processor, when executing a program stored in memory, implements any of the image correction methods described above.
[0143] A fifth aspect of the embodiments of this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the image correction methods described above.
[0144] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the image correction methods described above.
[0145] Beneficial effects of the embodiments in this application:
[0146] This application provides a microscope comprising: a lens for acquiring multiple images of an object to be calibrated; wherein the acquired images to be calibrated are of the same size; a processor for acquiring a brightness value to be calibrated at each pixel position in each image to be calibrated acquired by the lens; the processor is further configured to, for each preset length, determine an image region within the neighborhood of a circle centered at the center of the dark corner of the image to be calibrated and with the preset length as the radius, from each image region obtained by dividing the image to be calibrated according to a grid, thereby obtaining an image region corresponding to the preset length; wherein there is no overlap between image regions corresponding to different preset lengths, and each image region corresponding to a preset length contains all image regions in the image to be calibrated; the processor is further configured to calculate the average level of the brightness value to be calibrated at the pixel position in the image region corresponding to the preset length, thereby obtaining... The processor is further configured to: calculate the average level of the brightness values to be corrected at the effective pixel positions in each image region of the image to be corrected, thereby obtaining the brightness value to be utilized in the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference; the processor is further configured to: perform fusion processing and interpolation processing based on the brightness values to be utilized in each image region of the image to be corrected, thereby obtaining a first gain coefficient at each pixel position in each image to be corrected; wherein, the first gain coefficient at the same pixel position in each image to be corrected is the same; the processor is further configured to: for each image to be corrected, use the first gain coefficient at each pixel position in the image to be corrected to increase the brightness value to be corrected at that pixel position, thereby obtaining a corrected image.
[0147] Based on the microscope provided in this application embodiment, since each image of the object to be calibrated acquired by the microscope lens often exhibits a bright center and dark edges, and the brightness value distribution in the image to be calibrated often conforms to concentric circle constraints, that is, for each concentric circle with the center of the dark corner of the image to be calibrated as the center, the brightness values at the positions traversed by the concentric circle are relatively close. Therefore, the brightness values of the image region corresponding to each preset length in the image to be calibrated are often relatively close. Furthermore, for each preset length, the microscope's processor can calculate the average level of the brightness values to be calibrated at the pixel positions in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length. If the difference between the brightness value to be calibrated at a pixel position and the reference brightness value of its corresponding image region is less than a preset difference, it can be indicated that the brightness value to be calibrated at that pixel position conforms to the concentric circle constraints, which also indicates that the effectiveness of the brightness value to be calibrated at that pixel position is high, and this pixel position can be called an effective pixel position.
[0148] Correspondingly, for each image region in the image to be corrected, the processor calculates the average level of the brightness values to be corrected at the effective pixel positions in that image region. The resulting usable brightness values for that image region then conform to the concentric circle constraint, ensuring high effectiveness. Furthermore, by performing fusion and interpolation processing on the usable brightness values of the image regions in each image to be corrected, the effectiveness of the first gain coefficient at each pixel position in each image to be corrected is also high. Thus, based on the brightness values to be corrected at each pixel position in the image to be corrected, the first gain coefficient at each pixel position can be estimated, resulting in a highly effective first gain coefficient. Consequently, using the first gain coefficient, vignetting in the image to be corrected can be effectively corrected, resulting in a corrected image with uniform overall brightness. That is, vignetting in images acquired by a microscope can be effectively corrected.
[0149] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0150] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0151] Figure 1 This is a schematic diagram of a first process of the image correction method provided in the embodiments of this application;
[0152] Figure 2 This is a schematic diagram illustrating the division of multiple image regions in an image correction method provided in an embodiment of this application;
[0153] Figure 3 This is a second flowchart illustrating the image correction method provided in the embodiments of this application;
[0154] Figure 4 This is a schematic diagram of the first process for determining a reference brightness value in an image correction method provided in an embodiment of this application;
[0155] Figure 5 This is a schematic diagram of a second process for determining a reference brightness value in an image correction method provided in an embodiment of this application;
[0156] Figure 6 A schematic flowchart illustrating the calibration of gain coefficients in an image correction method provided in this application embodiment;
[0157] Figure 7This is a flowchart illustrating the process of determining the center of a vignetting in an image correction method provided in an embodiment of this application.
[0158] Figure 8 This is a schematic diagram illustrating the process of stitching images in the image correction method provided in the embodiments of this application;
[0159] Figure 9 This is a schematic flowchart illustrating the gain calculation process in the image correction method provided in this application embodiment;
[0160] Figure 10a A schematic diagram illustrating a complete image of an object obtained by correcting and stitching together different vignetting correction methods according to an embodiment of this application;
[0161] Figure 10b A schematic diagram illustrating a complete image of another object obtained by correcting and stitching together different vignetting correction methods according to an embodiment of this application;
[0162] Figure 11 This is a schematic diagram of the structure of an image correction device provided in an embodiment of this application;
[0163] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0164] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0165] Due to manufacturing errors in microscope lenses, the compatibility between the lens and the target surface, and the influence of factors such as the light source in the environment where the microscope is located, images acquired by a microscope often exhibit a phenomenon where the center is bright and the edges are dark; this phenomenon is known as vignetting. To ensure uniform brightness throughout the image, it is necessary to correct the vignetting.
[0166] In order to effectively correct vignetting in images acquired by a microscope, embodiments of this application provide a microscope, including:
[0167] A lens is used to acquire multiple images of the object to be observed, each image being of the same size.
[0168] The processor is used to obtain the brightness value to be corrected at each pixel position in each image to be corrected captured by the lens.
[0169] The processor is further configured to, for each preset length, determine, from each image region obtained by dividing the image to be corrected according to a grid, an image region within the neighborhood of the position traversed by a circle with the center of the vignetting corner of the image to be corrected as the center and the preset length as the radius, and obtain an image region corresponding to the preset length; wherein, there is no intersection between image regions corresponding to different preset lengths, and each image region corresponding to a preset length contains all image regions in the image to be corrected.
[0170] The processor is also used to calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and to obtain the reference brightness value of the image region corresponding to the preset length;
[0171] The processor is further configured to calculate, for each image region in the image to be corrected, the average level of the brightness value to be corrected at the effective pixel position in the image region, and obtain the brightness value to be utilized for the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference.
[0172] The processor is also used to perform fusion and interpolation processing based on the brightness values of the image regions in each image to be corrected, to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein the first gain coefficient at the same pixel position in each image to be corrected is the same.
[0173] The processor is also configured to, for each image to be corrected, use a first gain coefficient at each pixel location in the image to be corrected to increase the brightness value at that pixel location, thereby obtaining a corrected image.
[0174] Based on the microscope provided in this application embodiment, since each image of the object to be calibrated acquired by the microscope lens often exhibits a bright center and dark edges, and the brightness value distribution in the image to be calibrated often conforms to concentric circle constraints, that is, for each concentric circle with the center of the dark corner of the image to be calibrated as the center, the brightness values at the positions traversed by the concentric circle are relatively close. Therefore, the brightness values of the image region corresponding to each preset length in the image to be calibrated are often relatively close. Furthermore, for each preset length, the microscope's processor can calculate the average level of the brightness values to be calibrated at the pixel positions in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length. If the difference between the brightness value to be calibrated at a pixel position and the reference brightness value of its corresponding image region is less than a preset difference, it can be indicated that the brightness value to be calibrated at that pixel position conforms to the concentric circle constraints, which also indicates that the effectiveness of the brightness value to be calibrated at that pixel position is high, and this pixel position can be called an effective pixel position.
[0175] Correspondingly, for each image region in the image to be corrected, the processor calculates the average level of the brightness values to be corrected at the effective pixel positions in that image region. The resulting usable brightness values for that image region then conform to the concentric circle constraint, ensuring high effectiveness. Furthermore, by performing fusion and interpolation processing on the usable brightness values of the image regions in each image to be corrected, the effectiveness of the first gain coefficient at each pixel position in each image to be corrected is also high. Thus, based on the brightness values to be corrected at each pixel position in the image to be corrected, the first gain coefficient at each pixel position can be estimated, resulting in a highly effective first gain coefficient. Consequently, using the first gain coefficient, vignetting in the image to be corrected can be effectively corrected, resulting in a corrected image with uniform overall brightness. That is, vignetting in images acquired by a microscope can be effectively corrected.
[0176] Based on the same inventive concept, this application provides an image correction method, see [link to relevant documentation]. Figure 1 , Figure 1 This is a schematic diagram of a first flowchart of an image correction method provided in an embodiment of this application. The image correction method may include the following steps:
[0177] Step S101: For each image of the object to be observed acquired using a microscope, obtain the brightness value to be corrected at each pixel position in the image to be corrected.
[0178] The acquired images to be corrected are all the same size.
[0179] Step S102: For each preset length, from each image region obtained by dividing the image to be corrected according to the grid, determine the image region within the neighborhood of the position traversed by the circle with the center of the dark corner of the image to be corrected as the center and the preset length as the radius, and obtain the image region corresponding to the preset length.
[0180] There is no overlap between the image regions corresponding to different preset lengths, and each preset length image region contains all the image regions in the image to be corrected.
[0181] Step S103: Calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length.
[0182] Step S104: For each image region in the image to be corrected, calculate the average level of the brightness value to be corrected at the effective pixel position in the image region to obtain the brightness value to be utilized in the image region.
[0183] In each image to be corrected, the difference between the brightness value to be corrected at any valid pixel location and the reference brightness value of the image region to which the valid pixel location belongs is less than a preset difference.
[0184] Step S105: Perform fusion and interpolation processing based on the brightness values of the image regions to be used in each image to be corrected, and obtain the first gain coefficient at each pixel position in each image to be corrected.
[0185] In each image to be corrected, the first gain coefficient at the same pixel location is the same.
[0186] Step S106: For each image to be corrected, the brightness value to be corrected at each pixel position is increased using the first gain coefficient at each pixel position in the image to be corrected, so as to obtain the corrected image.
[0187] Based on the above processing, since each image of the object to be calibrated acquired using a microscope often exhibits a bright center and dark edges, and the brightness value distribution in this image often conforms to concentric circle constraints—that is, for each concentric circle centered on the center of the dark corner of the image, the brightness values at the locations traversed by the concentric circle are relatively close—the brightness values of the image regions corresponding to each preset length in the image to be calibrated are often quite close. Furthermore, for each preset length, the average level of the brightness values to be calibrated at the pixel positions in the image region corresponding to that preset length can be calculated to obtain the reference brightness value for the image region corresponding to that preset length. If the difference between the brightness value to be calibrated at a pixel position and the reference brightness value of its corresponding image region is less than a preset difference, it indicates that the brightness value to be calibrated at that pixel position conforms to the concentric circle constraints, meaning that the brightness value to be calibrated at that pixel position is highly effective, and this pixel position can be called an effective pixel position.
[0188] Correspondingly, for each image region in the image to be corrected, the average level of the brightness value to be corrected at the effective pixel positions in that image region is calculated. The resulting usable brightness value for that image region then conforms to the concentric circle constraint, ensuring high effectiveness of the usable brightness value. Furthermore, by performing fusion and interpolation processing on the usable brightness values of the image regions in each image to be corrected, the effectiveness of the first gain coefficient at each pixel position in each image to be corrected is also high. Thus, based on the brightness value to be corrected at each pixel position in the image to be corrected, the first gain coefficient at each pixel position can be estimated, resulting in a highly effective first gain coefficient. Consequently, using the first gain coefficient, vignetting in the image to be corrected can be effectively corrected, resulting in a corrected image with uniform overall brightness. That is, vignetting in images acquired by a microscope can be effectively corrected.
[0189] In step S101, a microscope can be used to acquire images of the object to be observed (i.e., the object to be observed), resulting in multiple images of the same size to be corrected. For example, images of different parts of the object to be observed can be acquired using a microscope, resulting in multiple images to be corrected. These multiple images to be corrected have overlapping areas, and all images to be corrected can completely cover the object to be observed. For instance, the image can be moved a preset step size along the length of the object to obtain an image of a row of local areas. After obtaining an image of a row of local areas, the image can be moved a preset step size along the width of the object, and then the image can be moved a preset step size along the length of the object to obtain a new row of local areas, until the images of each row of local areas can completely cover the object to be observed. The microscope can be a super depth-of-field microscope, and the object to be observed can be a circuit board, a lithium battery, an artifact, a small specimen, etc.
[0190] In one implementation, the images to be corrected can be images of different parts of the object to be observed. Subsequently, the corrected images obtained after vignetting correction of each image to be corrected can be stitched together to obtain a complete image of the object to be observed. The number of images to be corrected can be set as needed. For example, the number of images to be corrected can be the same as the number of local regions on the object to be observed, such as 25, 30, or 50.
[0191] Correspondingly, the brightness value to be corrected at each pixel location in each image to be corrected can be obtained. In one implementation, for each image to be corrected, the original brightness value at each pixel location in the image to be corrected can be obtained as the brightness value to be corrected at each pixel location in the image to be corrected. The original brightness value at each pixel location in an image to be corrected is the brightness value at that pixel location in the image acquired by the microscope. In another implementation, the gain coefficient at each pixel location can be pre-calibrated using a calibration plate, and the original brightness value at each pixel location in each image to be corrected can be amplified using the calibrated gain coefficient to obtain the brightness value to be corrected at each pixel location in the image to be corrected. For details, please refer to the relevant descriptions of steps S601-S602 in the following embodiments.
[0192] For example, the image to be corrected, acquired using a microscope, can be in Bayer_RGGB format. For each image to be corrected, a CFA (Color Filter Array) can be used to convert the Bayer_RGGB format image to RGB (Red, Green, Blue) format. Then, for each pixel in the image to be corrected, the maximum value among the R, G, and B channel values at that pixel location can be used as the original luminance value for that pixel location. For example, the original luminance value for each pixel in the image to be corrected can be determined using the following formula:
[0193]
[0194] in, This indicates the first element in the image to be corrected. The original brightness value at each pixel location; This indicates the first element in the image to be corrected. The pixel value of the R channel at each pixel location; This indicates the first element in the image to be corrected. The pixel value of the G channel at each pixel location; This indicates the first element in the image to be corrected. The pixel value of the B channel at each pixel location.
[0195] In step S102, each image to be corrected can be divided into multiple image regions according to a grid. The method of dividing the image regions is consistent for each image to be corrected. The size and number of grids can be set as needed and are not specifically limited. For example, the grid can be 60 (rows) × 80 (columns). Each grid can be a square grid. Figure 2 As shown, Figure 2 This diagram illustrates the division of multiple image regions in an image correction method provided in this embodiment. The image to be corrected can be uniformly divided into 165 image regions using an 11×15 square grid.
[0196] The vignetting center of an image to be corrected can be the center of the image itself, or it can be estimated using concentric circle constraints and based on the gain coefficients obtained from the calibration of each pixel position in the image to be corrected. For details on how to estimate the vignetting center, please refer to the descriptions of steps S701-S703 in subsequent embodiments.
[0197] Multiple preset lengths can be predetermined. For example, the preset length can be determined based on the length of the grid, such as representing the length of 2, 4, 6, 8, ... grids, or the preset length can be the length of 3, 6, 9, 12, ... grids. For each preset length, from the image regions obtained by dividing the image to be corrected according to the grid, the image region within the neighborhood of the position traversed by the circle with the center of the vignetting corner of the image to be corrected as the center and the preset length as the radius is determined, thus obtaining the image region corresponding to the preset length. For example, the image region whose distance from the center of the vignetting corner of the image to be corrected belongs to a preset distance range can be determined, thus obtaining the image region corresponding to the preset length. The preset distance range can represent a length range near and including the preset length. For example, the interval between the endpoints of the preset distance range can be the length of 2 grids, and the distance between an image region and the center of the vignetting corner of the image to be corrected can be the distance between the center of the image region and the center of the vignetting corner of the image to be corrected.
[0198] Furthermore, since there is no overlap between image regions corresponding to different preset lengths, it can be guaranteed that each image region in the image to be corrected has only one corresponding preset length. Each preset length corresponds to an image region that includes all image regions in the image to be corrected, ensuring that each image region in the image to be corrected has a corresponding preset length. For example, when the preset length represents 8 grids, the preset distance range can represent the length range between 6 and 8 grids. Accordingly, image regions whose distance from the center of the vignetting corner of the image to be corrected is greater than 6 grids but not greater than 8 grids can be identified as image regions corresponding to that preset length. Similarly, when the preset length represents 10 grids, the preset distance range can represent the length range between 8 and 10 grids. Likewise, image regions whose distance from the center of the vignetting corner of the image to be corrected is greater than 8 grids but not greater than 10 grids can be identified as image regions corresponding to that preset length. And so on.
[0199] Regarding step S103, since each image of the object to be calibrated acquired using a microscope often exhibits a bright center and dark edges, and the brightness value distribution in the image to be calibrated often conforms to concentric circle constraints—that is, the brightness values at the locations traversed by concentric circles centered on the dark corner of the image to be calibrated are relatively close—the brightness values of the image regions corresponding to each preset length in the image to be calibrated are often quite similar. Accordingly, for each preset length, the average level of the brightness values to be calibrated at the pixel positions in the image region corresponding to that preset length can be calculated to obtain the reference brightness value for the image region corresponding to that preset length.
[0200] In one implementation, the average level of the brightness values to be corrected at each pixel location in the image region corresponding to the preset length can be directly used as the reference brightness value for the image region corresponding to the preset length. Alternatively, the average value of the brightness values to be corrected at all pixel locations in the image region corresponding to the preset length can be calculated and used as the reference brightness value for the image region corresponding to the preset length. Or, a valid image region corresponding to the preset length can be determined from the image region. The average value of the brightness values to be corrected at each pixel location in the determined valid image region is then calculated and used as the reference brightness value for the image region corresponding to the preset length. For details, please refer to the relevant descriptions of steps one and two in the subsequent embodiments.
[0201] In another implementation, after calculating the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, the calculated average level can be optimized by combining a specified monotonic direction to obtain the reference brightness value of the image region corresponding to the preset length. For details, please refer to the relevant descriptions of steps S1031-S1034 in the subsequent embodiments.
[0202] Regarding step S104, if the difference between the brightness value to be corrected at a pixel location and the reference brightness value of its corresponding image region is less than a preset difference, it indicates that the brightness value to be corrected at that pixel location conforms to the concentric circle constraint, meaning that the brightness value to be corrected at that pixel location has high effectiveness, and this pixel location can be called an effective pixel location. For example, the absolute value of the difference between the brightness value to be corrected at a pixel location and the reference brightness value of its corresponding image region can be calculated as the difference between the brightness value to be corrected at that pixel location and the reference brightness value of its corresponding image region. The preset difference can be 10 or 15. Correspondingly, for each image region in the image to be corrected, the average level of the brightness values to be corrected at the effective pixel locations in that image region is calculated. The resulting usable brightness value for that image region also conforms to the concentric circle constraint, thus ensuring that the usable brightness value for that image region has high effectiveness. For example, the average value of the brightness values to be corrected at the effective pixel locations in that image region can be calculated as the usable brightness value for that image region.
[0203] In one embodiment, in each image to be corrected, the brightness value to be corrected at any valid pixel location is greater than a first preset brightness and less than a second preset brightness.
[0204] In this embodiment, the brightness value to be corrected at the effective pixel location also needs to be greater than a first preset brightness and less than a second preset brightness. If the brightness value to be corrected at a pixel location is less than the first preset brightness, it indicates that the pixel location is too dark. If the brightness value to be corrected at a pixel location is greater than the second preset brightness, it indicates that the pixel location is overexposed. For example, the first preset brightness can be any value between 10 and 20, and the second preset brightness can be any value between 230 and 240. For example, the effective pixel location in each image to be corrected can be determined according to the following formula:
[0205]
[0206] In the image to be corrected, Indicates pixel position The weight, Indicates pixel position The brightness value to be corrected Indicates the first preset brightness. This indicates the second preset brightness. Indicates pixel position For effective pixel positions, Indicates pixel position This is an invalid pixel location.
[0207] Based on the above processing, when calculating the usable brightness value for each image region in the image to be corrected, overly dark or overexposed pixel positions in that image region can be disregarded. This avoids the influence of the brightness values of overly dark or overexposed pixel positions on the calculated usable brightness value for that image region. In other words, the effectiveness of the obtained usable brightness value can be improved, which in turn can further improve the accuracy of the first gain coefficient obtained subsequently based on the usable brightness value, further ensuring the effective correction of vignetting in the image acquired by the microscope.
[0208] For steps S105 and S106, after obtaining the usable brightness value of each image region in each image to be corrected, fusion and interpolation processing can be performed based on the usable brightness values of the image regions in each image to be corrected to obtain a first gain coefficient at each pixel position in each image to be corrected. Since all images to be corrected were acquired using the same microscope, the first gain coefficient at the same pixel position in each image to be corrected is the same. For each image to be corrected, the first gain coefficient at each pixel position in the image to be corrected can be used to gain the brightness value to be corrected at that pixel position to obtain a corrected image. For example, the product of the first gain coefficient at each pixel position in the image to be corrected and the brightness value to be corrected at that pixel position can be calculated to obtain the brightness value at that pixel position in the corrected image.
[0209] In one embodiment, the confidence level of each image region can be determined based on the effective pixel locations contained in each image region within each image to be corrected, and this confidence level is considered during the fusion process. See also Figure 3 , Figure 3 This is a schematic diagram of a second flowchart of the image correction method provided in an embodiment of this application. Step S105 includes:
[0210] Step S1051: Based on the brightness values to be utilized in the image regions of each image to be corrected, perform interpolation processing and fusion processing according to the confidence level of the image regions in each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0211] In this context, the confidence level of the image region containing valid pixel locations in each image to be corrected is greater than the confidence level of the image region not containing valid pixel locations.
[0212] In this embodiment, an image region containing a valid pixel location is defined as an image region containing a valid pixel location, and an image region without a valid pixel location is defined as an image region not containing a valid pixel location. In each image to be corrected, the confidence level of an image region containing a valid pixel location is greater than the confidence level of an image region not containing a valid pixel location. For example, the confidence level of an image region containing a valid pixel location can be set as a first confidence level, and the confidence level of an image region not containing a valid pixel location can be set as a second confidence level, where the second confidence level can be greater than the first confidence level. For example, the first confidence level can be 1 or 0.9, and the second confidence level can be 0.1 or 0.15.
[0213] Based on the above processing, considering the confidence level of each image region during the fusion process reduces the impact of the unused brightness values of image regions that do not contain effective pixel locations in each image to be corrected on the first gain coefficient obtained at each pixel location in each image to be corrected. This can further improve the accuracy of the first gain coefficient obtained subsequently based on the unused brightness values, and further ensure that vignetting in images acquired by the microscope can be effectively corrected.
[0214] In this application, the first gain coefficient at each pixel location in each image to be corrected can be obtained based on the available brightness value and confidence level of the image region in each image to be corrected in the following manner.
[0215] In Method 1, the brightness values of multiple image regions with corresponding pixel positions in each image to be corrected can be fused first. Step S1051 includes:
[0216] Step 1: For multiple image regions with the same pixel position in each image to be corrected, fuse the brightness values of the multiple image regions according to the confidence level of the multiple image regions to obtain the fused brightness value corresponding to the multiple image regions.
[0217] Step 2: Based on the obtained fused brightness values, perform interpolation processing to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0218] In this embodiment, the brightness values of multiple image regions with consistent pixel positions in each image to be corrected can be fused according to their confidence levels to obtain fused brightness values corresponding to the multiple image regions. Then, based on the obtained fused brightness values and interpolation processing, a first gain coefficient at each pixel position in each image to be corrected can be obtained. For details, please refer to the descriptions of steps 21 and 22 in subsequent embodiments. In this way, the first gain coefficient at each pixel position can be adaptively estimated based on the brightness values of the image regions in each image to be corrected. That is, it ensures that a highly effective first gain coefficient can be obtained, and correspondingly, the first gain coefficient can be used to effectively correct vignetting in the image to be corrected, resulting in a corrected image with uniform overall brightness. In other words, it ensures that vignetting in images acquired by a microscope can be effectively corrected.
[0219] In one embodiment, step 2 includes:
[0220] Step 21: Interpolate the obtained fused brightness values according to the size of each image to be corrected to obtain the estimated brightness value at each pixel position in each image to be corrected; for each pixel position, calculate the ratio of the maximum value among the obtained estimated brightness values to the estimated brightness value at that pixel position, and use it as the first gain coefficient at that pixel position in each image to be corrected.
[0221] or,
[0222] Step 22: For each fused brightness value, calculate the ratio of the maximum value among the fused brightness values to the fused brightness value, and use it as the region gain coefficient of multiple image regions with the same pixel position corresponding to the fused brightness value; perform interpolation processing on the obtained region gain coefficients according to the size of each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0223] In this embodiment, the number of fused brightness values is the same as the number of image regions in each image to be corrected. After obtaining the fused brightness values corresponding to multiple image regions with the same pixel position in each image to be corrected, interpolation can be performed on the obtained fused brightness values to obtain the estimated brightness value at each pixel position in each image to be corrected. Then, based on the estimated brightness value at each pixel position in each image to be corrected, the first gain coefficient at that pixel position in each image to be corrected can be calculated. Alternatively, the region gain coefficients of multiple image regions with the same pixel position corresponding to each fused brightness value can be calculated first based on the obtained fused brightness values. The number of obtained region gain coefficients is also the same as the number of image regions in each image to be corrected. Then, interpolation is performed on the obtained region gain coefficients to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0224] For example, during the interpolation process of the obtained fused brightness values, when the image regions corresponding to two fused brightness values are adjacent in the image to be corrected, the two fused brightness values are considered adjacent. For each pair of adjacent fused brightness values, a brightness value can be inserted between them, and the newly inserted brightness value is adjacent to the two fused brightness values. For example, the brightness value inserted between the two fused brightness values can be the average of the two fused brightness values. Interpolation between each pair of adjacent brightness values continues until the number of brightness values obtained is the same as the number of pixel positions in each image to be corrected, thus obtaining the estimated brightness value for each pixel position.
[0225] Based on the above processing, the first gain coefficient at each pixel location can be estimated according to the usable brightness value with high effectiveness in the image region of each image to be corrected. This ensures that a highly effective first gain coefficient can be obtained. Consequently, using the first gain coefficient, vignetting in the image to be corrected can be effectively corrected, resulting in a corrected image with uniform overall brightness. In other words, it ensures that vignetting in images acquired by the microscope can be effectively corrected.
[0226] In one embodiment, step 1 (fusing the brightness values of multiple image regions with corresponding pixel positions in each image to be corrected to obtain a fused brightness value) includes:
[0227] Step 11: For multiple image regions with the same pixel position in each image to be corrected, use a preset formula to fuse the brightness values of the multiple image regions according to their confidence level to obtain the fused brightness values of the multiple image regions.
[0228] The preset formula is as follows:
[0229]
[0230] This represents the fused brightness value corresponding to the multiple image regions. Indicates the number of images to be corrected. This indicates that the multiple image regions belong to the first... Confidence of the image region of the image to be corrected This indicates that the multiple image regions belong to the first... The brightness values to be utilized for the image region of the image to be corrected.
[0231] In this embodiment, the fused brightness values corresponding to multiple image regions with the same pixel position in each image to be corrected can be calculated according to a preset formula. Correspondingly, based on the obtained fused brightness values and interpolation processing, a first gain coefficient at each pixel position in each image to be corrected can be obtained. This further ensures that a highly effective first gain coefficient can be obtained. Consequently, using the first gain coefficient, vignetting in the image to be corrected can be effectively corrected, resulting in a corrected image with uniform overall brightness. That is, it ensures that vignetting in images acquired by a microscope can be effectively corrected.
[0232] In method two, the brightness values of each image region in each image to be corrected can be interpolated first. Step S1051 includes:
[0233] Step 3: For each image to be corrected, interpolate the brightness values of each image region in the image to be corrected according to the size of the image to be corrected to obtain the estimated brightness value at each pixel position in the image to be corrected.
[0234] Step 4: Based on the estimated brightness value at each pixel location in each image to be corrected and the confidence level of the image region to which the pixel location belongs in each image to be corrected, perform fusion processing to obtain the first gain coefficient at each pixel location in each image to be corrected.
[0235] In this embodiment, the interpolation process in step 3 can refer to the description of interpolation processing of the obtained fused brightness values in Method 1 above. After obtaining the estimated brightness value at each pixel position in each image to be corrected, the pixel gain coefficient at each pixel position in each image to be corrected can be calculated first, and then the pixel gain coefficients at the same pixel position in each image to be corrected can be fused to obtain the first gain coefficient at that pixel position in each image to be corrected. Alternatively, the estimated brightness values at the same pixel position in each image to be corrected can be fused first to obtain the fused brightness value at that pixel position in each image to be corrected, and then the first gain coefficient at each pixel position in each image to be corrected can be calculated based on the obtained fused brightness values.
[0236] That is, step 4 includes:
[0237] Step 41: For each pixel location in the image to be corrected, the ratio of the maximum value among the estimated brightness values to the estimated brightness value at that pixel location is used as the pixel gain coefficient at that pixel location in the image to be corrected. For each pixel location, the pixel gain coefficients at that pixel location in each image to be corrected are fused according to the confidence level of the image region to which that pixel location belongs in each image to be corrected, to obtain the first gain coefficient at each pixel location in each image to be corrected.
[0238] or,
[0239] Step 42: For each pixel location, based on the confidence level of the image region to which the pixel location belongs in each image to be corrected, fuse the estimated brightness values at that pixel location in each image to be corrected to obtain the fused brightness value at each pixel location in each image to be corrected. The ratio of the maximum value among the calculated fused brightness values to the fused brightness value at that pixel location is used to obtain the first gain coefficient at that pixel location in each image to be corrected.
[0240] In method three, the region gain coefficient of each image region in each image to be corrected can be calculated first. Step S1051 includes:
[0241] Step 5: For each image region in each image to be corrected, calculate the ratio of the maximum value of the available brightness value of each image region in the image to be corrected to the available brightness value of the image region, and use it as the region gain coefficient of the image region in the image to be corrected.
[0242] Step 6: Based on the region gain coefficient of the image region in each image to be corrected, perform interpolation processing and fusion processing according to the confidence of the image region in each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0243] In this embodiment, after obtaining the region gain coefficient of each image region in each image to be corrected, the region gain coefficients of each image region in each image to be corrected can be interpolated according to the size of each image to be corrected to obtain the pixel gain coefficient at each pixel position in the image to be corrected. The method of interpolating the region gain coefficients can refer to the relevant description of interpolating the obtained fused brightness values in Method 1 above. Then, the pixel gain coefficients at the same pixel position in each image to be corrected are fused to obtain the first gain coefficient at that pixel position in each image to be corrected. Alternatively, the region gain coefficients of multiple image regions with corresponding pixel positions in each image to be corrected can be fused to obtain the fused gain coefficients corresponding to the multiple image regions. The number of fused gain coefficients obtained is the same as the number of image regions in each image to be corrected. Then, the fused gain coefficients obtained are interpolated according to the size of each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected. The method of interpolating the fused gain coefficients can refer to the relevant description of interpolating the obtained fused brightness values in Method 1 above.
[0244] That is, step 6 includes:
[0245] Step 61: For each image to be corrected, interpolate the region gain coefficients of each image region in the image to be corrected according to the size of the image to be corrected to obtain the pixel gain coefficient at each pixel position in the image to be corrected. For each pixel position, according to the confidence level of the image region to which the pixel position belongs in each image to be corrected, fuse the pixel gain coefficients at that pixel position in each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0246] or,
[0247] Step 62: For multiple image regions with corresponding pixel positions in each image to be corrected, fuse the region gain coefficients of these multiple image regions according to their confidence levels to obtain fused gain coefficients corresponding to these multiple image regions. Interpolate the obtained fused gain coefficients according to the size of each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0248] Regarding step 103 above (calculating the reference brightness value of the image region corresponding to each preset length), in one embodiment, after calculating the average level of the brightness value to be corrected at the pixel position in the image region corresponding to each preset length, the obtained average level can be optimized by combining a specified monotonic direction to obtain the reference brightness value of the image region corresponding to the preset length. See also Figure 4 , Figure 4This is a schematic diagram of the first process for determining a reference brightness value in an image correction method provided in an embodiment of this application. Step S103 includes:
[0249] Step S1031: Calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the initial brightness value of the image region corresponding to the preset length.
[0250] Step S1032: Determine whether the initial brightness value of the image area corresponding to the preset length conforms to the specified monotonic direction.
[0251] The specified monotonic direction represents the trend of change from the initial brightness value of the image region corresponding to the smallest preset length to the initial brightness value of the image region corresponding to the largest preset length.
[0252] Step S1033: If the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction, then the initial brightness value of the image region corresponding to the preset length is determined as the reference brightness value of the image region corresponding to the preset length.
[0253] Step S1034: If the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction, then determine the initial brightness value of the image region corresponding to other preset lengths within the neighborhood of the preset length that conforms to the specified monotonic direction, and perform interpolation based on the determined initial brightness value to obtain the reference brightness value of the image region corresponding to the preset length.
[0254] In this embodiment, the average value of the brightness to be corrected at the pixel position in the image region corresponding to the preset length can be calculated to obtain the initial brightness value of the image region corresponding to the preset length. Since images with vignetting are often bright in the center and dark around the edges, the initial brightness value of the image region corresponding to each preset length exhibits a monotonic trend as the preset length increases; this pattern can be called the brightness value distribution pattern. Correspondingly, a trend can be set between the initial brightness value of the image region corresponding to the smallest preset length and the initial brightness value of the image region corresponding to the largest preset length; this can be called the baseline trend. Specifying the monotonic direction can represent the baseline trend. For example, specifying the monotonic direction can indicate that the initial brightness value of the corresponding image region increases or decreases as the preset length increases.
[0255] For each preset length, it can be determined whether the initial brightness value of the image region corresponding to that preset length conforms to a specified monotonic direction. If the initial brightness value of the image region corresponding to that preset length conforms to the specified monotonic direction, it means that the initial brightness value of the image region corresponding to that preset length conforms to the brightness value distribution pattern, and the initial brightness value of the image region corresponding to that preset length can be determined as the reference brightness value of the image region corresponding to that preset length.
[0256] If the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction, it means that the initial brightness value of the image region corresponding to the preset length does not conform to the brightness value distribution pattern. That is, the initial brightness value of the image region corresponding to the preset length is invalid, and the preset length can be called an invalid length. It is possible to determine the initial brightness values of other image regions corresponding to preset lengths within the neighborhood of the invalid length that conform to the specified monotonic direction. For example, a neighborhood of a preset length can represent a length range near and containing the preset length. For instance, the interval between the two endpoints of the neighborhood of an invalid length can be 8 or 10 grid units, and the midpoint of the neighborhood of an invalid length can be the invalid length itself.
[0257] Interpolation is performed based on the determined initial brightness values to obtain reference brightness values for the image region corresponding to the invalid length. For example, one or more sets of initial brightness values for image regions corresponding to preset lengths can be selected from the determined initial brightness values. A set of preset lengths may include: a preset length greater than the invalid length (referred to as the first length) and a preset length less than the invalid length (referred to as the second length). For each selected set of preset lengths, the difference between the invalid length and the second length in that set (referred to as the first difference) and the difference between the first length and the second length in that set (referred to as the second difference) can be determined. The ratio of the first difference and the second difference can be called the utilization ratio. The difference between the initial brightness value of the image region corresponding to the first length in that set and the initial brightness value of the image region corresponding to the second length in that set can be called the third difference. The product of the utilization ratio and the third difference is calculated, and the sum of the resulting product and the initial brightness value of the image region corresponding to the second length in that set is calculated to obtain the interpolation result of the initial brightness values of the image region corresponding to the preset length. Furthermore, the interpolation result of the initial brightness value of any set of image regions corresponding to a preset length can be determined as the reference brightness value of the image region corresponding to the invalid length; or, the average value of the interpolation results of the initial brightness values of multiple sets of image regions corresponding to preset lengths can be calculated to obtain the reference brightness value of the image region corresponding to the preset length.
[0258] In one implementation, the trend of change from the initial brightness value of the image region corresponding to the smallest preset length to the initial brightness value of the image region corresponding to the preset length can be determined, and whether it is consistent with a reference trend. If they are consistent, it can be determined that the initial brightness value of the image region corresponding to the preset length conforms to a specified monotonic direction. Conversely, it can be determined that the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction. Alternatively, the trend of change from the initial brightness value of the image region corresponding to the preset length to the initial brightness value of the image region corresponding to the largest preset length can be determined, and whether it is consistent with a reference trend. If they are consistent, it can be determined that the initial brightness value of the image region corresponding to the preset length conforms to a specified monotonic direction. Conversely, it can be determined that the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction.
[0259] In another implementation, see Figure 5 , Figure 5 This is a schematic diagram of a second process for determining a reference brightness value in an image correction method provided in an embodiment of this application. Step S1032 includes:
[0260] Step S10321: Determine a plurality of preset lengths that are adjacent to the preset length from each preset length, and use them as adjacent preset lengths.
[0261] Step S10322: From multiple adjacent preset lengths, select the trend of change between the initial brightness value of the corresponding image region and the initial brightness value of the image region corresponding to the preset length, which does not conform to the adjacent preset lengths with a specified monotonic direction.
[0262] Step S10323: If the proportion of the selected adjacent preset length among multiple adjacent preset lengths is greater than a preset ratio, then it is determined that the initial brightness value of the image area corresponding to the preset length does not conform to the specified monotonic direction.
[0263] Step S10324: If the proportion of the selected adjacent preset length in the multiple adjacent preset lengths is not greater than the preset ratio, then the initial brightness value of the image area corresponding to the preset length is determined to conform to the specified monotonic direction.
[0264] In this implementation, for each preset length, multiple preset lengths adjacent to that preset length can be determined from among all preset lengths, serving as adjacent preset lengths. For example, 8 or 10 adjacent preset lengths can be determined. For each adjacent preset length, the trend of change between the initial brightness value of the image region corresponding to that adjacent preset length and the initial brightness value of the image region corresponding to that preset length can be determined, and whether it conforms to a specified monotonic direction. Furthermore, adjacent preset lengths that do not conform to the specified monotonic direction can be selected from among the multiple adjacent preset lengths.
[0265] When the adjacent preset length is greater than the preset length, it can be determined whether the trend of change between the initial brightness value of the image region corresponding to the preset length and the initial brightness value of the image region corresponding to the adjacent preset length is consistent with the reference trend. If they are consistent, it can be determined that the initial brightness value of the image region corresponding to the adjacent preset length conforms to the specified monotonic direction. Conversely, it can be determined that the initial brightness value of the image region corresponding to the adjacent preset length does not conform to the specified monotonic direction.
[0266] When the adjacent preset length is less than the preset length, it can be determined whether the trend of change between the initial brightness value of the image region corresponding to the adjacent preset length and the initial brightness value of the image region corresponding to the preset length is consistent with the reference trend. If they are consistent, it can be determined that the initial brightness value of the image region corresponding to the adjacent preset length conforms to the specified monotonic direction. Conversely, it can be determined that the initial brightness value of the image region corresponding to the adjacent preset length does not conform to the specified monotonic direction.
[0267] Furthermore, based on the relationship between the proportion of the selected adjacent preset length among multiple adjacent preset lengths and a preset ratio, it can be determined whether the initial brightness value of the image region corresponding to the preset length conforms to a specified monotonic direction. For example, the preset ratio can be 0.4 or 0.5. If the proportion of the selected adjacent preset length among multiple adjacent preset lengths is greater than the preset ratio, it indicates that the initial brightness value of the image region corresponding to the preset length does not conform to the brightness value distribution pattern, and thus it is determined that the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction. If the proportion of the selected adjacent preset length among multiple adjacent preset lengths is not greater than the preset ratio, it indicates that the initial brightness value of the image region corresponding to the preset length conforms to the brightness value distribution pattern, and thus it is determined that the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction.
[0268] For example, when the preset length represents the length of 2, 4, 6, 8, ... grids, for a preset length representing the length of 10 grids, multiple preset lengths adjacent to this preset length can be determined. For instance, ten preset lengths representing the lengths of 2, 4, 6, 8, 12, 14, 16, 18, 20, and 22 grids can be designated as adjacent preset lengths. The preset ratio can be 0.4. When the number of selected adjacent preset lengths is greater than 4, that is, the proportion of the selected adjacent preset length among the multiple adjacent preset lengths is greater than the preset ratio. When the number of selected adjacent preset lengths is not greater than 4, that is, the proportion of the selected adjacent preset length among the multiple adjacent preset lengths is not greater than the preset ratio.
[0269] Based on the above processing, it can be determined whether the initial brightness values of the image regions corresponding to each preset length conform to a specified monotonic direction, and whether the initial brightness values conform to the brightness value distribution pattern. Thus, the initial brightness values of the image regions corresponding to each preset length can be optimized according to the brightness value distribution pattern to obtain reference brightness values for each preset length. This ensures the effectiveness of the obtained reference brightness values for each preset length, thereby guaranteeing a highly effective first gain coefficient. Correspondingly, the first gain coefficient can effectively correct vignetting in the image to be corrected, resulting in a corrected image with uniform overall brightness. That is, it can effectively correct vignetting in images acquired by a microscope.
[0270] Regarding step S1031 (calculating the initial brightness value of the image region corresponding to each preset length) in the above embodiments, the initial brightness value of the image region corresponding to each preset length can be calculated in the following way:
[0271] In one calculation method, for each preset length, the average value of the brightness to be corrected at all pixel positions in the image region corresponding to the preset length can be calculated as the initial brightness value of the image region corresponding to the preset length.
[0272] In another calculation method, step S1031 includes:
[0273] Step 1: From the image region corresponding to the preset length, determine the image region containing the pixel positions where the brightness value to be corrected is greater than the first preset brightness and less than the second preset brightness, and take it as the effective image region corresponding to the preset length;
[0274] Step 2: Based on the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, calculate the average level of the brightness values to be corrected at each pixel position in the image region corresponding to the preset length, and obtain the initial brightness value of the image region corresponding to the preset length.
[0275] In this embodiment, in an image to be corrected, if the brightness value to be corrected at a pixel location is less than a first preset brightness, it indicates that the pixel location is too dark. If the brightness value to be corrected at a pixel location is greater than a second preset brightness, it indicates that the pixel location is overexposed. The brightness values at overly dark or overexposed pixel locations cannot effectively reflect the true brightness. When an image region corresponding to the preset length consists entirely of overly dark or overexposed pixel locations, that is, the image region does not contain pixel locations with a brightness value to be corrected greater than the first preset brightness and less than the second preset brightness, this image region can be called an invalid image region corresponding to the preset length. The brightness values of the invalid image region cannot effectively reflect the true brightness of the image region. If the average level of the brightness values to be corrected at pixel locations in the image region corresponding to the preset length is calculated based on the brightness values to be corrected at each pixel location in the invalid image region, the result obtained also cannot effectively reflect the brightness value of the image region corresponding to the preset length.
[0276] Therefore, an image region containing pixel positions whose brightness values to be corrected are greater than a first preset brightness and less than a second preset brightness can be determined from the image region corresponding to the preset length. This region is then considered the effective image region corresponding to the preset length. Based on the brightness values to be corrected at each pixel position in the effective image region, the average level of the brightness values to be corrected at each pixel position in the image region corresponding to the preset length is calculated to obtain the initial brightness value of the image region corresponding to the preset length. This avoids the influence of invalid image regions and improves the effectiveness of the calculated initial brightness value of the image region corresponding to the preset length. Consequently, this ensures that a highly effective first gain coefficient can be obtained subsequently. Correspondingly, the first gain coefficient can be used to effectively correct vignetting in the image to be corrected, resulting in a corrected image with uniform overall brightness. That is, it can effectively correct vignetting in images acquired by a microscope.
[0277] In this calculation method, the average value of the brightness to be corrected at all pixel positions in the image region corresponding to the preset length can be directly calculated to obtain the initial brightness value of the image region corresponding to the preset length.
[0278] Alternatively, step two (calculating the initial brightness value of the image region corresponding to the preset length) includes:
[0279] For each pixel position in the effective image region corresponding to the preset length, the brightness value interval to which the brightness value to be corrected at the pixel position belongs is determined from multiple consecutive brightness value intervals, and is used as the brightness value interval corresponding to the pixel position; the average level of the brightness value to be corrected at the pixel position corresponding to the target brightness value interval is calculated to obtain the initial brightness value of the image region corresponding to the preset length; among them, the number of pixel positions corresponding to the target brightness value interval is the largest.
[0280] In this method, multiple consecutive brightness value intervals can be preset. For example, multiple consecutive brightness value intervals can be arbitrarily set, and these intervals can cover the brightness correction value at each pixel position in the effective image area corresponding to the preset length; alternatively, the maximum and minimum values of the brightness correction values at each pixel position in the effective image area corresponding to the preset length can be determined, and the intervals with the determined maximum and minimum values as the endpoints can be divided into a preset number of consecutive brightness value intervals, resulting in multiple consecutive brightness value intervals. For example, the preset number can be 4. The division method can be set as needed, without distance limitation. The lengths of each brightness value interval can be the same or different.
[0281] Based on the brightness value to be corrected at each pixel location within the effective image region corresponding to the preset length, the brightness value interval corresponding to that pixel location can be determined. Furthermore, the brightness interval with the most corresponding pixel locations (i.e., the target brightness value interval) can be identified. For example, the target brightness value interval can be determined by statistically analyzing the brightness value intervals to which the brightness value to be corrected at each pixel location within the effective image region corresponding to the preset length using a histogram. Each brightness value interval can be referred to as a bin, and the bin with the largest response is the target brightness value interval.
[0282] For each preset length, the brightness values to be corrected at the pixel positions in the effective image region corresponding to that preset length are mostly concentrated within the target brightness value range. Accordingly, calculating the average level of the brightness values to be corrected at the pixel positions corresponding to the target brightness value range yields the initial brightness value of the image region corresponding to that preset length, which effectively reflects the average brightness level of the image region corresponding to that preset length. For example, the average value or weighted sum of the brightness values to be corrected at the pixel positions corresponding to the target brightness value range can be calculated to obtain the initial brightness value of the image region corresponding to that preset length.
[0283] This improves the effectiveness of the calculated initial brightness value of the image region corresponding to the preset length. Consequently, it ensures that a highly effective first gain coefficient can be obtained subsequently. Correspondingly, using the first gain coefficient, vignetting in the image to be corrected can be effectively corrected, resulting in a corrected image with uniform overall brightness. That is, vignetting in images acquired by a microscope can be effectively corrected.
[0284] In one embodiment, the gain coefficients at each pixel location can be pre-calibrated using a calibration board, and the original brightness values at each pixel location in each image to be corrected can be amplified using the calibrated gain coefficients to obtain the brightness values to be corrected at each pixel location in the image to be corrected. See also Figure 6 , Figure 6This is a schematic flowchart illustrating the calibration of gain coefficients in an image correction method provided in this application embodiment. Before step S101, the image correction method further includes:
[0285] Step S601: Obtain the calibration image of the preset calibration plate acquired using a microscope.
[0286] The calibration image has the same size as any image to be corrected.
[0287] Step S602: Based on the brightness value at each pixel position in the calibration image, calculate the gain coefficient at each pixel position in the calibration image, and use it as the second gain coefficient at the corresponding pixel position in each image to be corrected.
[0288] Step S101 includes:
[0289] For each image of the object to be observed acquired using a microscope, the original brightness value at each pixel location in the image to be corrected is increased using the second gain coefficient at that pixel location to obtain the brightness value to be corrected at that pixel location in the image to be corrected.
[0290] In this embodiment, a microscope can be used to acquire images of a preset calibration plate to obtain a calibration image with the same size as the image to be calibrated. The preset calibration plate can be a pre-set solid color calibration plate, and there can be one or more calibration images. Based on the brightness values at each pixel location in the calibration image, the gain coefficient at each pixel location in the calibration image is calculated and used as the second gain coefficient at the corresponding pixel location in each image to be calibrated.
[0291] For example, for each calibration image, it can be divided into multiple image regions according to a grid. The grid size can be set as needed and is not specifically limited. For each image region, the average brightness value of each pixel position in the image region is calculated to obtain the average brightness value of the image region. The ratio of the average brightness value of the reference image region to the average brightness value of the calibration image region is calculated as the gain coefficient of the calibration image region. For example, the reference image region can be the image region at the center of the image, that is, the image region in the middle of the calibration image. The gain coefficients of each image region in the calibration image are interpolated according to the size of the calibration image to obtain the gain coefficient at each pixel position in the calibration image.
[0292] Since the size of the calibration image is the same as the size of each image to be calibrated, if there is only one calibration image, the gain coefficient at each pixel position in the calibration image can be used as the second gain coefficient at the corresponding pixel position in each image to be calibrated. However, since it is often difficult to achieve completely uniform color on the preset calibration plate, and microscopes often magnify the texture on the preset calibration plate, the second gain coefficient obtained by calibrating using only one calibration image is easily affected by the texture on the preset calibration plate, resulting in low accuracy of the calibrated second gain coefficient.
[0293] To improve the accuracy of the second gain coefficient obtained from calibration, multiple calibration images can be acquired. The dimensions of the multiple calibration images are also consistent, matching the dimensions of each image to be calibrated. The calibration images can be images of different parts of a preset calibration board. The method for acquiring calibration images can refer to the description of acquiring multiple images to be calibrated in step S101 of the above embodiments. The number of calibration images can be set as needed and is not specifically limited. For example, the number of calibration images can be 25, 35, or 50. Step S602 includes: for each calibration image, calculating the gain coefficient at each pixel location in the calibration image based on the brightness value at each pixel location in the calibration image; fusing the gain coefficients at the same pixel location in each calibration image to obtain the second gain coefficient at the corresponding pixel location in each image to be calibrated.
[0294] For each calibration image, the gain coefficient at each pixel location in the calibration image can be calculated as described above. Then, for each pixel location, the gain coefficients at that pixel location in each calibration image can be fused to obtain a second gain coefficient at that pixel location in each image to be corrected. For example, a weighted sum or average of the gain coefficients at that pixel location in each calibration image can be calculated as the second gain coefficient at that pixel location in each image to be corrected. This avoids the influence of texture on a preset calibration board when calibrating the second gain coefficient using only one calibration image, thus improving the accuracy of the calibrated second gain coefficient. This, in turn, improves the accuracy of the subsequently obtained brightness value to be corrected, thereby ensuring the effectiveness of the first gain coefficient estimated based on the brightness value to be corrected.
[0295] After obtaining the second gain coefficient at each pixel position in each image to be corrected, for each image to be corrected, the original brightness value at each pixel position can be increased using the second gain coefficient at each pixel position in the image to be corrected, so as to obtain the brightness value to be corrected at that pixel position in the image to be corrected.
[0296] In one implementation, for each image to be corrected, a second gain coefficient at each pixel location in the image to be corrected can be calculated, and the product of the second gain coefficient and the original brightness value at the pixel location can be used to obtain the brightness value to be corrected at the pixel location in the image to be corrected.
[0297] In another implementation, for each Bayer_RGGB format image to be corrected, a second gain coefficient can be calculated at each pixel location in the image to be corrected. The product of this second gain coefficient and the pixel value at that location yields the gained pixel value at that pixel location, thus obtaining the Bayer_RGGB format image to be corrected with preliminary gain. For example, the Bayer_RGGB format image to be corrected with preliminary gain can be obtained using the following formula:
[0298]
[0299] in, This refers to the image to be corrected in Bayer_RGGB format. This represents the second gain coefficient at each pixel location in the image to be corrected. The image to be corrected is in Bayer_RGGB format, representing the initial gain.
[0300] Then, the Bayer_RGGB format image to be corrected is converted to RGB format using CFA. For each pixel in the converted RGB format image, the maximum value among the R, G, and B channel pixel values at that pixel location can be used as the brightness value to be corrected for that pixel location. That is, the Bayer_RGGB format image to be corrected can be first gained using the second gain coefficient, and then the format of the gained image to be corrected can be converted to obtain the brightness value to be corrected for each pixel in the image to be corrected.
[0301] Based on the above processing, the gain coefficients at each pixel location can be pre-calibrated using a calibration board. These calibrated gain coefficients are then used to apply an initial gain to each image to be corrected. Subsequently, the brightness values to be corrected at each pixel location in the image to be corrected can be used as the basis for this initial gain. In this way, by combining calibration board calibration with concentric circle constraint estimation, the first gain coefficient at each pixel location can be adaptively estimated, resulting in a highly effective first gain coefficient. This can further improve the accuracy of correcting vignetting in images acquired by a microscope.
[0302] In one embodiment, see Figure 7 , Figure 7 This is a flowchart illustrating the process of determining the vignetting center in an image correction method provided in this application embodiment. The vignetting center of each image to be corrected is determined through the following steps:
[0303] Step S701: For each image to be corrected, determine the gain coefficient interval to which the second gain coefficient at each pixel position in the image to be corrected belongs from each gain coefficient interval, and use it as the gain coefficient interval corresponding to that pixel position.
[0304] Step S702: For each gain coefficient interval, perform ellipse fitting based on the pixel position corresponding to the gain coefficient interval to obtain the ellipse to be used.
[0305] Step S703: Based on the center of the ellipse to be used that meets the preset conditions, determine the vignetting center of the image to be corrected.
[0306] Among them, the difference between the lengths of the major and minor axes of the ellipse to be used that meets the preset conditions is less than the preset difference.
[0307] In this embodiment, due to factors such as microscope assembly errors, the center of the vignetting in the image acquired by the microscope may not be at the center of the image. Therefore, concentric circle constraints can be used to estimate the center of the vignetting based on the second gain coefficient at each pixel position in the image to be corrected. For each image to be corrected, the gain coefficient range corresponding to that pixel position can be determined based on the second gain coefficient at each pixel position in the image to be corrected.
[0308] For example, the second gain coefficient at each pixel location in the image to be corrected can be normalized, such as to 0-255. The median value of each gain coefficient interval can be determined, and the absolute value of the difference between the endpoint of each gain coefficient interval and the median value of that interval should not exceed a preset threshold. For example, the median values of each gain coefficient interval can be 2, 4, 6, ..., 254, and the preset threshold can be 2. The pixel location corresponding to a gain coefficient interval can also be referred to as the pixel location corresponding to the contour line of the median value of that gain coefficient interval. For example, the second gain coefficient at a pixel location and the median value of the second gain coefficient interval corresponding to that pixel location satisfy the following formula:
[0309]
[0310] in, This represents the midpoint of the gain coefficient range corresponding to that pixel location. This represents the second gain coefficient at the pixel location, with a preset threshold of 2.
[0311] For each gain coefficient interval, ellipse fitting can be performed based on the corresponding pixel positions to obtain the ellipse to be utilized. The difference between the major and minor axes of each ellipse can be used to determine whether it approximates a circle. If the difference between the major and minor axes of an ellipse is less than a preset difference, it indicates that the ellipse is approximates a circle, meaning it meets a preset condition. For example, an ellipse meeting the preset condition also conforms to the following formula:
[0312]
[0313] in, These represent the lengths of the major and minor semi-axis of the ellipse to be used, respectively.
[0314] Based on the concentric circle constraint, for each concentric circle centered at the vignetting center of the image to be corrected, the brightness values at the positions traversed by the concentric circle are relatively close. Therefore, the usable ellipse that meets the conditions is also close to the concentric circle centered at the vignetting center. Accordingly, based on the center of the usable ellipse that meets the preset conditions, the vignetting center of the image to be corrected can be estimated. In this way, based on the concentric circle constraint, the vignetting center of each image to be corrected can be estimated to obtain a vignetting center with high accuracy. Furthermore, this ensures that the first gain coefficient at each pixel position can be adaptively estimated based on the vignetting center with high accuracy, resulting in a first gain coefficient with high effectiveness.
[0315] In one implementation, the centers of the ellipses to be used that meet preset conditions can be clustered to obtain multiple clusters. The cluster center containing the most centers can be used as the vignetting center of the image to be corrected.
[0316] In another implementation, step S703 includes: voting based on the centers of the ellipses to be used that meet the preset conditions, and obtaining the center of the ellipse to be used with the most votes as the vignetting center of the image to be corrected.
[0317] In this embodiment, a voting algorithm can also be used to vote on the centers of the ellipses that meet preset conditions (which can be called candidate centers). The candidate center with the most votes can be used as the vignetting center of the image to be corrected. The centers of the ellipses that meet the preset conditions can form a set of candidate centers. For example, for each candidate center, the number of candidate centers in a voting window of a preset size centered on that candidate center can be determined, and the center of the voting window containing the most candidate centers is the candidate center with the most votes. Alternatively, the average coordinates of the coordinates of each candidate center in the voting window containing the most candidate centers can be calculated to obtain the coordinates of the vignetting center of the image to be corrected. For example, the size of the voting window can be 7×7, with the unit being pixel positions.
[0318] Based on the above processing, the location of the vignetting center can be estimated using a voting method and a set of candidate center points. This ensures that the vignetting center of each image to be corrected can be estimated based on the centers of the ellipses that meet preset conditions, resulting in a highly accurate vignetting center. Furthermore, this ensures that the first gain coefficient at each pixel location can be adaptively estimated based on the highly accurate vignetting center, resulting in a highly effective first gain coefficient.
[0319] Because microscopes have limited viewing angles, they can only acquire images of a small area on the surface of the object to be observed (which can be called small-angle images). Therefore, it is often necessary to use a microscope to acquire multiple consecutive small-angle images and stitch them together (which can also be called 2D stitching) to obtain images of a larger area on the surface of the object to be observed (which can be called large-angle images). By browsing the large-angle images, the surface of the object to be observed can be observed.
[0320] In one embodiment, each image to be corrected is an image of a different part of the object to be observed. Each image to be corrected may be acquired in accordance with the method of acquiring multiple images to be corrected as described in step S101 of the above embodiment. After step S106, the method further includes: stitching together the corrected images according to the local positions corresponding to each corrected image to obtain a complete image of the object to be observed.
[0321] In the embodiments of this application, each image to be corrected is a small-view image of a different part of the object to be observed. After vignetting correction is performed on each image to be corrected, the corrected images can be stitched together according to the local position corresponding to each corrected image to obtain a complete image of the object to be observed (i.e., a large-view image).
[0322] For example, feature extraction can be performed on each calibrated image, such as using the SIFT (Scale-Invariant Feature Transform) method. Based on the extracted features, the matching relationship between each pair of adjacent images is determined, and the matching relationship is optimized using the RANSA (Random Sample Consensus) method. For each calibrated image, the local position corresponding to its neighboring image is adjacent to the local position corresponding to the calibrated image, and the local position corresponding to its neighboring image can be above, above left, above right, below, below left, below right, above left, or to the right of the local position corresponding to the calibrated image. Based on the matching relationship, the transformation relationship between each calibrated image and the world coordinate system can be determined, where the world coordinate system can be the image coordinate system of any calibrated image. Furthermore, the BA (Bundle Adjustment) method can be used to optimize and adjust the transformation relationship between each calibrated image and the world coordinate system. Based on the optimized transformation relationship, the calibrated images are stitched together in the same world coordinate system to obtain a complete image of the observed object. That is, the corrected images are merged into a stitched image, and the image coordinate system of the stitched image is the world coordinate system.
[0323] Based on the above processing, vignetting in small-angle images acquired by the microscope can be corrected, avoiding obvious bright and dark spots in the stitched large-angle image caused by vignetting in the small-angle image. This ensures uniform brightness throughout the stitched large-angle image. Thus, the object to be observed can be effectively observed based on the stitched large-angle image.
[0324] In one embodiment, see Figure 8 , Figure 8 This is a schematic diagram illustrating the image stitching process in the image correction method provided in this application embodiment. It may include:
[0325] Step S801: Image sequence. That is, each image to be corrected is an image of a different part of the object to be observed, and the corrected image is obtained.
[0326] Step S802: Image Registration: Obtain the relative positions between images to achieve position alignment. That is, determine the transformation relationship between each corrected image and the world coordinate system based on the matching relationship between adjacent images.
[0327] Step S803: Bundle Adjustment (BA): Adjust the image position to eliminate the effects of accumulated errors. That is, the BA method can be used to optimize and adjust the transformation relationship between each corrected image and the world coordinate system.
[0328] Step S804: Image Fusion: Eliminate stitching seams to ensure visual continuity and consistency. That is, based on the optimized transformation relationship, complete the stitching of each corrected image in the same world coordinate system.
[0329] Step S805: Image stitching. That is, complete the stitching to obtain a complete image of the object to be observed.
[0330] In one embodiment, see Figure 9 , Figure 9 This is a schematic flowchart illustrating the gain calculation process in the image correction method provided in this application embodiment. It may include:
[0331] Step S901: Original Bayer_RGGB format image. That is, obtain the image to be corrected in Bayer_RGGB format.
[0332] Step S902: Calibration scheme correction. That is, steps S601 and S602 in the above embodiments, and for each image of the object to be calibrated acquired using a microscope, the original brightness value at each pixel location in the image to be calibrated is increased using the second gain coefficient at that pixel location to obtain the brightness value to be calibrated at that pixel location in the image to be calibrated. The second gain coefficient can also be called the vignetting coefficient.
[0333] Step S903: Convert to HSV (Hue, Saturation, Value) format. That is, in step S902, the Bayer_RGGB format image to be corrected can be gained using the second gain coefficient, and then the format of the gained image to be corrected can be converted to obtain the brightness value (V value) of each pixel position in the image to be corrected.
[0334] Step S904: Estimation of the center of the vignetting. That is, steps S701-S703 in the above embodiments.
[0335] Step S905: Estimation of residual vignetting coefficient. That is, steps S101-S106 in the above embodiment. The first gain coefficient can also be called the residual vignetting coefficient.
[0336] Step S906: Residual vignetting coefficient fusion. That is, the calibrated vignetting coefficient and the residual vignetting coefficient can be fused to obtain the final adaptive vignetting coefficient, which is to say, the first gain coefficient and the second gain coefficient are fused to obtain the final adaptive gain coefficient.
[0337] In one embodiment, Figure 10a This is a schematic diagram illustrating a complete image of an object obtained by correcting and stitching together images based on different vignetting correction methods, as provided in an embodiment of this application. Figure 10bThis is a schematic diagram illustrating a complete image of another object obtained by correcting and stitching together images based on different vignetting correction methods, as provided in an embodiment of this application. Twenty-five small-view images were acquired using a microscope. Each small-view image exhibits vignetting, meaning that the center of each small-view image is bright while the edges are dark. These 25 small-view images can be stitched together in a 5×5 arrangement to obtain a complete image of the object (i.e., a large-view image).
[0338] exist Figure 10a and Figure 10b In the image on the left, the large-view image is obtained by stitching together small-view images acquired directly from a microscope. Because there are vignetting in the small-view images acquired from the microscope, obvious bright and dark spots appear in the stitched large-view image. That is, the stitching area of each small-view image is dark, which will result in obvious stitching marks in the stitched large-view image.
[0339] The middle image represents a large-view image obtained by stitching together small-angle images acquired by a microscope using only the calibrated vignetting factor (i.e., the second gain factor) after vignetting correction. In this case, although vignetting correction was performed on each small-angle image, vignetting still exists in each small-angle image, and relatively obvious bright and dark spots remain in the stitched large-view image. That is, the stitching area between the small-angle images is still relatively dark, and relatively obvious stitching marks remain in the stitched large-view image.
[0340] The image on the right shows the final adaptive vignetting coefficient obtained by fusing the calibrated vignetting coefficient (i.e., the second gain coefficient) and the residual vignetting coefficient (i.e., the first gain coefficient). This coefficient is used to correct vignetting in small-view images acquired by a microscope, and then stitched together to form a large-view image. In this case, vignetting in each small-view image can be effectively corrected, and there are no obvious vignettings in the corrected small-view images. Correspondingly, there are no obvious bright or dark spots in the stitched large-view image, and the overall brightness is uniform. Furthermore, the stitched large-view image does not exhibit the darker stitching areas found in the small-view images, thus avoiding obvious stitching marks.
[0341] As can be seen, compared to the method of correcting vignetting in small-view images acquired by a microscope using only the calibrated vignetting coefficient (i.e., the second gain coefficient), the method provided in this application, which uses the fusion of the calibrated vignetting coefficient and the residual vignetting coefficient to obtain the final adaptive vignetting coefficient, and then uses the adaptive vignetting coefficient to correct vignetting in the acquired small-view images, can more effectively remove vignetting from small-view images. The resulting large-view image also has more uniform brightness and no obvious stitching marks. This ensures that the object to be observed can be effectively observed based on the stitched large-view image.
[0342] Based on the same inventive concept, this application provides an image correction device, see [link to relevant documentation]. Figure 11 , Figure 11 This is a schematic diagram of the structure of an image correction device provided in an embodiment of this application. The device includes:
[0343] The brightness value acquisition module 1101 is used to acquire the brightness value to be corrected at each pixel position in each image to be corrected of the object to be observed acquired using a microscope; wherein the acquired images to be corrected are of the same size.
[0344] The image region determination module 1102 is used to determine, for each preset length, the image region within the neighborhood of the position traversed by a circle with the center of the dark corner of the image to be corrected as the center and the preset length as the radius from each image region obtained by dividing the image to be corrected according to the grid. The image region corresponding to the preset length is obtained; wherein, there is no intersection between the image regions corresponding to different preset lengths, and each image region corresponding to the preset length contains all the image regions in the image to be corrected.
[0345] The reference brightness value calculation module 1103 is used to calculate the average level of the brightness value to be corrected at the pixel position in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length.
[0346] The brightness value calculation module 1104 is used to calculate the average level of the brightness value to be corrected at the effective pixel position in each image region of the image to be corrected, and obtain the brightness value to be used in the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference.
[0347] The first gain coefficient calculation module 1105 is used to perform fusion and interpolation processing based on the brightness values of the image regions in each image to be corrected, so as to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein the first gain coefficient at the same pixel position in each image to be corrected is the same.
[0348] The image correction module 1106 is used to increase the brightness value of each pixel position in each image to be corrected by using a first gain coefficient at each pixel position in the image to be corrected, so as to obtain a corrected image.
[0349] Based on the image correction device provided in this application embodiment, since each image of the object to be corrected acquired using a microscope often exhibits a bright center and dark edges, and the brightness value distribution in the image to be corrected often conforms to concentric circle constraints, that is, for each concentric circle with the center of the dark corner of the image to be corrected as the center, the brightness values at the positions traversed by the concentric circle are relatively close. Therefore, the brightness values of the image region corresponding to each preset length in the image to be corrected are often relatively close. Furthermore, for each preset length, the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length can be calculated to obtain the reference brightness value of the image region corresponding to the preset length. If the difference between the brightness value to be corrected at a pixel position and the reference brightness value of the image region to which it belongs is less than a preset difference, it can be said that the brightness value to be corrected at that pixel position conforms to the concentric circle constraints, which also indicates that the effectiveness of the brightness value to be corrected at that pixel position is high, and this pixel position can be called an effective pixel position.
[0350] Correspondingly, for each image region in the image to be corrected, the average level of the brightness value to be corrected at the effective pixel positions in that image region is calculated. The resulting usable brightness value for that image region then conforms to the concentric circle constraint, ensuring high effectiveness of the usable brightness value. Furthermore, by performing fusion and interpolation processing on the usable brightness values of the image regions in each image to be corrected, the effectiveness of the first gain coefficient at each pixel position in each image to be corrected is also high. Thus, based on the brightness value to be corrected at each pixel position in the image to be corrected, the first gain coefficient at each pixel position can be estimated, resulting in a highly effective first gain coefficient. Consequently, using the first gain coefficient, vignetting in the image to be corrected can be effectively corrected, resulting in a corrected image with uniform overall brightness. That is, vignetting in images acquired by a microscope can be effectively corrected.
[0351] Optionally, the reference brightness value calculation module 1103 includes:
[0352] The initial brightness value calculation submodule is used to calculate the average level of the brightness value to be corrected at the pixel position in the image region corresponding to the preset length, and obtain the initial brightness value of the image region corresponding to the preset length.
[0353] The monotonic direction determination submodule is used to determine whether the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction; wherein, the specified monotonic direction represents the trend of change between the initial brightness value of the image region corresponding to the smallest preset length and the initial brightness value of the image region corresponding to the largest preset length.
[0354] The first determining submodule is used to determine the initial brightness value of the image region corresponding to the preset length as the reference brightness value of the image region corresponding to the preset length if the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction.
[0355] The second determining submodule is used to determine the initial brightness values of other image regions corresponding to the preset length within the neighborhood of the preset length that conform to the specified monotonic direction if the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction, and to perform interpolation based on the determined initial brightness value to obtain the reference brightness value of the image region corresponding to the preset length.
[0356] Optionally, the monotonic direction determination submodule is specifically used to determine multiple preset lengths adjacent to the preset length from each preset length, as adjacent preset lengths; from the multiple adjacent preset lengths, select adjacent preset lengths whose trend of change between the initial brightness value of the corresponding image region and the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction; if the proportion of the selected adjacent preset length in the multiple adjacent preset lengths is greater than a preset ratio, then it is determined that the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction; if the proportion of the selected adjacent preset length in the multiple adjacent preset lengths is not greater than the preset ratio, then it is determined that the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction.
[0357] Optionally, the initial brightness value calculation submodule includes:
[0358] The effective image region determination unit is used to determine, from the image region corresponding to the preset length, an image region containing the pixel positions whose brightness value to be corrected is greater than the first preset brightness and less than the second preset brightness, as the effective image region corresponding to the preset length;
[0359] The initial brightness value determination unit is used to calculate the average level of the brightness values to be corrected at the pixel positions in the effective image region corresponding to the preset length based on the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, and obtain the initial brightness value of the image region corresponding to the preset length.
[0360] Optionally, the initial brightness value determination unit is specifically used to determine, for each pixel position in the effective image region corresponding to the preset length, the brightness value interval to which the brightness value to be corrected at the pixel position belongs from multiple consecutive brightness value intervals, as the brightness value interval corresponding to the pixel position; calculate the average level of the brightness value to be corrected at the pixel position corresponding to the target brightness value interval, and obtain the initial brightness value of the image region corresponding to the preset length; wherein, the number of pixel positions corresponding to the target brightness value interval is the largest.
[0361] Optionally, the first gain coefficient calculation module 1105 includes:
[0362] The gain coefficient calculation submodule is used to perform interpolation processing based on the usable brightness values of the image regions in each image to be corrected, and to perform fusion processing according to the confidence of the image regions in each image to be corrected, to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein, the confidence of the image region containing effective pixel positions in each image to be corrected is greater than the confidence of the image region not containing effective pixel positions.
[0363] Optionally, in each image to be corrected, the brightness value to be corrected at any valid pixel location is greater than a first preset brightness and less than a second preset brightness.
[0364] Optionally, the gain coefficient calculation submodule includes:
[0365] The brightness value fusion unit is used to fuse the brightness values of multiple image regions with the same corresponding pixel positions in each image to be corrected according to the confidence level of the multiple image regions, so as to obtain the fused brightness value corresponding to the multiple image regions.
[0366] The gain coefficient calculation unit is used to perform interpolation processing based on the obtained fused brightness values to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0367] Optionally, the gain coefficient calculation unit is specifically used to interpolate the obtained fused brightness values according to the size of each image to be corrected, to obtain an estimated brightness value at each pixel position in each image to be corrected; for each pixel position, the ratio of the maximum value among the estimated brightness values to the estimated brightness value at that pixel position is used as the first gain coefficient at that pixel position in each image to be corrected; or, for each fused brightness value, the ratio of the maximum value among the fused brightness values to the fused brightness value is used as the region gain coefficient of multiple image regions with the same pixel position as the fused brightness value; and to interpolate the obtained region gain coefficients according to the size of each image to be corrected, to obtain the first gain coefficient at each pixel position in each image to be corrected.
[0368] Optionally, the brightness value fusion unit is specifically used to fuse the brightness values of multiple image regions with corresponding pixel positions in each image to be corrected, according to a preset formula and based on the confidence level of the multiple image regions, to obtain the fused brightness value corresponding to the multiple image regions; wherein, the preset formula is as follows:
[0369]
[0370] This represents the fused brightness value corresponding to the multiple image regions. Indicates the number of images to be corrected. This indicates that the multiple image regions belong to the first... Confidence of the image region of the image to be corrected This indicates that the multiple image regions belong to the first... The brightness values to be utilized for the image region of the image to be corrected.
[0371] Optionally, the device further includes:
[0372] The calibration image acquisition module is used to acquire a calibration image of a preset calibration plate acquired by the microscope before acquiring the brightness value to be corrected at each pixel position in each image to be corrected for each image to be corrected of the object to be observed acquired by the microscope; wherein the calibration image has the same size as any image to be corrected.
[0373] The second gain coefficient calculation module is used to calculate the gain coefficient at each pixel position in the calibration image based on the brightness value at each pixel position in the calibration image, and use them as the second gain coefficient at the corresponding pixel position in each image to be corrected.
[0374] The brightness value acquisition module 1101 is specifically used to, for each image of the object to be observed acquired by a microscope, use the second gain coefficient at each pixel position in the image to be corrected to increase the original brightness value at that pixel position, thereby obtaining the brightness value to be corrected at that pixel position in the image to be corrected.
[0375] Optionally, the calibration image is an image of different parts of the preset calibration board;
[0376] The second gain coefficient calculation module is specifically used to calculate the gain coefficient of each pixel position in each calibration image based on the brightness value of each pixel position in the calibration image; and to fuse the gain coefficients of the same pixel position in each calibration image to obtain the second gain coefficient of the corresponding pixel position in each image to be corrected.
[0377] Optionally, the device further includes:
[0378] The vignetting center determination module is used to determine, for each image to be corrected, the gain coefficient interval to which the second gain coefficient at each pixel position in the image to be corrected belongs from each gain coefficient interval, as the gain coefficient interval corresponding to that pixel position; for each gain coefficient interval, ellipse fitting is performed based on the pixel position corresponding to the gain coefficient interval to obtain an ellipse to be used; based on the center of the obtained ellipse to be used that meets the preset conditions, the vignetting center of the image to be corrected is determined; wherein, the difference between the lengths of the major axis and the minor axis of the ellipse to be used that meets the preset conditions is less than a preset difference.
[0379] Optionally, the vignetting center determination module is specifically used to vote based on the centers of the ellipses to be used that meet the preset conditions, and to obtain the center of the ellipse to be used with the most votes, which is then used as the vignetting center of the image to be corrected.
[0380] Optionally, each image to be corrected is an image of a different part of the object to be observed;
[0381] The device further includes:
[0382] The image stitching module is used to stitch together the corrected images according to the local positions corresponding to each corrected image after amplifying the brightness value of the pixel position at each pixel position in the corrected image to obtain a corrected image.
[0383] This application also provides an electronic device, such as... Figure 12 As shown, it includes:
[0384] Memory 1201 is used to store computer programs;
[0385] When processor 1202 executes the program stored in memory 1201, it performs the following steps:
[0386] For each image of the object to be observed acquired using a microscope, the brightness value to be corrected at each pixel position in the image to be corrected is obtained; wherein, the acquired images to be corrected are of the same size.
[0387] For each preset length, from each image region obtained by dividing the image to be corrected according to the grid, the image region within the neighborhood range of the position traversed by the circle with the center of the dark corner of the image to be corrected as the center and the preset length as the radius is determined, and the image region corresponding to the preset length is obtained; wherein, there is no intersection between the image regions corresponding to different preset lengths, and the image region corresponding to each preset length contains all the image regions of the image to be corrected.
[0388] Calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length;
[0389] For each image region in the image to be corrected, the average level of the brightness value to be corrected at the effective pixel position in the image region is calculated to obtain the brightness value to be utilized in the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference.
[0390] Based on the brightness values of the image regions to be used in each image to be corrected, fusion and interpolation processes are performed to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein, the first gain coefficient at the same pixel position in each image to be corrected is the same.
[0391] For each image to be corrected, the brightness value to be corrected at each pixel position is increased using the first gain coefficient at that pixel position to obtain the corrected image.
[0392] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 1202, the communication interface, and the memory 1201 communicating with each other via the communication bus.
[0393] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0394] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0395] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0396] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0397] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described image correction methods.
[0398] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the image correction methods described above.
[0399] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.
[0400] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0401] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, storage media, and program products are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0402] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A microscope, characterized in that, include: A lens is used to acquire multiple images of the object to be observed, all of which are of the same size. The processor is used to obtain the brightness value to be corrected at each pixel position in each image to be corrected captured by the lens. The processor is further configured to, for each preset length, determine, from each image region obtained by dividing the image to be corrected according to a grid, an image region within the neighborhood of the position traversed by a circle with the center of the vignetting corner of the image to be corrected as the center and the preset length as the radius, and obtain an image region corresponding to the preset length; wherein, there is no intersection between image regions corresponding to different preset lengths, and each image region corresponding to a preset length contains all image regions in the image to be corrected. The processor is further configured to calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length; The processor is further configured to calculate, for each image region in the image to be corrected, the average level of the brightness value to be corrected at the effective pixel position in the image region, and obtain the brightness value to be utilized in the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference. The processor is further configured to perform fusion and interpolation processing based on the brightness values of the image regions in each image to be corrected, to obtain a first gain coefficient at each pixel position in each image to be corrected; wherein the first gain coefficient at the same pixel position in each image to be corrected is the same. The processor is further configured to, for each image to be corrected, use a first gain coefficient at each pixel location in the image to be corrected to increase the brightness value at that pixel location, thereby obtaining a corrected image.
2. An image correction method, characterized in that, The method includes: For each image of the object to be observed acquired using a microscope, the brightness value to be corrected at each pixel position in the image to be corrected is obtained; wherein, the acquired images to be corrected are of the same size. For each preset length, from each image region obtained by dividing the image to be corrected according to the grid, the image region within the neighborhood range of the position traversed by the circle with the center of the dark corner of the image to be corrected as the center and the preset length as the radius is determined, and the image region corresponding to the preset length is obtained; wherein, there is no intersection between the image regions corresponding to different preset lengths, and the image region corresponding to each preset length contains all the image regions of the image to be corrected. Calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the reference brightness value of the image region corresponding to the preset length; For each image region in the image to be corrected, the average level of the brightness value to be corrected at the effective pixel position in the image region is calculated to obtain the brightness value to be utilized in the image region; wherein, in each image to be corrected, the difference between the brightness value to be corrected at any effective pixel position and the reference brightness value of the image region to which the effective pixel position belongs is less than a preset difference. Based on the brightness values of the image regions to be used in each image to be corrected, fusion and interpolation processes are performed to obtain the first gain coefficient at each pixel position in each image to be corrected; wherein, the first gain coefficient at the same pixel position in each image to be corrected is the same. For each image to be corrected, the brightness value to be corrected at each pixel position is increased using the first gain coefficient at that pixel position to obtain the corrected image.
3. The method according to claim 2, characterized in that, The step of calculating the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtaining the reference brightness value of the image region corresponding to the preset length, includes: Calculate the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, and obtain the initial brightness value of the image region corresponding to the preset length; Determine whether the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction; wherein, the specified monotonic direction represents the trend of change from the initial brightness value of the image region corresponding to the smallest preset length to the initial brightness value of the image region corresponding to the largest preset length. If the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction, then the initial brightness value of the image region corresponding to the preset length is determined as the reference brightness value of the image region corresponding to the preset length. If the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction, then the initial brightness value of the image region corresponding to other preset lengths within the neighborhood of the preset length that conforms to the specified monotonic direction is determined, and interpolation is performed based on the determined initial brightness value to obtain the reference brightness value of the image region corresponding to the preset length.
4. The method according to claim 3, characterized in that, The step of determining whether the initial brightness value of the image region corresponding to the preset length conforms to the specified monotonic direction includes: From each preset length, determine a plurality of preset lengths that are adjacent to the preset length, and use them as adjacent preset lengths; From multiple adjacent preset lengths, the trend of change between the initial brightness value of the corresponding image region and the initial brightness value of the image region corresponding to the preset length is selected, and does not conform to the adjacent preset length with the specified monotonic direction. If the proportion of the selected adjacent preset length in the plurality of adjacent preset lengths is greater than a preset ratio, then it is determined that the initial brightness value of the image region corresponding to the preset length does not conform to the specified monotonic direction. If the proportion of the selected adjacent preset length among the plurality of adjacent preset lengths is not greater than the preset ratio, then the initial brightness value of the image region corresponding to the preset length is determined to conform to the specified monotonic direction.
5. The method according to claim 3, characterized in that, The step of calculating the average level of the brightness values to be corrected at the pixel positions in the image region corresponding to the preset length, to obtain the initial brightness value of the image region corresponding to the preset length, includes: From the image region corresponding to the preset length, determine the image region containing the pixel positions whose brightness value to be corrected is greater than the first preset brightness and less than the second preset brightness, and use it as the effective image region corresponding to the preset length; Based on the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, the average level of the brightness values to be corrected at each pixel position in the image region corresponding to the preset length is calculated to obtain the initial brightness value of the image region corresponding to the preset length.
6. The method according to claim 5, characterized in that, The step of calculating the average level of the brightness values to be corrected at each pixel position in the effective image region corresponding to the preset length, based on the brightness values to be corrected at each pixel position in the image region corresponding to the preset length, to obtain the initial brightness value of the image region corresponding to the preset length includes: For each pixel position in the effective image area corresponding to the preset length, the brightness value interval to which the brightness value to be corrected at the pixel position belongs is determined from multiple consecutive brightness value intervals, and is used as the brightness value interval corresponding to the pixel position. Calculate the average level of the brightness values to be corrected at the pixel positions corresponding to the target brightness value range to obtain the initial brightness value of the image region corresponding to the preset length; wherein, the number of pixel positions corresponding to the target brightness value range is the largest.
7. The method according to claim 2, characterized in that, The step of performing fusion and interpolation processing based on the usable brightness values of image regions in each image to be corrected to obtain a first gain coefficient at each pixel position in each image to be corrected includes: performing interpolation processing based on the usable brightness values of image regions in each image to be corrected, and performing fusion processing according to the confidence level of image regions in each image to be corrected to obtain a first gain coefficient at each pixel position in each image to be corrected; wherein, the confidence level of image regions containing effective pixel positions in each image to be corrected is greater than the confidence level of image regions not containing effective pixel positions. And / or, In each image to be corrected, the brightness value to be corrected at any valid pixel location is greater than the first preset brightness and less than the second preset brightness. And / or, Each image to be corrected is an image of a different part of the object to be observed. After the method obtains a corrected image by increasing the brightness value of the pixel position using the first gain coefficient at each pixel position in the image to be corrected, the method further includes: stitching the corrected images together according to the local positions corresponding to each corrected image to obtain a complete image of the object to be observed.
8. The method according to claim 7, characterized in that, The process of interpolating based on the usable brightness values of image regions in each image to be corrected and fusing based on the confidence levels of image regions in each image to be corrected to obtain a first gain coefficient at each pixel location in each image to be corrected includes: For multiple image regions with the same corresponding pixel position in each image to be corrected, the brightness values of the multiple image regions to be used are fused according to the confidence of the multiple image regions to obtain the fused brightness value corresponding to the multiple image regions. Interpolation is performed on the obtained fused brightness values to obtain the first gain coefficient at each pixel position in each image to be corrected.
9. The method according to claim 8, characterized in that, The interpolation process based on the obtained fused brightness values to obtain the first gain coefficient at each pixel position in each image to be corrected includes: Interpolate the obtained fused brightness values according to the size of each image to be corrected to obtain the estimated brightness value at each pixel position in each image to be corrected; for each pixel position, calculate the ratio of the maximum value among the obtained estimated brightness values to the estimated brightness value at that pixel position, and use it as the first gain coefficient at that pixel position in each image to be corrected. or, For each fused brightness value, the ratio of the maximum value among the calculated fused brightness values to the fused brightness value is used as the region gain coefficient of multiple image regions with the same pixel position corresponding to the fused brightness value; the obtained region gain coefficients are interpolated according to the size of each image to be corrected to obtain the first gain coefficient at each pixel position in each image to be corrected.
10. The method according to claim 8, characterized in that, The process involves fusing the brightness values of multiple image regions with corresponding pixel positions in each image to be corrected, based on the confidence level of these multiple image regions, to obtain a fused brightness value corresponding to the multiple image regions. This includes: For multiple image regions with corresponding pixel positions in each image to be corrected, the brightness values of these multiple image regions are fused according to their confidence levels using a preset formula to obtain the fused brightness values corresponding to these multiple image regions; wherein the preset formula is as follows: ; This represents the fused brightness value corresponding to the multiple image regions. Indicates the number of images to be corrected. This indicates that the multiple image regions belong to the first... Confidence of the image region of the image to be corrected This indicates that the multiple image regions belong to the first... The brightness values to be utilized for the image region of the image to be corrected.
11. The method according to claim 2, characterized in that, Before acquiring the brightness value to be corrected at each pixel location in each image of the object to be observed acquired using a microscope, the method further includes: Acquire a calibration image of a preset calibration plate obtained using the microscope; wherein the calibration image has the same size as any image to be calibrated; Based on the brightness value at each pixel position in the calibration image, the gain coefficient at each pixel position in the calibration image is calculated and used as the second gain coefficient at the corresponding pixel position in each image to be corrected. The step of obtaining the brightness value to be corrected at each pixel position in each image of the object to be observed acquired using a microscope includes: For each image of the object to be observed acquired using a microscope, the original brightness value at each pixel location in the image to be corrected is increased using the second gain coefficient at that pixel location to obtain the brightness value to be corrected at that pixel location in the image to be corrected.
12. The method according to claim 11, characterized in that, The calibration image is an image of different parts of the preset calibration board; The step of calculating the gain coefficient at each pixel location in the calibration image based on the brightness value at each pixel location in the calibration image, and using these coefficients as the second gain coefficients at the corresponding pixel locations in each image to be corrected, includes: For each calibration image, the gain coefficient at each pixel location in the calibration image is calculated based on the brightness value at each pixel location in the calibration image. The gain coefficients at the same pixel location in each calibration image are fused to obtain the second gain coefficient at the corresponding pixel location in each image to be corrected.
13. The method according to claim 11, characterized in that, The center of the vignetting in each image to be corrected is determined by the following steps: For each image to be corrected, the gain coefficient interval to which the second gain coefficient at each pixel position in the image to be corrected belongs is determined from each gain coefficient interval, and is used as the gain coefficient interval corresponding to that pixel position. For each gain coefficient interval, ellipse fitting is performed based on the pixel position corresponding to that gain coefficient interval to obtain the ellipse to be utilized. Based on the center of the ellipse to be used that meets the preset conditions, the vignetting center of the image to be corrected is determined; wherein the difference between the lengths of the major and minor axes of the ellipse to be used that meets the preset conditions is less than a preset difference.
14. The method according to claim 13, characterized in that, The step of determining the vignetting center of the image to be corrected based on the center of the ellipse that meets the preset conditions includes: Based on the centers of the ellipses that meet the preset conditions, a vote is taken to obtain the center of the ellipse with the most votes, which is then used as the vignetting center of the image to be corrected.
15. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 2-14.