A processing method for hysteroscopic images
Through the comprehensive processing method of adaptive median filtering, kernel density multi-scale enhancement and nonlinear gain module, the problems of noise and edge blur in hysteroscopic images are solved, efficient image clarity improvement and diagnostic assistance are achieved, and the intelligent level of hysteroscopic diagnosis and treatment is improved.
Patent Information
- Application Number
- CN202510961584.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-07-14
AI Technical Summary
Existing hysteroscopic image analysis methods have difficulty achieving stability and real-time performance when dealing with problems such as blurred tissue details, drastic lighting changes, and unclear biological tissue boundaries, which affects doctors' diagnostic efficiency and treatment accuracy.
A comprehensive processing method of adaptive median filtering, kernel density multi-scale enhancement and nonlinear gain module is adopted to construct a hierarchical enhancement fusion model for hysteroscopic images. Adaptive median filtering is used to remove noise, kernel density multi-scale enhancement is used to restore structural information, and a nonlinear gain strategy is used to optimize image brightness, improve image clarity and contrast.
It significantly improves the visual quality and clinical readability of hysteroscopic images, provides a reliable basis for auxiliary diagnosis, improves the intelligence level and diagnostic efficiency of hysteroscopic diagnosis and treatment, and ensures patient safety.
Smart Images

Figure CN120451173B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image enhancement, and in particular relates to a processing method for hysteroscopic images. Background Art
[0002] Traditional hysteroscopic image analysis mainly relies on manual observation and subjective judgment of doctors. This method is not only time-consuming and labor-intensive, but also difficult to ensure stability and real-time performance when processing large amounts of surgical videos or image data. In recent years, with the continuous development of image acquisition equipment and computer vision technology, high-definition hysteroscopic image acquisition systems combined with image processing algorithms have enabled auxiliary identification and analysis of intrauterine structures and lesions. However, existing methods still face significant limitations when dealing with common problems in hysteroscopic images, such as blurred tissue details, strong lighting changes, and unclear boundaries of biological tissues.
[0003] With the widespread application of hysteroscopic technology in gynecological diagnosis and treatment, the information contained in uterine cavity images has become increasingly complex. Although high-resolution camera systems can obtain rich image data, due to interference factors such as changes in viewing angle, unstable lighting, and tissue activity during surgery, the images are often accompanied by significant noise, insufficient contrast, and blurred edges, making it difficult to identify key lesion areas, which in turn affects the doctor's judgment and diagnostic efficiency. This not only reduces the accuracy of diagnosis and treatment, but may also delay the discovery of lesions, increase the patient's surgical risk, and affect the treatment effect and the effective use of medical resources.
[0004] By applying the comprehensive method based on image enhancement and nonlinear processing proposed in the present invention to hysteroscopic images, noise can be effectively suppressed, edge details can be enhanced, and image brightness performance can be optimized, thereby more clearly presenting the internal tissue structure and potential lesion status of the uterine cavity. This method not only significantly improves the visual quality and clinical readability of the image, but also provides doctors with a more reliable auxiliary diagnosis basis, facilitates real-time analysis during surgery, postoperative image archiving and pathological evaluation, and is of great significance to improving the intelligent level of hysteroscopic diagnosis and treatment, ensuring patient safety, and promoting the application and development of medical image processing technology. Summary of the Invention
[0005] The present invention provides a processing method for hysteroscopic images, which aims to improve the contrast, lighting conditions and clarity of original hysteroscopic images and enhance image resolution, so as to facilitate more accurate and efficient identification of tissue structures and potential lesion areas in the uterine cavity, and provide reliable visual support and technical guarantee for the clinical diagnosis and treatment of hysteroscopic images.
[0006] The present invention aims to propose a layered enhancement fusion model for hysteroscopic images and provide a processing method for hysteroscopic images, comprising the following steps:
[0007] S1, collecting original hysteroscopic data and generating a hysteroscopic image dataset;
[0008] S2. Introducing a parameter matrix and constructing an adaptive median filter module. The hysteroscopic image passes through the adaptive median filter module to generate a denoised hysteroscopic image.
[0009] S3. By introducing Gaussian kernel dynamic bandwidth parameters and multi-scale kernel calculation, a kernel density multi-scale enhancement module is constructed, and the denoised hysteroscopic image is processed by the kernel density multi-scale enhancement module to generate an enhanced hysteroscopic image;
[0010] S4, designing an adaptive gain intensity coefficient and incorporating it into a nonlinear statistical gain strategy to construct a nonlinear gain module, and passing the enhanced hysteroscopic image through the nonlinear gain module to obtain a final enhanced hysteroscopic image;
[0011] S5, integrated the adaptive median filter module, kernel density multi-scale enhancement module and nonlinear gain module to build a hierarchical enhancement fusion model for hysteroscopic images;
[0012] S6. Input the hysteroscopic image into the hysteroscopic image layered enhancement fusion model for image enhancement, and output a high-resolution hysteroscopic image.
[0013] Preferably, in S1, the hysteroscopic image data set is constructed by first collecting uterine cavity image data under different angles and lighting conditions through a hysteroscopic device, then constructing a clear subset, and finally processing it into a unified PNG format of 512×512 pixels.
[0014] Hysteroscopic images are characterized by delicate tissue structure, complex texture distribution, and uneven illumination. They are often accompanied by interference factors such as blood, secretions, and lens stains. This leads to a large amount of unstructured noise and local brightness fluctuations in the image, seriously affecting the accuracy of subsequent image enhancement and lesion identification. Traditional fixed-parameter median filtering often struggles to strike a good balance between noise suppression and detail preservation when processing such images, and is prone to edge blurring and structural distortion.
[0015] Preferably, in S2, constructing the adaptive median filter module specifically includes the following steps:
[0016] Step S21: Calculate the local neighborhood variance for each pixel value in the hysteroscopic image. The specific calculation formula is:
[0017] ;
[0018] in, Expressed as the mean of the local neighborhood, Represented as each pixel position in the image, is represented as the window size of the local neighborhood, and Represented as the width and height of the digital image, Represented as a digital image; the local neighborhood variance is calculated based on the mean of the local neighborhood. The specific calculation formula is:
[0019] ;
[0020] in, is the variance of the local neighborhood; based on the variance of the local neighborhood, the local neighborhood variance is further normalized. The specific calculation formula is:
[0021] ;
[0022] in, Expressed as the normalized local variance, Expressed as the minimum of the local variance, Expressed as the maximum value of the local variance; the parameter matrix will be generated based on the normalized local variance , the specific calculation formula is:
[0023] ;
[0024] in, is represented as a parameter matrix.
[0025] Step S22: Parameter matrix Combined with median filtering, the hysteroscopic image is calculated to generate a hysteroscopic image after denoising. , the specific calculation formula is:
[0026] ;
[0027] ;
[0028] in, Expressed as median filtering, is the hysteroscopic image after denoising, Represented as the original hysteroscopic image, is the parameter matrix.
[0029] Preferably, the adaptive median filtering module constructed by S2 dynamically calculates the parameter matrix according to the local characteristics of the hysteroscopic image to adjust the filtering parameters, adapting to the noise level and detail richness of different areas in the hysteroscopic image. The normalized local method helps to distinguish important details from smooth areas. The parameter matrix combined with the median filtering enables the entire adaptive median filtering module to retain edge and texture information while denoising, adapting to the diversity and complexity of hysteroscopic images.
[0030] Preferably, after the adaptive median filtering processing of the S2 module, the obtained hysteroscopic image has an obvious noise suppression effect, the smoothness of the image is significantly improved, and the noise interference is greatly reduced. However, at the same time, some detail information and multi-scale structural features may be weakened or blurred to a certain extent, especially at the texture edges and complex structure areas. The layering and detail richness of the image are reduced, affecting the accuracy of clinical diagnosis.
[0031] Preferably, in S3, constructing a kernel density multi-scale enhancement module comprises the following steps:
[0032] Step S31: Propose Gaussian kernel dynamic bandwidth parameters , dynamically calculate the Gaussian kernel bandwidth parameter, the specific calculation formula is:
[0033] ;
[0034] in, is the Gaussian kernel bandwidth parameter, To control the bandwidth change speed parameter, The hysteroscopic image in pixels The gradient at is the Gaussian kernel dynamic bandwidth parameter.
[0035] Step S32: construct a multi-scale kernel calculation, that is, perform a weighted average calculation on each pixel in the hysteroscopic image. The specific calculation formula is:
[0036] ;
[0037] ;
[0038] in, For the A two-dimensional Gaussian kernel is calculated, For the The standard deviation of the Gaussian kernel, For each pixel in a digital image, is the number of kernel calculations, is the result after multi-scale kernel calculation, For the The weight of each core calculation, For the Bandwidth parameter for core calculation.
[0039] Step S33: Combine the Gaussian kernel dynamic bandwidth parameters and multi-scale kernel computing The hysteroscopic images after denoising are enhanced and a kernel density multi-scale enhancement module is constructed. The specific calculation formula is:
[0040] ;
[0041] in, The index of the pixel value within the kernel calculation window, The total number of pixels in the kernel calculation window, The hysteroscopic image after preliminary enhancement is generated by the kernel density multi-scale enhancement module. and Indicates the current pixel position The first kernel calculation window in the center The horizontal and vertical coordinates of the pixel points, The first pixel values.
[0042] Preferably, the kernel density multi-scale enhancement module constructed by the S3 uses the dynamic bandwidth parameters of the Gaussian kernel to dynamically adjust the bandwidth parameters of the Gaussian kernel according to the characteristics of different areas in the hysteroscopic image, so as to capture more details in areas with more complex image textures and details. At the same time, the multi-scale kernel calculation is used to adapt to features of different scales, restore a wide range of structural information, and retain local fine features to generate a preliminarily enhanced hysteroscopic image. The overall design significantly enhances the edges and details of the image, thereby improving the clarity of the image.
[0043] Preferably, after processing by the S3 kernel density multi-scale enhancement module, the obtained hysteroscopic image has improved detail level and structural expression, but the global brightness and contrast are still unbalanced, and the details of some areas are not fully highlighted, affecting the overall visual effect of the image and the accuracy of clinical auxiliary diagnosis.
[0044] Preferably, in S4, constructing the nonlinear gain module specifically includes the following steps:
[0045] Step S41: The hysteroscopic image after preliminary enhancement is normalized by calculating the global pixel mean difference and variance. The specific calculation formula is:
[0046] ;
[0047] ;
[0048] ;
[0049] in, Expressed as the global pixel mean difference, Expressed as the global pixel variance, It represents the hysteroscopic image after preliminary enhancement. and Represents the height and width of the image respectively, Expressed as the total pixel value of a digital image, Represents an image after normalizing pixel values. Pixel normalization provides standardized input for subsequent nonlinear gain strategies.
[0050] Step S42: Calculate the variance and mean difference of the local area. The specific calculation formula is:
[0051] ;
[0052] ;
[0053] in, and They are represented as sliding window sizes of The variance and mean difference of the local area, is represented as the window size of the local neighborhood, and Indicates the position along the image The pixel value of the movement; combined with the edge detection result of the Canny operator, the adaptive gain intensity coefficient is designed. The specific calculation formula is:
[0054] ;
[0055] ;
[0056] in, Expressed as the adaptive gain intensity coefficient, Represented as the result of Canny edge detection, Expressed as the adjustment coefficient, According to the actual contrast dynamics of the input image, the adaptive gain intensity coefficient , design the nonlinear gain strategy, the specific calculation formula is:
[0057] ;
[0058] in, A nonlinear mapping expressed as a Gaussian computational form, where Expressed as the center offset parameter, Expressed as bandwidth parameter, Represents a nonlinear gain strategy that improves the local contrast of a digital image.
[0059] Step S43: Fusing the hysteroscopic image after pixel value normalization with the nonlinear gain strategy to obtain an enhanced image. The specific calculation formula is:
[0060] ;
[0061] in, Represents enhanced hysteroscopic image.
[0062] Preferably, the nonlinear gain module constructed by S4 first calculates the global mean and variance of the pixel values, normalizes the pixel values to zero mean and unit variance, and eliminates the global brightness difference. Secondly, the adaptive gain intensity coefficient is designed to be integrated into the nonlinear gain strategy to adaptively enhance the details of specific brightness areas to avoid excessive enhancement or distortion of the enhanced image. The overall enhancement amplitude is controlled by adapting the gain intensity coefficient. Finally, the normalized image is seamlessly integrated with the gain strategy to generate an enhanced hysteroscopic image. The overall design improves the visual effect and detail performance of the hysteroscopic image.
[0063] Preferably, in S5, an adaptive median filter module, a kernel density multi-scale enhancement module and a nonlinear statistical gain module are integrated to construct a hierarchical enhancement fusion model for hysteroscopic images. The specific calculation formula is:
[0064] ;
[0065] ;
[0066] ;
[0067] in, represents the adaptive median filter module, This is the hysteroscopic image before enhancement; Represented as the denoised image, Represented as a kernel density multi-scale enhancement module, It represents the hysteroscopic image after preliminary enhancement; Represented as a nonlinear gain block, Represented as the final enhanced high-resolution image.
[0068] In summary, due to the adoption of this technical solution, compared with the existing technology, the beneficial effects of the present invention are as follows: the adaptive median filtering module generates a parameter matrix according to the local features of the hysteroscopic image, dynamically adjusts the filtering parameters, retains the edge and texture information while denoising, and adapts to the diversity and complexity of hysteroscopic images; the kernel density multi-scale enhancement module uses Gaussian kernel dynamic bandwidth parameters and multi-scale kernel calculation according to the image area characteristics, which can not only restore large-scale structural information but also retain local fine features, significantly enhance the image edges and details, and improve clarity; the nonlinear gain module effectively eliminates global brightness differences by normalizing pixel values and designing a nonlinear gain strategy, avoids excessive enhancement or distortion of the image, and significantly improves the image detail performance; the synergistic effect of the three modules enables the model to comprehensively improve the visual effect of hysteroscopic images, enhance image details, improve clarity, and provide strong support for the quality control and identification of hysteroscopes. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 A step diagram of a processing method for hysteroscopic images.
[0070] Figure 2 This is the structural diagram of the adaptive median filter module.
[0071] Figure 3 This is the structure diagram of the kernel density multi-scale enhancement module.
[0072] Figure 4 This is the structural diagram of the nonlinear gain module.
[0073] Figure 5 This is the overall structure diagram of the hysteroscopic image layered enhancement fusion model.
[0074] Figure 6 Schematic diagram for enhancing the comparison of hysteroscopic images before and after. DETAILED DESCRIPTION
[0075] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work shall fall within the scope of protection of the present invention.
[0076] Please see the attached Figure 1 -Attached Figure 6 , the present invention provides a processing method for hysteroscopic images.
[0077] S1. Acquire hysteroscopic image data and generate a hysteroscopic image data set.
[0078] Furthermore, as attached Figure 1 The collection of hysteroscopic image datasets described in S1 is specifically to collect uterine cavity image data under different angles and lighting conditions through hysteroscopic equipment, and after transmitting it to the data storage system, firstly annotate the images, and the annotation content includes the uterine cavity, cervical key areas and potential lesion areas; then classify and organize the images according to the shooting angle and image quality attributes to construct a data subset with a clear structure; finally, the images are uniformly converted into the standard format PNG and uniformly processed into a size of 512×512 to generate a hysteroscopic image dataset with diversity and complete annotation information for subsequent image processing and model training.
[0079] S2. Design a parameter matrix and combine it with median filtering to construct an adaptive median filtering module to perform dynamic adaptive denoising on the input low-resolution hysteroscopic image and generate a denoised hysteroscopic image.
[0080] Furthermore, as attached Figure 1 The construction steps of the adaptive median filter module described in S2 are as follows: Figure 2 As shown, the specific implementation of the module includes the following steps:
[0081] Furthermore, in step S21, the local neighborhood variance is calculated for each pixel value in the hysteroscopic image. The specific calculation formula is:
[0082] ;
[0083] in, Expressed as the mean of the local neighborhood, Represented as each pixel position in the image, is represented as the window size of the local neighborhood, The value is , Denote as input image, and Expressed as image size, , ; Calculate the local neighborhood variance based on the mean of the local neighborhood. The specific calculation formula is:
[0084] ;
[0085] in, is the variance of the local neighborhood; based on the variance of the local neighborhood, the local neighborhood variance is further normalized. The specific calculation formula is:
[0086] ;
[0087] in, Expressed as the normalized local variance, Expressed as the minimum of the local variance, Expressed as the maximum value of the local variance, determined by the value obtained from the local variance; the parameter matrix will be generated based on the normalized local variance , the specific calculation formula is:
[0088] ;
[0089] in, Expressed as a parameter matrix, the implementation code is:
[0090] import numpy as np
[0091] from scipy.ndimage import uniform_filter
[0092] def local_variance_and_alpha(I, k):
[0093] I = I.astype(np.float64)
[0094] ksize = (k, k)
[0095] # Calculate the local mean μ(x,y)
[0096] local_mean = uniform_filter(I, size=ksize, mode='reflect')
[0097] # Calculate the square of the local mean
[0098] local_mean_sq = local_mean ** 2
[0099] # Calculate the local square mean
[0100] local_sq_mean = uniform_filter(I**2, size=ksize, mode='reflect')
[0101] # Calculate local variance
[0102] local_var = local_sq_mean - local_mean_sq
[0103] # Variance normalization
[0104] var_min = np.min(local_var)
[0105] var_max = np.max(local_var)
[0106] var_norm = (local_var - var_min) / (var_max - var_min + 1e-12) # avoid division by zero
[0107] # Calculate the parameter matrix alpha(x,y) = 1 - σ_norm(x,y)
[0108] alpha = 1.0 - var_norm
[0109] return var_norm, alpha.
[0110] Furthermore, step S22 converts the parameter matrix Combined with median filtering, the original hysteroscopic image is calculated to generate a hysteroscopic image after denoising. , the specific calculation formula is:
[0111] ;
[0112] ;
[0113] in, Expressed as median filtering, is the image after denoising, Represented as the original hysteroscopic image, is a parameter matrix. The combination of median filtering and parameter matrix can remove noise while retaining the detail information of hysteroscopic images.
[0114] S3. Gaussian kernel dynamic bandwidth parameters and multi-scale kernel calculation are proposed to construct a kernel density multi-scale enhancement module to restore the structural information and fine features of the denoised hysteroscopic image and generate the enhanced hysteroscopic image.
[0115] Furthermore, as attached Figure 1 The kernel density multi-scale enhancement module described in S3 is constructed. The specific steps of the module construction are as shown in the attached Figure 3 As shown, the specific implementation includes the following steps:
[0116] Furthermore, step S31 proposes the Gaussian kernel dynamic bandwidth parameter , combining the pixel gradient within the Gaussian kernel range to dynamically calculate the Gaussian kernel bandwidth parameter. This function can capture more details in areas with more complex image textures and details. The specific calculation formula is:
[0117] ;
[0118] in, is the Gaussian kernel bandwidth parameter, The value of is 4, To control the bandwidth change speed parameter, The value of is 1.3, For hysteroscopic images in pixels The gradient at is the Gaussian kernel dynamic bandwidth parameter.
[0119] Furthermore, step S32 performs weighted average calculation on each pixel in the hysteroscopic image, constructs a multi-scale kernel calculation, restores large-scale structural information and retains local fine features, and enhances the edges and details of the image. The specific calculation formula is:
[0120] ;
[0121] ;
[0122] in, For the A two-dimensional Gaussian kernel is calculated, For the The standard deviation of the Gaussian kernel, For each pixel in a digital image, is the number of kernel calculations, is the result after multi-scale kernel calculation, For the The weight of each core calculation, For the Bandwidth parameter for core calculation.
[0123] Furthermore, step S33 sets the Gaussian kernel dynamic bandwidth parameter and multi-scale kernel computing Combine to improve the clarity of the image. The specific calculation formula is:
[0124] ;
[0125] in, The index of the pixel value within the kernel calculation window, The value range is 0 to 24. The total number of pixels in the kernel calculation window, The value of is 25, The hysteroscopic image after preliminary enhancement is generated by the kernel density multi-scale enhancement module. and Indicates the current pixel position The first kernel calculation window in the center The horizontal and vertical coordinates of the pixel points, The first pixel values, the implementation code is:
[0126] def compute_Kmulti(I, x, y, m, h, w):
[0127] Kmulti_value = 0
[0128] for j in range(m):
[0129] xi, yi = I.shape[0] / / 2, I.shape[1] / / 2
[0130] diff_x = x - xi
[0131] diff_y = y - yi
[0132] K_value = w[j] * compute_K(diff_x / h[j], diff_y / h[j], sigma=h[j])
[0133] Kmulti_value += K_value
[0134] return Kmulti_value
[0135] def compute_I_hat(I, x, y, m, h, w):
[0136] Kmulti_sum = 0
[0137] weighted_sum = 0
[0138] for i in range(m):
[0139] xi, yi = I.shape[0] / / 2, I.shape[1] / / 2
[0140] diff_x = x - xi
[0141] diff_y = y - yi
[0142] K_value = compute_K(diff_x / h[i], diff_y / h[i], sigma=h[i])
[0143] Kmulti_sum += K_value
[0144] weighted_sum += K_value * I[xi, yi]
[0145] I_hat_value = weighted_sum / Kmulti_sum
[0146] return I_hat_value.
[0147] S4. Design an adaptive gain intensity coefficient and incorporate it into the nonlinear statistical gain strategy to construct a nonlinear statistical gain module to eliminate the global brightness difference of the hysteroscopic image and enhance the information of the specific brightness area to obtain the final enhanced high-resolution hysteroscopic image.
[0148] Furthermore, as attached Figure 1 The nonlinear gain module described in S4 is constructed. The specific steps of the module construction are as shown in the attached Figure 4 As shown, the specific implementation of the module includes the following steps:
[0149] Furthermore, in step S41, the hysteroscopic image after preliminary enhancement is normalized by calculating the global pixel mean difference and variance so that the pixel value distribution of the image is more uniform. The specific calculation formula is:
[0150] ;
[0151] ;
[0152] ;
[0153] in, Expressed as the global pixel mean difference, Expressed as the global pixel variance, Indicates the initial enhanced hysteroscopic image, and Represents the height and width of the image, the values are 512 and 512 respectively. The total pixel value of the hysteroscopic image is calculated. Represents an image after normalizing pixel values.
[0154] Furthermore, in step S42, the variance and mean difference of the local area are calculated, and the specific calculation formula is:
[0155] ;
[0156] ;
[0157] in, is represented as the window size of the local neighborhood, The value is , and Indicates the position along the image The pixel value of the movement, and They are represented as sliding window sizes of The variance and mean difference of the local area are used to design a linear gain strategy based on the coefficient. The linear gain strategy can adaptively adjust the enhancement amplitude according to the different pixel values, avoiding the abrupt enhancement effect. The specific calculation formula of the adaptive gain intensity coefficient is:
[0158] ;
[0159] ;
[0160] in, Expressed as the adaptive gain intensity coefficient, Represented as the result of Canny edge detection, It is expressed as an adjustment coefficient, and the parameter is set to 0.5. The specific calculation formula for designing the linear gain strategy based on this coefficient is:
[0161] ;
[0162] in, Represented as a nonlinear mapping in the form of a Gaussian function, where Expressed as the center offset parameter, it controls the center position of the gain strategy and the parameter is set to , Expressed as a bandwidth parameter, it controls the attenuation speed of the gain strategy, and the parameter is set to , the implementation code is:
[0163] def compute_local_mean_variance(I, k):
[0164] I = I.astype(np.float64)
[0165] pad = k / / 2
[0166] # Use mean filtering to calculate the local mean
[0167] mu_local = cv2.blur(I, (k, k))
[0168] # Calculate the local mean square
[0169] mu_local_sq = mu_local ** 2
[0170] # Calculate local mean square
[0171] mean_sq = cv2.blur(I ** 2, (k, k))
[0172] # Calculate local variance
[0173] var_local = mean_sq - mu_local_sq
[0174] return mu_local, var_local
[0175] def adaptive_gain(I, k, v, c, beta):
[0176] # Calculate local mean and variance
[0177] mu_local, var_local = compute_local_mean_variance(I, k)
[0178] # Use Canny to detect edges and generate edge weight matrix W(x,y)
[0179] edges = cv2.Canny(I.astype(np.uint8), 100, 200) # threshold adjustable
[0180] W = (edges>0).astype(np.float64)
[0181] # Calculate the adaptive gain strength coefficient delta
[0182] delta = (var_local / (mu_local + 1e-12)) * (1 + v * W)
[0183] # Calculate nonlinear gain strategy G(x,y)
[0184] diff = I - c
[0185] exponent = - (diff ** 2) / (2 * beta ** 2)
[0186] G = 1 + delta * np.exp(exponent)
[0187] return G.
[0188] Furthermore, in step S43, the image after pixel value normalization is fused with the nonlinear gain strategy to obtain an enhanced image, which not only retains the detail information of the hysteroscopic image but also enhances the contrast. The specific calculation formula is:
[0189] ;
[0190] in, represents the enhanced image.
[0191] S5. An adaptive median filtering module, a kernel density multi-scale enhancement module and a nonlinear statistical gain strategy were integrated to construct a hierarchical enhancement fusion model for hysteroscopic images.
[0192] Furthermore, as attached Figure 1 The hysteroscopic image layered enhancement fusion model described in S5 is constructed. The specific steps of the model construction are as shown in the attached Figure 5As shown in Figure 2, the model integrates an adaptive median filter module, a kernel density multi-scale enhancement module, and a nonlinear statistical gain module. The specific calculation formula is:
[0193] ;
[0194] ;
[0195] ;
[0196] in, represents the adaptive median filter module, This is the hysteroscopic image before enhancement; Represented as the denoised image, Represented as a kernel density multi-scale enhancement module, It represents the hysteroscopic image after preliminary enhancement; Represented as a nonlinear gain block, Represented as the final enhanced high-resolution image.
[0197] S6. Use the hysteroscopic image dataset and input it into the hysteroscopic image layered enhancement fusion model for denoising and enhancement, and output high-resolution hysteroscopic images.
[0198] Furthermore, as attached Figure 1 The hysteroscopic image layered enhancement fusion model described in S6 is used to input hysteroscopic images and output high-resolution hysteroscopic images. The specific effect is shown in the attached Figure 6 As shown, attached Figure 6 (a) is a low-resolution hysteroscopic image, with Figure 6 (b) is a hysteroscopic image after image enhancement using the model, and the specific implementation includes the following steps:
[0199] Furthermore, in step S6, the operating system platform used by the model is Ubuntu system, the language is Python3.8.1, the processor used is Xeon E-2308 processor, the server physical memory is 64G, and the data set contains hysteroscopic images, a total of 1865 images.
[0200] The above are only preferred embodiments of the present invention. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the scope of protection of the present invention.
Claims
1. A method for processing hysteroscopic images, characterized in that: The following steps are involved: S1, collecting original hysteroscopic data and generating a hysteroscopic image dataset; S2. Introducing a parameter matrix and constructing an adaptive median filter module. The hysteroscopic image passes through the adaptive median filter module to generate a denoised hysteroscopic image. S3. By introducing Gaussian kernel dynamic bandwidth parameters and multi-scale kernel calculation, a kernel density multi-scale enhancement module is constructed, and the denoised hysteroscopic image is processed by the kernel density multi-scale enhancement module to generate an enhanced hysteroscopic image; S4. Design an adaptive gain intensity coefficient fusion nonlinear statistical gain strategy to construct a nonlinear gain module. The hysteroscopic image after preliminary enhancement is further enhanced by the nonlinear gain module. Specifically, the global pixel mean difference and variance of the preliminary enhanced hysteroscopic image obtained by the kernel density multi-scale enhancement module are calculated, and pixel normalization is performed to obtain the hysteroscopic image after pixel normalization. Calculate the variance of a local area and mean difference , combined with the edge detection results of the Canny operator, the adaptive gain intensity coefficient is designed. The specific calculation formula is: ; ; in, Expressed as the adaptive gain intensity coefficient, Represented as the result of Canny edge detection, Expressed as the adjustment coefficient, According to the actual contrast dynamics of the input image, the adaptive gain intensity coefficient , design the nonlinear gain strategy, the specific calculation formula is: ; in, A nonlinear mapping expressed as a Gaussian computational form, where Expressed as the center offset parameter, Expressed as bandwidth parameter, Represents a nonlinear gain strategy; Finally, the hysteroscopic image after pixel value normalization and nonlinear gain strategies The fusion is performed to generate the final enhanced hysteroscopic image. The specific calculation formula is: ; in, represents the enhanced hysteroscopic image; S5, integrated the adaptive median filter module, kernel density multi-scale enhancement module and nonlinear gain module to build a hierarchical enhancement fusion model for hysteroscopic images; S6. Input the hysteroscopic image into the hysteroscopic image layered enhancement fusion model for image enhancement, and output a high-resolution hysteroscopic image.
2. A hysteroscopic image processing method according to claim 1, characterized in that: In S2, constructing the adaptive median filter module includes the following steps: S21. Calculate the local neighborhood variance for each pixel value in the hysteroscopic image. The specific calculation formula is: ; in, Expressed as the mean of the local neighborhood, Represented as each pixel position in the image, is represented as the window size of the local neighborhood, and Represented as the width and height of the digital image, Represented as a digital image; the local neighborhood variance is calculated based on the mean of the local neighborhood. The specific calculation formula is: ; in, is the variance of the local neighborhood; based on the variance of the local neighborhood, the local neighborhood variance is further normalized. The specific calculation formula is: ; in, Expressed as the normalized local variance, Expressed as the minimum of the local variance, Expressed as the maximum value of the local variance; the parameter matrix will be generated based on the normalized local variance , the specific calculation formula is: ; in, Represented as a parameter matrix; S22, parameter matrix Combined with median filtering, the low-resolution hysteroscopic image is calculated to generate a hysteroscopic image after denoising. , the specific calculation formula is: ; ; in, Expressed as median filtering, is the image after denoising, Represented as the original hysteroscopic image, is the parameter matrix.
3. The method for processing hysteroscopic images according to claim 2, characterized in that: In S3, constructing the kernel density multi-scale enhancement module includes the following steps: S31. Propose Gaussian kernel dynamic bandwidth parameter , dynamically calculate the Gaussian kernel bandwidth parameter, the specific calculation formula is: ; in, is the Gaussian kernel bandwidth parameter, To control the bandwidth change speed parameter, For hysteroscopic images in pixels The gradient at is the Gaussian kernel dynamic bandwidth parameter; S32. Construct a multi-scale kernel calculation, that is, perform a weighted average calculation on each pixel in the hysteroscopic image. The specific calculation formula is: ; ; in, For the A two-dimensional Gaussian kernel is calculated, For the The standard deviation of the Gaussian kernel, For each pixel in a digital image, is the number of kernel calculations, is the result after multi-scale kernel calculation, For the The weight of each core calculation, For the Bandwidth parameters for per-core calculations; S33, combined with Gaussian kernel dynamic bandwidth parameters and multi-scale kernel computing , construct the kernel density multi-scale enhancement module, the specific calculation formula is: ; in, The index of the pixel value within the kernel calculation window, The total number of pixels in the kernel calculation window, The hysteroscopic image after preliminary enhancement is generated by the kernel density multi-scale enhancement module. and Indicates the current pixel position The horizontal and vertical coordinates of the pixel point in the kernel calculation window centered at , The first pixel values.
4. The method for processing hysteroscopic images according to claim 3, characterized in that: In the S5, an adaptive median filter module, a kernel density multi-scale enhancement module and a nonlinear statistical gain module are integrated to construct a hierarchical enhancement fusion model for hysteroscopic images. The specific calculation formula is: ; ; ; in, represents the adaptive median filter module, Indicates the window size, Represented as low-resolution hysteroscopic images; Represented as a kernel density multi-scale enhancement module, Represented as the denoised image, Expressed as bandwidth parameter, It represents the hysteroscopic image after preliminary enhancement; Represented as a nonlinear gain block, Represented as the final enhanced high-resolution image.
Citation Information
Patent Citations
Lamination bottling control method and system integrating image and photoelectric sensor
CN119271976A
Method for improving image recognition precision of new energy station
CN119963848A