Image brightness correction methods, storage media and electronic devices
By generating brightness correction parameters and analyzing sample observation images from image acquisition devices, the problem of uneven brightness during image acquisition was solved, achieving efficient and uniform image brightness correction and improving image quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-01
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies suffer from uneven brightness during image acquisition, resulting in poor image quality. Furthermore, existing correction methods are inefficient and prone to introducing strong light noise.
By analyzing different sample observation images from image acquisition devices, observation sequences and estimation sequences are generated. Based on these sequences, brightness correction parameters are determined and used to perform brightness correction on the images to be corrected, thus achieving a unified and convenient correction process.
It improves the efficiency of image brightness correction, reduces strong light noise, and obtains higher quality corrected images, making it suitable for a variety of image acquisition devices.
Smart Images

Figure CN115578291B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image brightness correction technology, specifically to an image brightness correction method, storage medium, and electronic device. Background Technology
[0002] During the imaging of biological tissues, various external factors can affect the image acquisition equipment's ability to capture images, resulting in significant discrepancies between the acquired observation images and the actual images. For example, the observed images may exhibit uneven brightness. These external factors include, but are not limited to, improper use of the image acquisition equipment, environmental dust, and uneven lighting.
[0003] To address these issues, existing technologies often employ methods such as adjusting shooting parameters and enhancing illumination. However, adjusting shooting parameters requires continuous adjustments as shooting conditions change, while enhancing illumination results in higher noise levels in the observed image due to strong light.
[0004] Therefore, the existing method still has the drawback of low brightness correction efficiency. Summary of the Invention
[0005] This application provides an image brightness correction method, storage medium, and electronic device, which can improve the efficiency of image brightness correction.
[0006] In a first aspect, embodiments of this application provide an image brightness correction method, the method comprising:
[0007] Obtain the image to be corrected that requires brightness correction;
[0008] The brightness correction parameters of the image acquisition device corresponding to the image to be corrected are obtained. The brightness correction parameters are determined based on the observation sequence and the estimation sequence. The observation sequence is obtained by sorting the pixel values of different sample observation images of the corresponding image acquisition device at different pixel positions. The estimation sequence is determined based on the observation sequence and the average image. The average image is obtained based on the average pixel value of the observation sequence at different pixel positions.
[0009] The image to be corrected is processed according to the brightness correction parameters to obtain the corrected image.
[0010] Secondly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, which, when run on a computer, causes the computer to perform an image brightness correction method as provided in any embodiment of this application.
[0011] Thirdly, embodiments of this application also provide an electronic device, including a processor and a memory, the memory having a computer program, and the processor executing a brightness correction method for an image as provided in any embodiment of this application by calling the computer program.
[0012] The technical solution provided in this application obtains an observation sequence and an estimation sequence based on different sample observation images from a corresponding image acquisition device. The observation sequence is obtained by sorting pixel values at different pixel positions in different sample observation images. Then, an average image is obtained based on the average pixel value of the observation sequence at different pixel positions. Finally, an estimation sequence is obtained based on the average image and the observation sequence. After obtaining the observation sequence and the estimation sequence, the brightness correction parameters of the image acquisition device can be obtained based on the mapping relationship between them. These brightness correction parameters characterize the factors affecting uneven brightness caused by the image acquisition device and environmental factors during image acquisition. Subsequently, the brightness correction parameters are used to perform brightness correction processing on the image to be corrected to obtain a corrected image. This application enables unified correction of subsequently acquired images to be corrected using brightness correction parameters, thereby achieving convenient and uniform brightness correction of the images to be corrected. Furthermore, compared to existing technologies, the brightness correction parameters of this application are universally applicable to subsequently acquired images to be corrected, eliminating the need for continuous adjustment of shooting parameters as described in existing technologies, and avoiding high image noise. Therefore, while improving the efficiency of brightness correction of the images to be corrected, a higher quality corrected image can also be obtained. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a schematic diagram illustrating an application scenario of the image brightness correction method provided in the embodiments of this application.
[0015] Figure 2 This is a schematic flowchart of the image brightness correction method provided in the embodiments of this application.
[0016] Figure 3 This is a schematic diagram comparing the image to be corrected and the corrected image in the image brightness correction method provided in the embodiments of this application.
[0017] Figure 4 This is a schematic flowchart illustrating the process of determining brightness correction parameters in the image brightness correction method provided in the embodiments of this application.
[0018] Figure 5 This is a schematic diagram illustrating the determination of the observation sequence based on sample observation images in the image brightness correction method provided in this application embodiment.
[0019] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0020] 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 a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the protection scope of this application.
[0021] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0022] This application provides an image brightness correction method, and the subject executing the image brightness correction method can be the electronic device provided in this application. The electronic device can be a smartphone, foldable phone, tablet computer, PDA, desktop computer, etc., or various image acquisition devices, including but not limited to microscopes, scanners, cameras, camcorders, and webcams.
[0023] To better explain the solutions provided in the embodiments of this application, an application scenario is provided first for explanation. Please refer to [link / reference]. Figure 1 , Figure 1 This diagram illustrates an application scenario of the image brightness correction method provided in this application embodiment. In this diagram, a microscope is used as an electronic device. During the imaging of biological tissues, improper microscope use, uneven light source, or dust in the experimental environment can cause uneven brightness in the resulting biological microscopic image, thus affecting subsequent research on the biological microscopic image.
[0024] Therefore, the solution provided in this application is to analyze the brightness correction parameters of the microscope based on the biological microscopic images acquired in the early stage of the microscope, and then use the brightness correction parameters to perform brightness correction processing on the biological microscopic images acquired in the later stage of the microscope, thereby improving the brightness of the image with uneven brightness and improving the image quality. Moreover, this method has universality and plays a significant role in experimental scenarios and other scenarios that require a large number of image brightness corrections, and can significantly improve the efficiency of image processing.
[0025] Understandably, the microscope used in this application scenario is merely an example and is not intended to limit the application scenario of the solution in this application. The solution in this application can be applied to various scenarios that require brightness correction of the acquired images. In the following embodiments, the solution in this application will be further explained using an electronic device as a microscope.
[0026] There are various types of microscopes, including but not limited to: metallurgical microscopes, biological microscopes, stereomicroscopes, polarizing microscopes, fluorescence microscopes, and stereomicroscopes. Each type of microscope has different applications. For example, light-sheet fluorescence microscopy (LSFM) is a popular imaging method in developmental biology, neuroscience, and pathology research, widely used for rapid and high-resolution imaging of various biomedical sample sections.
[0027] Specifically, please refer to Figure 2 , Figure 2 This is a schematic flowchart of the image brightness correction method provided in this application embodiment. The specific flow of the image brightness correction method provided in this application embodiment can be as follows:
[0028] 110. Obtain the image to be corrected that requires brightness correction.
[0029] The image to be corrected that needs brightness correction can be one or a group of images, which can be acquired by an image acquisition device. The image acquisition device can be the same device or different devices of the same model and shooting environment. The specific implementation method is not limited here.
[0030] For example, after obtaining an image through an image acquisition device, images that need brightness correction can be selected from the images to improve the efficiency of brightness correction.
[0031] 120. Obtain the brightness correction parameters of the image acquisition device corresponding to the image to be corrected. The brightness correction parameters are determined based on the observation sequence and the estimation sequence. The observation sequence is obtained by sorting the pixel values of different sample observation images of the corresponding image acquisition device at different pixel positions. The estimation sequence is determined based on the observation sequence and the average image. The average image is obtained based on the average pixel value of the observation sequence at different pixel positions.
[0032] One approach is to use the brightness correction parameters of another image acquisition device to perform brightness correction on the image to be corrected. For example, if image acquisition device A is used to acquire the image to be corrected, and image acquisition device B is another device of the same model or type as image acquisition device A and used in the same shooting environment, the brightness correction parameters of image acquisition device B can be applied to image acquisition device A to perform brightness correction processing on the image to be corrected acquired by image acquisition device A. Of course, the brightness correction parameters of image acquisition device A can also be used to perform brightness correction processing on the image to be corrected acquired by it; the specific implementation method is not limited here.
[0033] The following describes the solution provided in this application embodiment, taking the brightness correction processing of the acquired image to be corrected by the brightness correction parameters of the image acquisition device A as an example.
[0034] Specifically, the historical images acquired by image acquisition device A are analyzed to obtain the brightness correction parameters of image acquisition device A. These historical images are referred to as sample observation images. In this embodiment, the observation sequence and estimation sequence corresponding to the sample observation images are obtained through analysis.
[0035] For example, the observation sequence is obtained by sorting the pixel values at different pixel positions of different sample observation images. Here, a pixel position can be considered the smallest unit of image dimension. Each sample observation image has a consistent size; if a sample observation image consists of H×W pixels, then there are H×W pixel positions, where H represents the number of pixels in the length direction of the sample observation image, and W represents the number of pixels in the width direction. After sorting the pixel values at different pixel positions of different sample observation images, H×W observation sequences can be obtained.
[0036] The basis for sorting pixel values can be either the size of the pixel value or the brightness value of the pixel. The specific implementation method is not limited here.
[0037] Furthermore, by calculating the pixel mean of the observation sequence at different pixel positions, an average map is constructed using the pixel mean of different pixel positions. Then, an estimated sequence is determined based on the average map and the observation sequence. The observation sequence and the estimated sequence have a correspondence at pixel positions. By analyzing the two, the brightness characteristics at different pixel positions of the image acquisition device can be obtained. These brightness characteristics at different pixel positions are the brightness correction parameters mentioned in the embodiments of this application.
[0038] Furthermore, brightness correction parameters can be used to perform brightness correction processing on the images to be corrected that are acquired by the image acquisition device and require brightness correction, thereby making the brightness of the corrected image uniform and reducing the impact of the image acquisition device or its environmental factors on the brightness of the acquired image.
[0039] 130. Perform brightness correction processing on the image to be corrected according to the brightness correction parameters to obtain the corrected image.
[0040] When performing brightness correction on an image using brightness correction parameters, the correction value can be determined first based on the pixel values at different pixel locations in the image and the brightness correction parameters. Then, the correction value is used to replace the corresponding pixel values at different pixel locations in the image. Alternatively, the pixel values at different pixel locations in the image can be adjusted according to the brightness correction parameters to complete the brightness correction of the image.
[0041] Understandably, image acquisition devices can capture various biological images, such as cell images, brain tissue images, and brain images. These biological images can be two-dimensional or three-dimensional. For details, please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic diagram comparing the image to be corrected and the corrected image in the image brightness correction method provided in the embodiments of this application. Figure 3 (1) A schematic diagram showing the cell image before brightness correction (left) and after brightness correction (right) is displayed. Figure 3 (2) A schematic diagram showing the comparison of brain tissue images before brightness correction (left) and after brightness correction (right). Figure 3 (3) A schematic diagram showing the comparison of two-dimensional brain images before brightness correction (left) and after brightness correction (right). Figure 3 (4) A schematic diagram showing the comparison of three-dimensional brain images before brightness correction (left) and after brightness correction (right).
[0042] As shown in the comparison diagram, it can be seen that after brightness correction processing of various images to be corrected using brightness correction parameters, the brightness of the corrected images is significantly improved, and the brightness distribution is more uniform than before brightness correction, and the image quality is also greatly improved.
[0043] In practice, this application is not limited by the execution order of the described steps. Without causing conflicts, some steps may be performed in other orders or simultaneously.
[0044] The image brightness correction method in this application embodiment analyzes different sample observation images from an image acquisition device to obtain observation and estimation sequences. Based on these sequences, brightness correction parameters for the image acquisition device are determined. These parameters are then used to process subsequently acquired images requiring brightness correction, resulting in corrected images with uniform brightness and high quality. Furthermore, the solution provided in this application embodiment does not rely on other devices for adjusting image acquisition device parameters, nor does it require adjustment of the image acquisition device's shooting parameters. This greatly facilitates brightness correction of images to be corrected. The method is simple, efficient, suitable for simultaneous correction of a large number of images, and offers fast brightness correction processing, significantly improving brightness correction efficiency.
[0045] Based on the methods described in the preceding embodiments, the following examples will provide further detailed explanations.
[0046] In some embodiments, please refer to Figure 4 , Figure 4 This is a flowchart illustrating the process of determining brightness correction parameters in the image brightness correction method provided in this application embodiment. Before obtaining the brightness correction parameters of the image acquisition device corresponding to the image to be corrected, the method further includes:
[0047] 210. Obtain sample observation images from the corresponding image acquisition device.
[0048] The sample observation image can be an image acquired by one image acquisition device or another image acquisition device, as long as the two image acquisition devices are of the same type and the shooting environment is the same.
[0049] The number of sample observation images can be selected based on the actual situation; for example, approximately 2000 sample observation images can be selected for analysis. Alternatively, the number of sample observation images can be selected based on the availability of accurate and effective brightness correction parameters. Or, the required correction precision of the images to be corrected can be considered to select an appropriate number of sample observation images; for example, if lower correction precision is required, a smaller number of sample observation images can be selected, while if higher correction precision is required, a larger number of sample observation images can be selected.
[0050] 220. Sort the pixel values of the sample observation images at different pixel positions to obtain the observation sequence corresponding to different pixel positions.
[0051] In this method, the number of sample observation images is considered to be N, and the pixel positions are H×W. By sorting the pixel values of the sample observation images at different pixel positions, the pixel values of N sample observation images can be sorted at H×W pixel positions to obtain H×W observation sequences, where the number of pixels in each observation sequence is N.
[0052] In this embodiment, the observation sequence is q(x), where x represents the pixel position, x = 1, 2, ..., H×W. Wherein, q(x i )={I o,s(1) (x i ), I o,s(2) (x i ),......,I o,s(N) (x i )},x i I represents the observation sequence at the i-th pixel position. o,s(N) Represents pixel values and their order.
[0053] Specifically, please refer to Figure 5 , Figure 5 This is a schematic diagram illustrating the determination of an observation sequence based on sample observation images in the image brightness correction method provided in this application embodiment. The left side of the diagram shows N sample observation images, where the position of a pixel in each sample observation image is H×W. Taking one pixel position as an example, the pixel at that position is represented by a black rectangle in all N sample observation images. There are N black rectangles in the N sample observation images. By sorting the pixel values of the pixels indicated by the N black rectangles, the observation sequence corresponding to that pixel position is obtained.
[0054] 230. Obtain the average image based on the observation sequence, and determine the target pixel position where the difference between the pixel value and the pixel mean in the average image is within a preset range.
[0055] Here, if the real image corresponding to the observed image is denoted as Q... *Therefore, the set of pixels in the true image should be N×H×W, which is the same as the set of pixels in the observed image. That is, the true sequence of the true image is as follows:
[0056] Q * (x i )={I t,s(1) (x i ), I t,s(2) (x i ), ..., I t,s(N) (x i )};
[0057] In this case, the order of the same pixel in the observed sequence and the actual sequence is the same. Therefore, the following relationship exists (1):
[0058] Q * (x1)=Q * (x2) = ... = Q * (x H×W )=Q * (1);
[0059] The following relationship exists between the observed sequence of the observed images and the real sequence of the real images (2):
[0060] q(x)=v(x)Q * +z(x) (2);
[0061] Where x∈1,…,H×W. The true sequence is a hypothetical sequence.
[0062] For example, an average map is obtained by calculating the pixel mean of the observed sequence q(x), where the average map is expressed in terms of m... q () indicates that the average image has H×W pixels.
[0063] In this embodiment, a preset range can be predetermined to determine the target pixel position by identifying the pixel positions in the average image that fall within the preset range. The preset range can be set according to actual needs.
[0064] In another embodiment, the pixel position corresponding to the pixel value whose difference falls within the preset range can also be determined as the target pixel position based on the difference between the average pixel value of the average image and the pixel value of each pixel in the average image.
[0065] Specifically, by analyzing the average graph m q () Calculate the average value average The target pixel position is determined from the pixel positions using the average value as a filtering criterion. The preset range is determined by the preset threshold v, and is expressed by the following expression (3):
[0066]
[0067] in, This indicates a preset range. If the absolute value of the difference between a pixel value in the average image and the pixel mean is less than the preset threshold v, then the pixel value is considered to fall within the preset range.
[0068] 240. Select the target observation sequence from the observation sequence based on the target pixel position, and determine the estimated sequence based on the target observation sequence.
[0069] Here, the set of pixels at the target pixel location is denoted as The target observation sequence corresponding to different target pixel positions is denoted as q(m). Considering The larger the value, the more likely the estimated sequence Q will be too large or too small, which in turn will cause the brightness correction parameter to be too large or too small. Therefore, by... Limiting the parameters to a suitable range improves the accuracy of the correction parameters. The estimated sequence can be obtained through the following expression (4):
[0070]
[0071] Where Q represents the estimated sequence and R represents the number of pixels in the pixel set.
[0072] 250. Determine the functional relationship between the observed sequence and the estimated sequence.
[0073] The following relationship exists between the true sequence and the estimated sequence (5):
[0074] Q * =QZ Q (5);
[0075] Among them, Q * Let Z represent the true sequence, Q represent the estimated sequence, and Z represent the true sequence. Q This represents the base intensity of the sample observation image acquired in the absence of a light source; it is a constant.
[0076] Based on the relationship between the real sequence and the observed sequence (2) and the relationship between the real sequence and the estimated sequence (5), the functional relationship between the observed sequence and the estimated sequence (6) can be obtained.
[0077] The derivation process is as follows:
[0078] According to expression (2): q(x)=v(x)Q * +z(x)
[0079] According to expression (5): = v(x)Q+z(x)-v(x)Z Q
[0080] = v(x)Q + b(x)
[0081] Where b(x) = z(x) - v(x)Z Q ;
[0082] Furthermore, the functional relationship between the observed sequence and the estimated sequence can be derived, where the brightness correction parameters include multiplicative correction parameters and additive correction parameters, and the functional relationship (6) is as follows:
[0083] q(x)=v(x)Q+b(x) (6);
[0084] Where x represents the pixel position, q(x) represents the observation sequence, Q represents the estimated sequence, v(x) represents the multiplicative correction parameter, z(x) represents the additive correction parameter, and Z... Q This represents the base intensity of the sample observation image collected in the absence of a light source.
[0085] 260. Based on the observation sequence, the estimated sequence, and the functional relationship, the brightness correction parameters are obtained.
[0086] Specifically, the brightness correction parameters can be obtained by solving the functional relationship through the observation sequence and the estimated sequence. The terms of the brightness correction parameters can be determined according to the functional relationship. If the functional relationship is linear, the brightness correction parameter has one term. If the functional relationship is nonlinear, the brightness correction parameter includes at least two terms.
[0087] In some embodiments, acquiring sample observation images from a corresponding image acquisition device includes:
[0088] 211. Obtain a first biological microscopic image with a biological tissue ratio greater than a preset ratio.
[0089] 212. Obtain a second biological microscopic image that does not contain biological tissue.
[0090] 213. Obtain sample observation images based on the first biological microscopic image and the second biological microscopic image.
[0091] In this embodiment, the sample observation image is a biological microscopic image. After acquiring historical images from the image acquisition device, these images can be filtered to select those that meet the criteria for use as sample observation images. The filtering method is as follows:
[0092] First, select the first biological microscopic image with a high proportion of biological tissue from historical images, and the second biological microscopic image that does not contain biological tissue.
[0093] Furthermore, the number of first and second biological microscopic images can be set; for example, approximately 2000 first biological microscopic images and fewer than 50 second biological microscopic images can be selected. These selected first and second biological microscopic images are then referred to as sample observation images.
[0094] For example, the size of the sample observation images is also set so that each sample observation image has the same size. Additionally, the sample observation images can also be grayscale images, which can improve the accuracy of subsequent analysis processes. If the sample observation image is a color image, it can be converted to grayscale through grayscale processing.
[0095] In some embodiments, acquiring a first biological microscopic image in which the proportion of biological tissue is greater than a preset proportion includes:
[0096] Acquire candidate biological microscopic images, including biological tissues;
[0097] Select target biological microscopic images from candidate biological microscopic images, where the average pixel value of different image regions is greater than their respective preset pixel values;
[0098] The target biological microscopic image was identified as the first biological microscopic image.
[0099] In this embodiment, candidate biological microscopic images containing biological tissues can also be screened to obtain a first biological microscopic image.
[0100] Specifically, a preset pixel value can be set for different image regions. The preset pixel values for different image regions can be the same or different, and there is no limitation here. For each candidate biological microscopic image, the average pixel value of each image region in the candidate biological microscopic image is compared with its corresponding preset pixel value. If the average pixel value of all image regions in the candidate biological microscopic image is greater than their respective preset pixel values, then the candidate biological microscopic image is taken as the target biological microscopic image.
[0101] For example, a candidate biological microscopic image can be divided into nine image regions. If the average pixel value of all nine regions is greater than their corresponding preset pixel value, then the content of the nine image regions is considered complete. This method increases robustness, making the subsequent brightness correction parameters more accurate. The preset pixel value can be a specific numerical value or a range of values. For example, the preset pixel value can be selected from the range of 300 to 2000, or 300 can be set as the preset pixel value. Alternatively, a value can be selected from the range of 300 to 2000 as the preset pixel value.
[0102] Understandably, the number of target biological microscopic images selected, as mentioned in the above embodiments, can be pre-selected from a large number of historical microscopic images.
[0103] In some embodiments, determining the target biological microscopic image as the first biological microscopic image includes:
[0104] The region to be processed is determined from the target biological microscopic image based on a preset intensity threshold;
[0105] Determine the associated pixels in the region to be processed;
[0106] Interpolation is performed on the pixels in the area to be processed based on the associated pixels to obtain the processed target biological microscopic image;
[0107] The processed target biological microscopic image was identified as the first biological microscopic image.
[0108] In this embodiment, the intensity of the target biological microscopic image is processed, and the processed target biological microscopic image is then used as the first biological microscopic image.
[0109] First, by setting an intensity threshold, when there is a target pixel in the target biological microscopic image with a pixel value greater than the intensity threshold, the position of the target pixel in the target biological microscopic image is called the region to be processed, where the region to be processed contains multiple target pixels.
[0110] The area to be processed represents the part with higher intensity in the target biological microscopic image. This part has been stained with cells, indicating that its intensity is higher than other parts. Therefore, in this embodiment, the part with higher intensity value is selected by means of the area to be processed, so that the intensity of this part is processed to make its intensity comparable to other parts. This avoids the error when using the first biological microscopic image to obtain the brightness correction parameters, and can improve the correction effect when using the brightness correction parameters to correct the brightness of the image to be corrected, so that the brightness uniformity of the image to be corrected is significantly improved.
[0111] For example, a region can also be set to determine the associated pixels of the region to be processed when the region to be processed is larger than a preset region. Specifically, by determining the area of the region to be processed enclosed by the target pixels, it is possible to determine whether there is a high-intensity cluster of cells in the target biological microscopic image. If so, the intensity of the pixels in that region to be processed is then adjusted.
[0112] In this context, associated pixels refer to pixels located outside the area to be processed. When selecting associated pixels, pixels on the outline of the area to be processed can also be selected. Alternatively, a larger area can be selected outward from the area to be processed, and pixels outside the area to be processed within this larger area can be used as associated pixels; that is, associated pixels do not include pixels within the area to be processed.
[0113] There are several ways to interpolate pixels in the region to be processed based on associated pixels. For example, you can use the image inpaint function in OpenCV (a cross-platform computer vision and machine learning software library released under the Apache 2.0 license) for interpolation.
[0114] As an example, interpolation optimization can be performed based on the intensity of pixels in the region to be processed, using associated pixels. Alternatively, the intensity of pixels in the region to be processed can be reduced based on the intensity of associated pixels.
[0115] As another example, the content portion of the area to be processed can be segmented out to preserve the binary mask of the area to be processed, and then the area to be processed can be filled with pixels based on the associated pixels through image inpainting.
[0116] In some embodiments, the brightness correction parameters are obtained by solving based on the observation sequence, the estimated sequence, and the functional relationship, including:
[0117] Based on the observation sequence, the estimated sequence, and the functional relationship, the brightness correction parameters are obtained by minimizing the fitting loss function.
[0118] For example, the fitting loss function is as follows (7):
[0119]
[0120] Among them, E f This represents the fitting loss function, where ω represents the fitting width of the Cauchy distribution. The set represents the pixel positions, and n represents the number of sequences.
[0121] In this embodiment, considering the linear correlation between the estimated sequence Q and the observed sequence q(x), the relationship parameters between the estimated sequence Q and the observed sequence q(x) can be determined by overrode regression, where the relationship parameters are v(x) and b(x).
[0122] Based on this, to enhance robustness to outliers during the optimization process, the Cauchy function is applied to optimize the function value, whereby... This represents the Cauchy function.
[0123] For each pair of observed and estimated sequences, a function value is obtained by solving the functional relationship. Multiple pairs of observed and estimated sequences correspond to multiple function values. These function values are fitted using a fitting loss function to obtain the brightness correction parameters. When fitting using the fitting loss function, the optimal solution can be obtained based on the gradient descent algorithm to best fit each function value. This optimal solution is the brightness correction parameter.
[0124] In some embodiments, the brightness correction parameters are obtained by solving for the observed sequence, the estimated sequence, and the functional relationship, with the constraint of minimizing the fitting loss function, including:
[0125] Based on the observation sequence, the estimated sequence, and the functional relationship, the brightness correction parameters are obtained by minimizing the fitting loss function and the preset optimization loss function as constraints.
[0126] In this embodiment, in addition to using the fitting loss function, at least one preset optimization loss function can be used to solve for the brightness correction parameters.
[0127] The preset optimization loss function includes at least one of the following: regularization loss function, base intensity loss function without light source, and barrier loss function.
[0128] For example, the regularization loss function is as follows (8):
[0129]
[0130] Among them, E r Let v(i,j) represent the regularization loss function, and v(i,j) represent the value of v(x) at position (i,j). Let T ∈ {t1, t2, ..., t} be the Gaussian Laplace operator. T} represents the scale set that we want to check for non-smoothness, and * represents two-dimensional convolution.
[0131] In this embodiment, by using a regularized loss function, the impact of noise on image quality can be reduced, thus ensuring the smoothness of the multiplicative correction parameter v(x). Specifically, by applying a Laplace-Gaussian filter to the multiplicative correction parameter v(x), rapidly changing regions are identified, and the value in those regions is minimized.
[0132] For example, the intensity loss function for a base without a light source is as follows (9):
[0133]
[0134] Among them, E z Z represents the intensity loss function of the base without a light source. q Let z(x) represent the point without a light source, and z(x) represent the intensity value.Q Z q () represents the coordinates of a point without a light source.
[0135] In this embodiment, considering that the intensity value z(x) of the sample observation image acquired by the image acquisition device is the same in the absence of a light source, this embodiment sets a point Z without a light source. q This minimizes the loss value between the point without a light source and z(x), thereby reducing the influence of image acquisition equipment or noise on z(x).
[0136] For example, the barrier loss function is as follows (10):
[0137] E b =β(Z) Q )+β(Z q (10),
[0138]
[0139] Among them, E b Z represents the barrier loss function. Q Z q ∈[0, min(q(x))], α1=0, α2=min(q(x)), w is a custom width setting.
[0140] In this embodiment, the intensity value of the point without a light source is limited to a range using formula (11), namely Z. Q Z q ∈[0, min(q(x))], and then define the barrier loss function.
[0141] In some embodiments, the fitting loss function E can also be used simultaneously. f Regularization loss function E r The intensity loss function E of the foundation without light source z and barrier loss function E b .
[0142] When using the four loss functions mentioned in the above embodiments simultaneously, the total loss function can be represented by the following expression (12):
[0143] E = E f +λ r E r +λ z E z +λ b E b (12);
[0144] Where E represents the total loss function, λ r Describes the regularization loss function E rThe weight, λ z The intensity loss function E of the base without light source z The weight, λ b The barrier loss function E b The weights. Where, λ r , λ z , λ b It can be set to a custom value. For example, you can set λ. r =6,λ z =0.5, λ b =10 6 No restrictions are imposed here.
[0145] For example, Newton's method (L-BFGS) can also be used to minimize the loss function E. That is... To obtain v(x), b(x), Z Q Z q Four parameters, according to z(x)=b(x)+v(x)Z Q We obtain the parameter z(x) to get the brightness correction parameters v(x) and z(x).
[0146] In some embodiments, a brightness correction process is performed on the image to be corrected according to brightness correction parameters to obtain a corrected image, including:
[0147] Based on the brightness correction parameters, the image to be corrected is processed according to the brightness correction formula to obtain the corrected image;
[0148] The brightness correction formula (13) is as follows:
[0149]
[0150] Among them, Image t (x) represents the corrected image. Image o (x) represents the image to be corrected, v(x) represents the multiplicative correction parameter, z(x) represents the additive correction parameter, and x represents the pixel position.
[0151] In this embodiment, the brightness value or pixel value at each pixel location can be corrected according to the additive and multiplicative correction parameters, thereby obtaining the corrected image.
[0152] For example, the brightness of some pixels in the image to be corrected can also be selectively corrected. For instance, only pixels containing biological tissue content can be processed, while background content can be left unprocessed, thereby improving processing efficiency.
[0153] In the process of brightness correction of the image to be corrected, if the size of the image to be corrected is inconsistent with that of the sample observation image, the image to be corrected can be adjusted according to the size of the sample observation image, with the image center as the reference. Alternatively, when acquiring the image to be corrected, an image of the same size as the sample observation image can be directly acquired.
[0154] Alternatively, the image to be corrected can be processed in grayscale before brightness correction.
[0155] Furthermore, after obtaining the corrected image, further resolution optimization and filtering can be performed on the corrected image to improve its quality. Specific implementation methods will not be listed here.
[0156] In some embodiments, a brightness correction process is performed on the image to be corrected according to brightness correction parameters to obtain a corrected image, including:
[0157] Based on the brightness correction parameters, the image to be corrected is processed according to the brightness correction formula to obtain the corrected image;
[0158] The brightness correction formula (14) is as follows:
[0159]
[0160] Among them, Image t (x) represents the corrected image. Image o Let v(x) represent the image to be corrected, v(x) represent the multiplicative correction parameter, z(x) represent the additive correction parameter, and x represent the pixel position. This represents the average value of the multiplicative correction parameter. This represents the average value of the additive correction parameter.
[0161] This embodiment also provides another method for correcting the image to be corrected. Specifically, based on the above embodiments, it further reduces the difference in the average pixel value between the image to be corrected and the sample observation image to perform brightness correction. This results in a more uniform brightness distribution in the corrected image, significantly improving the efficiency of brightness correction.
[0162] In some embodiments, after obtaining the corrected image, the corrected image can be stored in a specified location, such as a computer, computer cluster, server, or cloud server. It can then be retrieved during subsequent operations such as neural tracking, cell segmentation, and 3D imaging.
[0163] To better understand the image brightness correction method provided in the embodiments of this application, the solution of this application will be described in detail below, using a light-sheet fluorescence microscope as the implementation subject, as follows:
[0164] 1. Biological microscopic images are acquired by beam scanning method of light-sheet fluorescence microscopy, wherein the biological microscopic images are grayscale images and are uniform in size.
[0165] 2. Select a first biological microscopic image from the biological microscopic images in which the proportion of biological tissue is greater than a preset proportion, and select a second biological microscopic image that does not contain biological tissue. Specifically, preset pixel values can be set for the distribution of different image regions. Candidate biological microscopic images containing biological tissue whose average pixel value for different image regions is greater than their respective preset pixel values are retained as target biological microscopic images, while the rest are discarded. The selected target biological microscopic images contain more than 2000 biological tissue images and do not contain more than 50 biological tissue images.
[0166] 3. Preprocessing: Considering that some cells in biological tissues have high intensity values after staining, they need to be processed. Specifically, by setting a preset intensity threshold, regions with intensity values greater than the preset threshold are identified from the target biological microscopic image. Then, the image content in the regions to be processed is segmented, and the binary mask of the regions to be processed is preserved. Subsequently, image inpainting is used to fill the image with pixel information near the regions to be processed to obtain the first biological microscopic image. The first biological microscopic image and the second biological microscopic image constitute the sample observation image.
[0167] 4. Based on the optical characteristics of light-sheet fluorescence microscopy, assume the true image I... t The illumination was uniform, and the sample observation image I obtained by photography was... o The relationship (14) for (uneven illumination) is as follows:
[0168] I o (x)=I t (x)v(x)+z(x) (14);
[0169] Where v(x) is the multiplicative parameter, z(x) is the additive parameter, and x is the pixel position.
[0170] 5. Set the number of sample observation images to N, and the size of the sample observation images to H×W, with height H and width W. Sort the pixels along the N dimension to obtain an observation sequence of H×W pixels arranged from smallest to largest, denoted as q(x).
[0171] 6. Based on relation (14), determine the observation sequence q(x) of the observed image and the true sequence Q of the true image.* The relationship between the two equations is (2): q(x) = v(x)Q * +z(x).
[0172] 7. Calculate the average value of the observed sequence along the N dimension to obtain an average plot m of size H×W. q (x), and record all that fall on (x). The target pixel locations within the range, and the set of target pixel locations is denoted as . The estimated sequence can be obtained as shown in equation (4): Wherein, the true sequence Q * There is a relationship (5) between Q and the estimated sequence Q: * =QZ Q .
[0173] 8. Subsequently, the functional relationship (6) between the observed sequence q(x) and the estimated sequence Q can be obtained:
[0174] q(x)=v(x)Q * +z(x)=v(x)Q+z(x)-v(x)Z Q =v(x)Q+b(x), where b(x)=z(x)-v(x)Z Q .
[0175] 9. Construct the loss function, which includes: the fitting loss function E. f Regularization loss function E r The intensity loss function E of the foundation without light source z and barrier loss function E b Based on each loss function, the total loss function E = Et is obtained. f +λ r E r +λ z E z +λ b E b .
[0176] 10. Use Newton's method to minimize the loss function E to obtain v(x), b(x), and Z. Q Z q Four parameters, according to z(x)=b(x)+v(x)Z Q We obtain the parameter z(x) to get the brightness correction parameters v(x) and z(x).
[0177] 11. Using the brightness correction parameters v(x) and z(x) obtained in step 10, apply them to all images to be corrected acquired by light-sheet fluorescence microscopy. o (x) Perform brightness correction processing, and the correction formula is as shown in formula (13):
[0178]
[0179] 12. Using the brightness correction parameters v(x) and z(x) obtained in step 10, apply them to all images to be corrected acquired by light-sheet fluorescence microscopy. o (x) Perform brightness correction processing, and the correction formula is as shown in formula (14): This aims to reduce the difference between the pixel mean of the image to be corrected and the sample observation image.
[0180] 13. Upload and store the corrected image. The storage location can be local storage or cloud storage.
[0181] As can be seen from the above, the image brightness correction method proposed in this embodiment of the invention can obtain sample observation images by performing content filtering and intensity optimization processing on historical microscopic images acquired by the image acquisition device. Then, based on the sample observation images, observation sequences and estimation sequences are obtained. By solving the observation sequences, estimation sequences, and functional relationships, the obtained brightness correction parameters can accurately and quickly perform brightness correction processing on the image to be corrected. Furthermore, this embodiment also employs a loss function as a constraint condition to obtain the optimal brightness correction parameters, avoiding outliers and noise in the corrected image, thereby improving the quality of the corrected image.
[0182] This application also provides an electronic device, which can be a smartphone, foldable phone, tablet computer, PDA, desktop computer, etc., and can also be various image acquisition devices, including but not limited to: microscopes, scanners, cameras, camcorders, webcams, etc. Figure 6 As shown, Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 300 includes a processor 310 with one or more processing cores, a memory 320 with one or more computer-readable storage media, and a computer program stored in the memory 320 and executable on the processor. The processor 310 is electrically connected to the memory 320. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0183] The processor 310 is the control center of the electronic device 300. It connects various parts of the electronic device 300 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 320, and calling data stored in the memory 320, it performs various functions of the electronic device 300 and processes data, thereby monitoring the electronic device 300 as a whole.
[0184] In this embodiment, the processor 310 in the electronic device 300 loads the instructions corresponding to the processes of one or more applications into the memory 320 according to the following steps, and the processor 310 runs the applications stored in the memory 320 to achieve various functions:
[0185] Obtain the image to be corrected that requires brightness correction;
[0186] The brightness correction parameters of the image acquisition device corresponding to the image to be corrected are obtained. The brightness correction parameters are determined based on the observation sequence and the estimation sequence. The observation sequence is obtained by sorting the pixel values of different sample observation images of the corresponding image acquisition device at different pixel positions. The estimation sequence is determined based on the observation sequence and the average image. The average image is obtained based on the average pixel value of the observation sequence at different pixel positions.
[0187] The image to be corrected is processed according to the brightness correction parameters to obtain the corrected image.
[0188] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0189] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0190] As can be seen from the above, the electronic device provided in this embodiment can obtain sample observation images by performing content filtering and intensity optimization processing on historical microscopic images acquired by the image acquisition device. Then, based on the sample observation images, observation sequences and estimation sequences are obtained. By solving the observation sequences, estimation sequences, and functional relationships, the obtained brightness correction parameters can accurately and quickly perform brightness correction processing on the image to be corrected. Furthermore, this embodiment also uses a loss function as a constraint condition to obtain the optimal brightness correction parameters, avoiding outliers and noise in the corrected image, thereby improving the quality of the corrected image.
[0191] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0192] Therefore, this application provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it includes the following steps:
[0193] Obtain the image to be corrected that requires brightness correction;
[0194] The brightness correction parameters of the image acquisition device corresponding to the image to be corrected are obtained. The brightness correction parameters are determined based on the observation sequence and the estimation sequence. The observation sequence is obtained by sorting the pixel values of different sample observation images of the corresponding image acquisition device at different pixel positions. The estimation sequence is determined based on the observation sequence and the average image. The average image is obtained based on the average pixel value of the observation sequence at different pixel positions.
[0195] The image to be corrected is processed according to the brightness correction parameters to obtain the corrected image.
[0196] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0197] The aforementioned storage medium can be ROM / RAM, magnetic disk, optical disk, etc. Since the computer program stored in the storage medium can execute the steps of any of the image brightness correction methods provided in the embodiments of this application, the beneficial effects achievable by any of the image brightness correction methods provided in the embodiments of this application can be realized. See the preceding embodiments for details, which will not be repeated here.
[0198] The above provides a detailed description of an image brightness correction method, medium, and electronic device provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for image brightness correction, characterized in that, The method includes: Obtain the image to be corrected that requires brightness correction; Obtain the brightness correction parameters of the image acquisition device corresponding to the image to be corrected, wherein the brightness correction parameters are determined based on the observation sequence and the estimation sequence, the observation sequence is obtained by sorting the pixel values of different sample observation images corresponding to the image acquisition device at different pixel positions, the estimation sequence is determined based on the observation sequence and the average map, and the average map is obtained based on the average pixel value of the observation sequence at different pixel positions; The image to be corrected is subjected to brightness correction processing according to the brightness correction parameters to obtain the corrected image; Before obtaining the brightness correction parameters of the image acquisition device corresponding to the image to be corrected, the method further includes: Acquire the sample observation image corresponding to the image acquisition device; The sample observation images are sorted by pixel values at different pixel locations to obtain observation sequences corresponding to different pixel locations; The average image is obtained based on the observation sequence, and the location of the target pixel whose difference between the pixel value and the pixel mean in the average image is within a preset range is determined. The target observation sequence is selected from the observation sequence based on the target pixel position, and the estimated sequence is determined based on the target observation sequence; Determine the functional relationship between the observed sequence and the estimated sequence; The brightness correction parameters are obtained by solving based on the observation sequence, the estimated sequence, and the functional relationship.
2. The method according to claim 1, characterized in that, The brightness correction parameters include multiplicative correction parameters and additive correction parameters, and the functional relationship is as follows: , ; in, Indicates pixel position, Represents the observation sequence. Represents the estimated sequence. Indicates the multiplicative correction parameter. Indicates the additive correction parameter. This represents the base intensity of the sample observation image collected in the absence of a light source.
3. The method according to claim 2, characterized in that, The step of solving for the brightness correction parameters based on the observation sequence, the estimated sequence, and the functional relationship includes: Based on the observed sequence, the estimated sequence, and the functional relationship, the brightness correction parameters are obtained by minimizing the fitting loss function.
4. The method according to claim 3, characterized in that, The fitting loss function is as follows: ; in, Let ω represent the fitting loss function, and let ω represent the fitting width of the Cauchy distribution. The set represents the pixel positions, and n represents the number of sequences.
5. The method according to claim 4, characterized in that, The step of solving for the brightness correction parameters based on the observed sequence, the estimated sequence, and the functional relationship, with minimizing the fitting loss function as a constraint, includes: Based on the observation sequence, the estimated sequence, and the functional relationship, and with the constraint of minimizing the fitting loss function and the preset optimization loss function, the brightness correction parameters are obtained. The preset optimization loss function includes at least one of the following: regularization loss function, base intensity loss function without light source, and barrier loss function.
6. The method according to claim 5, characterized in that, The regularization loss function is as follows: ; in, This represents the regularization loss function. express In position The value on, This represents the Gaussian Laplace operator. This represents the scale set from which we want to detect non-smoothness; * indicates two-dimensional convolution. The intensity loss function for the base without light source is as follows: ; in, This represents the intensity loss function of the base without a light source. Indicates a point without a light source. Indicates the strength value. Indicates the coordinates of a point without a light source; The barrier loss function is as follows: , ; in, This represents the barrier loss function. , w is the width that is set by the user.
7. The method according to claim 1, characterized in that, The sample observation image is a biological microscopic image; acquiring the sample observation image corresponding to the image acquisition device includes: Acquire a first biological microscopic image with a biological tissue proportion greater than a preset proportion; Acquire a second biological microscopic image that does not contain biological tissue; The sample observation image is obtained based on the first biological microscopic image and the second biological microscopic image.
8. The method according to claim 7, characterized in that, The acquisition of a first biological microscopic image with a biological tissue proportion greater than a preset proportion includes: Acquire candidate biological microscopic images, including biological tissues; Select target biological microscopic images from the candidate biological microscopic images, where the average pixel value of different image regions is greater than their respective preset pixel values; The target biological microscopic image is identified as the first biological microscopic image.
9. The method according to claim 8, characterized in that, The step of identifying the target biological microscopic image as the first biological microscopic image includes: The region to be processed is determined from the target biological microscopic image based on a preset intensity threshold; Determine the associated pixels of the region to be processed; Interpolation processing is performed on the pixels in the region to be processed based on the associated pixels to obtain the processed target biological microscopic image; The processed target biological microscopic image is identified as the first biological microscopic image.
10. The method according to any one of claims 1 to 9, characterized in that, The brightness correction parameters include multiplicative and additive correction parameters for different pixel positions; the step of performing brightness correction processing on the image to be corrected according to the brightness correction parameters to obtain the corrected image includes: Based on the brightness correction parameters, the image to be corrected is subjected to brightness correction processing according to the brightness correction formula to obtain the corrected image; The brightness correction formula is as follows: ; in, This indicates the corrected image. Indicates the image to be corrected. Indicates the multiplicative correction parameter. Indicates the additive correction parameter. Indicates the pixel position.
11. The method according to any one of claims 1 to 9, characterized in that, The brightness correction parameters include multiplicative and additive correction parameters for different pixel positions; the step of performing brightness correction processing on the image to be corrected according to the brightness correction parameters to obtain the corrected image includes: Based on the brightness correction parameters, the image to be corrected is subjected to brightness correction processing according to the brightness correction formula to obtain the corrected image; The brightness correction formula is as follows: ; in, This indicates the corrected image. Indicates the image to be corrected. Indicates the multiplicative correction parameter. Indicates the additive correction parameter. Indicates pixel position, This represents the average value of the multiplicative correction parameter. This represents the average value of the additive correction parameter.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is run on a computer, it causes the computer to perform the image brightness correction method as described in any one of claims 1 to 11.
13. An electronic device comprising a processor and a memory, the memory storing a computer program, characterized in that, The processor invokes the computer program to execute the image brightness correction method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Pixel brightness calibration method and device for panoramic image, panoramic camera and memory medium
CN109361855A
Method and apparatus for adjusting image luminance, storage medium, and electronic device
US20210295801A1