Image processing method, processing system, device and storage medium
Through multispectral imaging technology and image processing methods, the problems of low image recognition accuracy and efficiency under complex lighting conditions are solved, stable recognition under different lighting conditions is achieved, and the adaptability and recognition accuracy of the image processing system are improved.
Patent Information
- Application Number
- CN202510733586.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-09-12
AI Technical Summary
Existing image recognition technology has insufficient recognition accuracy and low efficiency under complex lighting conditions. Lighting conditions have a great impact on target feature recognition. The existing lighting correction module is difficult to adapt to dynamic changes, and the feature extraction network lacks collaborative optimization.
Multispectral imaging technology is used to acquire real-time images by emitting light of different wavelengths through the light source module. After noise reduction and color space conversion, the images are divided into sub-blocks for histogram equalization to enhance local contrast. The grayscale probability density is calculated and the contrast threshold is set for cropping. After merging the images, edge enhancement is performed, and bilinear interpolation is used to smooth the boundaries. Local non-maximum suppression is used to remove redundant edges, and the edge areas where weak edges are connected to strong edges are retained using a double threshold method.
It improves the accuracy and efficiency of image recognition, enhances the adaptability of the system, can stably identify target features under different lighting conditions, reduces manual intervention, and supports deep learning-based lesion recognition.
Smart Images

Figure CN120634938A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing methods, and in particular to an image processing method, processing system, device and storage medium based on filter wheel processing. Background Art
[0002] In recent years, with the rapid development of artificial intelligence (AI), deep learning-based image recognition technology has been widely used in fields such as security monitoring, autonomous driving, and medical image analysis. Recent research has shown that the combination of multispectral imaging and deep learning has achieved remarkable results in the detection of skin diseases, tumors, and other tissue lesions. For example, some studies have successfully achieved early screening for skin cancer by analyzing multispectral images using deep learning algorithms, demonstrating the potential of this technology in clinical applications. However, existing technologies still have the following significant drawbacks in practical application scenarios:
[0003] 1. Recognition accuracy is relatively low. Existing image recognition models (such as classification algorithms based on convolutional neural networks) are highly sensitive to input image clarity, lighting uniformity, and noise interference. In scenes with drastic changes in lighting intensity (such as backlighting and low illumination) or complex background interference, feature extraction networks are prone to false activation, resulting in the loss of key features.
[0004] 2. There are significant flaws in environmental adaptability. Traditional solutions often use histogram equalization (CLAHE) or Retinex theory for illumination compensation. However, these methods have two limitations: First, the illumination correction module based on fixed parameters is difficult to adapt to dynamically changing lighting conditions; second, the preprocessing process and the feature extraction network lack a collaborative optimization mechanism, resulting in feature space distortion under extreme lighting conditions.
[0005] To address these issues, the industry has proposed methods such as local feature enhancement (such as the SENet attention mechanism) and illumination-invariant feature learning, but no breakthroughs have been made in maintaining spatial consistency in feature representation or controlling computational complexity. Therefore, a new image recognition technology is urgently needed that can achieve high-precision, high-efficiency, and stable recognition under complex lighting conditions. Summary of the Invention
[0006] The technical problem to be solved by the present invention is that current image processing methods lack detection accuracy and efficiency, and are unable to provide relatively accurate feature recognition. Furthermore, lighting conditions significantly affect the recognition of target features. To address the above-mentioned shortcomings of the prior art, an image processing method, processing system, device, and storage medium are provided.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] Construct an image processing method, including the following steps:
[0009] Emitting light of different wavelengths through a light source module;
[0010] Use the light emitted by the light source module as a light source to acquire a real-time image;
[0011] Perform noise reduction and color space conversion on the acquired real-time images;
[0012] The converted image is divided into multiple sub-blocks, and histogram equalization is performed independently on each sub-block to enhance the local contrast;
[0013] Calculate the probability density of the grayscale level of the histogram of each sub-block, set the contrast limit threshold, clip the frequency of grayscale values above the contrast threshold and distribute them to all grayscale levels, and then form a merged image of the sub-blocks;
[0014] Perform edge enhancement on the merged image to obtain a new image;
[0015] The new image is converted into a normal image and displayed.
[0016] Preferably, the process of performing edge enhancement on the merged image to obtain a new image further includes:
[0017] The gradient is calculated by convolution to obtain the edge strength and edge direction of the merged image, and the edge strength is classified to obtain the edge of the final image.
[0018] Preferably, after obtaining the edge strength and edge direction of the merged image by calculating the gradient through convolution, the method further comprises:
[0019] Through local non-maximum suppression, the strongest pixels in the edge intensity direction are retained and redundant edges are removed.
[0020] Preferably, the step of classifying the edge strengths to obtain the edges of the final image further includes:
[0021] The edges are classified into the first edge, the second edge and the third edge by using a cool threshold, and only the edge connected by the first edge and the second edge is retained as the final edge region of the image.
[0022] Preferably, the step of forming a merged image from the sub-image blocks after clipping the frequencies of grayscale values above the contrast threshold and distributing them to all grayscale levels comprises:
[0023] The clipped frequency values are evenly distributed to all gray levels, and the cumulative distribution function is calculated based on the clipped histogram and the pixel values are mapped. The cumulative distribution function formula is:
[0024]
[0025] The normalized cumulative distribution function is used in the process of mapping pixel values. The normalized cumulative distribution function formula is:
[0026]
[0027] Among them, CDF min is the smallest non-zero cumulative distribution value.
[0028] Preferably, after calculating the cumulative distribution function based on the clipped histogram and mapping the pixel values, the method further comprises:
[0029] The boundaries between sub-blocks are smoothed by bilinear interpolation, which is based on weights related to the sub-block distance and the equalization results of the neighboring sub-blocks of the current sub-block. The interpolation formula is:
[0030] I fam (x,y)=w1I′1(x,y)+w2I′2(x,y)+w3I′3(x,y)+w4I′4(x,y)
[0031] Among them, w1, w2, w3, and w4 are weights related to the sub-block distance, satisfying w1+w2+w3+w4=1.
[0032] Preferably, the process of emitting light of different wavelengths through the light source module includes:
[0033] A broad spectrum light source for emitting light;
[0034] A filter adjustment wheel is used to filter light of different wavelengths emitted by a broadband light source;
[0035] The light outlet is used to emit the light filtered by the filter adjustment wheel.
[0036] Construct an image processing system, including:
[0037] A light source module, used to generate light of different wavelengths as a light source for acquiring a target image;
[0038] An image acquisition module uses the light emitted by the light source module as a light source to acquire a real-time target image;
[0039] The image processing module converts the real-time image and divides the converted image into multiple sub-blocks. It then performs histogram equalization on each sub-block to enhance the contrast of the sub-block. The sub-blocks are then merged and the edge enhancement is performed on the merged image to obtain a new image and convert it into a normal image.
[0040] The image display module displays the converted image.
[0041] A smart terminal is constructed, which includes at least one memory, at least one processor, and an image processing program stored in the memory and executable on the processor. When the image processing program is executed by the processor, the steps of the above-mentioned image processing method are implemented.
[0042] A computer-readable storage medium is constructed, wherein an image processing program is stored on the computer-readable storage medium. When the image processing program is executed by a processor, the steps of the image processing method described above are implemented.
[0043] The beneficial effects of the present invention are: light of different wavelengths emitted by the light source module is used as a light source to obtain a real-time target image, and then the image is denoised to eliminate the noise of the image and perform color space conversion. The converted image is subjected to practical adaptive histogram equalization. The converted image is first divided into multiple sub-blocks, and each sub-block is subjected to histogram equalization to enhance local contrast. The probability density of the grayscale in the histogram of each sub-block is first calculated, and then each grayscale is cropped to limit the contrast of each grayscale to avoid image distortion caused by excessive enhancement. The integral distribution function of the cropped grayscale is then calculated and the mapped pixel value is calculated to avoid excessive stretching of black. For the boundary area of the sub-blocks, bilinear interpolation is used to merge the sub-blocks and avoid obvious boundaries between the sub-blocks during the merging process. The merged image is edge enhanced in terms of edge intensity and edge direction, and then local non-maximum suppression is used to retain only the strongest pixels in the gradient direction, and redundant edges are removed. The edges are then classified using a double threshold method, and only weak edge pixels are connected to strong edge pixels, thereby obtaining the edge area of the image. The image is restored after pseudo-color transformation and displayed, making it convenient to view the target features on the image to help doctors make judgments, thereby improving the accuracy and efficiency of target feature recognition in the image, and automatically extracting target features in multispectral images, reducing the need for manual feature extraction, improving the adaptability of the system, and can be used for deep learning to identify small and complex target features in multispectral images, providing strong support for subsequent analysis of target features.
[0044] Multispectral imaging technology and deep learning are used for lesion identification, effectively identifying and analyzing pathological changes in tissues. Multispectral imaging uses a combination of different wavelengths to highlight the spectral characteristics of lesions, enabling early disease detection. This not only improves detection accuracy and efficiency, but also provides strong support for early diagnosis. It also maintains excellent recognition capabilities under varying lighting conditions, promoting the development of medical imaging. This technology holds broad prospects and significant social value. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be further described below with reference to the accompanying drawings and embodiments. The drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive efforts.
[0046] Figure 1 Schematic diagram of the flow of an image processing method according to a preferred embodiment of the present invention;
[0047] Figure 2 A schematic diagram of the system structure of an image processing system according to a preferred embodiment of the present invention;
[0048] Figure 3 Schematic diagram of the structure of a smart terminal according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0049] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the following will be a clear and complete description of the technical solutions in the embodiments of the present invention. Obviously, the embodiments described are some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work shall fall within the scope of protection of the present invention.
[0050] An image processing method according to a preferred embodiment of the present invention; Figure 1 , which is a flow chart of an image processing method provided by an embodiment of the present invention. The method can be executed by a device, and the device can be implemented by software and / or hardware.
[0051] Specifically, in this embodiment, the image processing method includes:
[0052] S10: The light source module emits light of different wavelengths;
[0053] In a preferred embodiment of the present invention, the light source module can emit light of different wavelengths in two ways, thereby forming light sources of different spectra.
[0054] The multi-spectral light source module can adopt filter wheel technology, which is mainly composed of three parts: a broadband light source, a filter adjustment wheel and a light outlet. There are multiple filters distributed on the filter wheel, which can filter out light of different wavelengths. The device of the present application can intercept five wavelength bands as needed, namely purple light, with a wavelength of 350-400nm; green light, with a wavelength of 400-490nm; blue light, with a wavelength of 495-570nm; red light, with a wavelength of 620-750nm; and white light. When in use, light of corresponding wavelengths can be emitted according to needs, thereby forming a broadband light source.
[0055] S20: Using the light emitted by the light source module as a light source to acquire a real-time image;
[0056] In preferred embodiments of the present invention, multispectral imaging technology is an advanced imaging method that captures reflected light from an object across multiple spectral bands to generate high-dimensional data. This technology can provide richer information than traditional imaging methods, particularly in the biomedical field, effectively identifying and analyzing pathological changes in tissues. Multispectral imaging uses a combination of different wavelengths to highlight the spectral characteristics of diseased areas, thereby enabling early detection of diseases.
[0057] Furthermore, real-time images can be obtained by using an endoscope or other means. After the endoscope is placed in the corresponding part, the light of different bands emitted by the filter wheel is used as the light source of the endoscope, and then the real-time image information of the corresponding part under the light of the current band is obtained through the camera on the endoscope.
[0058] S30: performing noise reduction and color space conversion on the acquired real-time image;
[0059] In a preferred embodiment of the present invention, since the pre-processed image after being processed with light of different wavelengths is a color image and contains significant noise, noise reduction processing can be performed on the real-time image captured and transmitted by the endoscope to eliminate the noise. Furthermore, since the proportions of light in different wavelengths vary in the combined light mode, the final image will also have different colors. To avoid errors in image recognition, color correction is required. Real-time images are often in RGB space, so color space transformation is performed to convert the image from RGB space to HSV color space to facilitate color adjustment.
[0060] S40: Divide the converted image into a plurality of sub-blocks, and perform histogram equalization processing on the sub-blocks to obtain the probability density of the gray level in each sub-block;
[0061] In a preferred embodiment of the present invention, the converted input image I(x,y) is divided into multiple sub-blocks of size M×N. Each sub-block is independently histogram equalized to increase local contrast. At the same time, the probability density of the grayscale level of the histogram of the sub-block is calculated using formula ①:
[0062] h(v)=∑ x,y∈itie δ(I(x,y)―v), v∈[0,L―1] ①
[0063] Where v is the grayscale value, δ(I(x,y)-v)=1 when I(x,y)=v, otherwise it is 0, and L is the number of grayscale levels.
[0064] S50: clipping each gray level of the histogram to limit the contrast of each gray level;
[0065] In a preferred embodiment of the present invention, since traditional histogram equalization may cause excessive enhancement of high-frequency grayscale values, each of the histograms is clipped in this application by setting a contrast limit threshold T to limit the frequency of each grayscale value, as shown in formula ②:
[0066]
[0067] Then the frequency values of the clipped parts are evenly distributed to all gray levels, as shown in formula ③:
[0068]
[0069] This method limits the contrast of each sub-block to avoid image distortion caused by over-enhancement.
[0070] S60: Calculate the cumulative distribution function of the cropped histogram and map the pixel values to obtain the mapped sub-block;
[0071] In a preferred embodiment of the present invention, the cumulative distribution function (CDF) is calculated by calculating the clipped histogram to avoid excessive stretching of black, as shown in formula ④:
[0072]
[0073] Then the grayscale values in the histogram are mapped by normalizing the cumulative distribution, as shown in formula ⑤:
[0074]
[0075] Among them, CDF min is the minimum non-zero cumulative distribution value, used to avoid overstretching black.
[0076] S70: using bilinear interpolation to merge the mapped sub-blocks to obtain an image with enhanced contrast;
[0077] In a preferred embodiment of the present invention, the mapped sub-blocks are spliced to form a spliced image. At the same time, for the boundary areas between the sub-blocks, in order to avoid obvious boundaries between the sub-block connections, bilinear interpolation can be used to achieve a smooth transition of the sub-block boundary areas, thereby obtaining an image with enhanced contrast.
[0078] Among them, the equalization results of the four neighboring sub-blocks of the sub-block where the pixel point (x, y) is located are:
[0079] I′1(x,y),I′2(x,y),I′3(x,y),I′4(x,y)
[0080] Then, the smooth transition of the sub-block boundary area is achieved through the interpolation formula ⑥:
[0081] I fam (x,y)=w1I′1(x,y)+w2I′2(x,y)+w3I′3(x,y)+w4I′4(x,y) ⑥
[0082] Among them, w1, w2, w3, and w4 are weights related to the sub-block distance, which satisfy w1+w2+w3+w4=1.
[0083] S80: Use canny to perform edge enhancement on the enhanced image to obtain a new image;
[0084] In order to make the edges of the spliced image clearer in a preferred embodiment of the present invention, canny is used to enhance the edges of the spliced image to improve the recognition of the target features in the image. fam Edge enhancement is mainly divided into edge strength and direction.
[0085] First, use formula ⑦ to perform convolution calculation on image I fam Gradient:
[0086] G x (x,y)=I fam (x,y)*K x ,G y (x,y)=I fam (x,y)*K y ⑦
[0087] Among them, K x and K y is the convolution kernel.
[0088] In terms of edge strength (or gradient amplitude), it is calculated using formula ⑧:
[0089]
[0090] In terms of edge direction, it is calculated by formula 9:
[0091]
[0092] Then, through local non-maximum suppression, only the strongest pixels in the gradient direction are retained to remove redundant edges. The specific method is as follows:
[0093] First, for each pixel, the gradient direction θ(x, y) is used to determine the comparison direction of its edge strength (gradient amplitude). That is, the angle between the gradient direction and the horizontal axis is usually quantized into four directions: 0°, 45°, 90°, and 135°.
[0094] Compare the gradient amplitude G(x,y) to see if it is the local maximum in the gradient direction. If it is not the local maximum, suppress it to 0. Assuming the gradient direction is θ(x,y), the adjacent pixels are:
[0095] Horizontal direction (0°): G(x―1,y) and G(x+1,y);
[0096] Diagonal direction (45°): G(x―1,y+1) and G(x+1,y―1);
[0097] Vertical direction (90°): G(x,y―1) and G(x,y+1);
[0098] Anti-diagonal direction (135°): G(x―1,y―1) and G(x+1,y+1);
[0099] Then compare in the gradient direction according to formula ⑩:
[0100]
[0101] This way, the pixels that are most like edges are retained and other redundant edges are removed.
[0102] Then, the edges are classified into strong edges, weak edges and non-edges by the double threshold method, and the strong edges are connected by weak edges to form the final edge part, so as to obtain the final edge area of the spliced image and thus obtain a new image. First, set the high threshold value T of the edge high and low threshold T low , and then classify the gradient magnitude G′(x,y):
[0103] Strong edge: G′(x,y)>T high
[0104] Weak edge: T low <G′(x,y)≤T high
[0105] Non-edge: G′(x,y)≤T low
[0106] Through the above threshold setting method, combined with classification rules:
[0107]
[0108] Edges can be classified. If a weak edge pixel is connected to a strong edge pixel, the edge is retained; otherwise, it is suppressed as a non-edge. After the above method, the final edge image E(x, y) is a combination of strong edges and partially connected weak edges, and is represented as the final edge region of the image, thus obtaining a new image.
[0109] S90: performing color conversion on the converted image and displaying the converted image;
[0110] In a preferred embodiment of the present invention, since the new image is in the HSV color space, in order to facilitate viewing and analysis, the new image needs to be converted into the RGB space, and then the converted new image is imaged and displayed through the display module. The doctor then analyzes the converted new image and determines the location of the lesion.
[0111] Through the above method, the light of different wavelengths emitted by the light source module is used as the light source to obtain a real-time target image, and then the image is denoised to eliminate the noise of the image and perform color space conversion. The converted image is subjected to practical adaptive histogram equalization. The converted image is first divided into multiple sub-blocks, and histogram equalization is performed on each sub-block to enhance the local contrast. The probability density of the grayscale in the histogram of each sub-block is first calculated, and then each grayscale is cropped to limit the contrast of each grayscale to avoid image distortion caused by over-enhancement. The integral distribution function of the cropped grayscale is then calculated and the mapped pixel value is calculated to avoid excessive stretching of black. For the boundary area of the sub-block, bilinear interpolation is used to merge the sub-blocks and avoid obvious boundaries between the sub-blocks during the merging process. The merged image is edge enhanced in terms of edge intensity and edge direction, and then local non-maximum suppression is used to retain only the strongest pixels in the gradient direction, and redundant edges are removed. The edges are then classified using a double threshold method, and only weak edge pixels are connected to strong edge pixels, thereby obtaining the edge area of the image. The image is restored after pseudo-color transformation and displayed, making it convenient to view the target features on the image to help doctors make judgments, thereby improving the accuracy and efficiency of target feature recognition in the image, and automatically extracting responsible features in multispectral images, reducing the need for manual feature extraction, improving the adaptability of the system, and can be used for deep learning to identify small and complex target features in multispectral images, providing strong support for subsequent analysis of target features.
[0112] Corresponding to an image processing method, the present invention also provides an image processing system, specifically, as Figure 2 As shown, the image processing system includes: a light source module 100 , an image acquisition module 200 , an image processing module 300 and an image display module 400 .
[0113] The light source module 100 is used to generate light of different wavelength bands as a light source for acquiring a target image;
[0114] Specifically, the multi-spectral light source module can adopt filter wheel technology, which is mainly composed of three parts: a broadband light source, a filter adjustment wheel and a light outlet. There are multiple filters distributed on the filter wheel, which can filter out light of different wavelengths. The device of the present application can intercept a total of five wavelength bands as needed, namely purple light, with a wavelength of 350-400nm; green light, with a wavelength of 400-490nm; blue light, with a wavelength of 495-570nm; red light, with a wavelength of 620-750nm; and white light. When in use, light of corresponding wavelengths can be emitted according to needs, thereby forming a broadband light source.
[0115] The image acquisition module 200 uses the light emitted by the light source module as a light source to acquire a real-time target image;
[0116] Specifically, real-time images can be obtained by using an endoscope or other means. After placing the endoscope in the corresponding part, the light of different bands emitted by the filter wheel is used as the light source of the endoscope, and then the real-time image information of the corresponding part under the current band of light is obtained through the camera on the endoscope.
[0117] The image processing module 300 converts the real-time image and divides the converted image into multiple sub-blocks. The module performs histogram equalization on each sub-block to enhance the contrast of the sub-block. The module then merges the sub-blocks, performs edge enhancement on the merged image to obtain a new image, and converts the new image into a normal image.
[0118] Specifically, since the pre-processed image after being processed by light of different wavelengths is a color image and the noise in the image is relatively large, the real-time image collected and transmitted by the endoscope can first be subjected to noise reduction processing to eliminate the noise in the real-time image. At the same time, since the proportion of light in different wavelengths is different in the combined light mode, the final image color will also be different. In order to avoid errors in image recognition caused by this, color correction is required. Real-time images are often images in RGB space, so color space transformation is performed to convert the image from RGB space to HSV color space to facilitate color adjustment.
[0119] Furthermore, the converted input image I(x,y) is divided into multiple sub-blocks of size M×N, and each sub-block is independently histogram equalized to increase the local contrast. At the same time, the probability density of the grayscale level of the histogram of the sub-block is calculated by formula ①:
[0120] h(v)=∑ x,y∈itie δ(I(x,y)―v),v∈[0,L―1] ①
[0121] Where v is the grayscale value, δ(I(x,y)-v)=1 when I(x,y)=v, otherwise it is 0, and L is the number of grayscale levels.
[0122] Furthermore, since traditional histogram equalization may lead to excessive enhancement of high-frequency grayscale values, this application crops each of the histograms by setting a contrast limit threshold T to limit the frequency of each grayscale value, as shown in formula ②:
[0123]
[0124] Then the frequency values of the clipped parts are evenly distributed to all gray levels, as shown in formula ③:
[0125]
[0126] This method limits the contrast of each sub-block to avoid image distortion caused by over-enhancement.
[0127] Furthermore, the cumulative distribution function (CDF) of the clipped histogram is calculated to avoid excessive stretching of black, as shown in formula 4:
[0128]
[0129] Then the grayscale values in the histogram are mapped by normalizing the cumulative distribution, as shown in formula ⑤:
[0130]
[0131] Among them, CDF min is the minimum non-zero cumulative distribution value, used to avoid overstretching black.
[0132] Furthermore, the mapped sub-blocks are spliced together to form a spliced image. At the same time, for the boundary areas between the sub-blocks, in order to avoid obvious boundaries between the sub-block connections, bilinear interpolation can be used to achieve a smooth transition of the sub-block boundary areas, thereby obtaining an image with enhanced contrast.
[0133] Among them, the equalization results of the four neighboring sub-blocks of the sub-block where the pixel point (x, y) is located are:
[0134] I′1(x,y),I′2(x,y),I′3(x,y),I′4(x,y)
[0135] Then, the smooth transition of the sub-block boundary area is achieved through the interpolation formula ⑥:
[0136] I fam(x,y)=w1I′1(x,y)+w2I′2(x,y)+w3I′3(x,y)+w4I′4(x,y) ⑥
[0137] Among them, w1, w2, w3, and w4 are weights related to the sub-block distance, which satisfy w1+w2+w3+w4=1.
[0138] Furthermore, in order to make the edges of the stitched image clearer, canny is used to enhance the edges of the stitched image to improve the recognition of the target features in the image. fam Edge enhancement is mainly divided into edge strength and direction.
[0139] First, use formula ⑦ to perform convolution calculation on image I fam Gradient:
[0140] G x (x,y)=I fam (x,y)*K x ,G y (x,y)=I fam (x,y)*K y ⑦
[0141] Among them, K x and K y is the convolution kernel.
[0142] In terms of edge strength (or gradient amplitude), it is calculated using formula ⑧:
[0143]
[0144] In terms of edge direction, it is calculated by formula 9:
[0145]
[0146] Then, through local non-maximum suppression, only the strongest pixels in the gradient direction are retained to remove redundant edges. The specific method is as follows:
[0147] First, for each pixel, the gradient direction θ(x, y) is used to determine the comparison direction of its edge strength (gradient amplitude). That is, the angle between the gradient direction and the horizontal axis is usually quantized into four directions: 0°, 45°, 90°, and 135°.
[0148] Compare the gradient amplitude G(x,y) to see if it is the local maximum in the gradient direction. If it is not the local maximum, suppress it to 0. Assuming the gradient direction is θ(x,y), the adjacent pixels are:
[0149] Horizontal direction (0°): G(x―1,y) and G(x+1,y);
[0150] Diagonal direction (45°): G(x―1,y+1) and G(x+1,y―1);
[0151] Vertical direction (90°): G(x,y―1) and G(x,y+1);
[0152] Anti-diagonal direction (135°): G(x―1,y―1) and G(x+1,y+1);
[0153] Then compare in the gradient direction according to formula ⑩:
[0154]
[0155] This way, the pixels that are most like edges are retained and other redundant edges are removed.
[0156] Then, the edges are classified into strong edges, weak edges and non-edges by the double threshold method, and the strong edges are connected by weak edges to form the final edge part, so as to obtain the final edge area of the spliced image and thus obtain a new image. First, set the high threshold value T of the edge high and low threshold T low , and then classify the gradient magnitude G′(x,y):
[0157] Strong edge: G′(x,y)>T high
[0158] Weak edge: T low <G′(x,y)≤T high
[0159] Non-edge: G′(x,y)≤T low
[0160] Through the above threshold setting method, combined with classification rules:
[0161]
[0162] Edges can be classified. If a weak edge pixel is connected to a strong edge pixel, the edge is retained; otherwise, it is suppressed as a non-edge. After the above method, the final edge image E(x, y) is a combination of strong edges and partially connected weak edges, and is represented as the final edge region of the image, thus obtaining a new image.
[0163] Furthermore, since the new image is in the HSV color space, it is also necessary to convert the new image into the RGB space for easy viewing and analysis.
[0164] The image display module 400 displays the converted image;
[0165] Specifically, the converted new image is displayed by a display module, and then a doctor analyzes the converted new image and determines the location of the lesion.
[0166] Based on the above embodiment, the present invention also provides an intelligent terminal, whose principle block diagram is as follows: Figure 3 As shown, the above-mentioned intelligent terminal includes a processor, memory, network interface, and display screen connected via a system bus. The processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and an image processing program. The memory provides an environment for the operation of the operating system and image processing program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal via a network connection. When the image processing program is executed by the processor, the steps of any of the above-mentioned image processing methods are implemented. The display screen of the intelligent terminal can be a liquid crystal display or other display screen.
[0167] Those skilled in the art will understand that Figure 3 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the solution of the present invention and does not constitute a limitation on the smart terminal to which the solution of the present invention is applied. The specific smart terminal may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0168] In an embodiment of the present invention, a smart terminal is provided. The smart terminal includes a memory, a processor, and an image processing program stored in the memory and executable on the processor. When the image processing program is executed by the processor, the following operation instructions are performed:
[0169] Produce light of different wavelengths through a filter wheel;
[0170] Using the generated light as a light source to acquire a real-time target image;
[0171] The real-time target image is subjected to image denoising and color space conversion as the input image;
[0172] Divide the input image into multiple sub-blocks and perform histogram equalization on each sub-block;
[0173] Set a contrast limit threshold and clip each gray level of the histogram that exceeds the threshold, and distribute the clipped frequency to all gray levels;
[0174] Calculate the cumulative distribution function based on the cropped histogram and map the pixel values;
[0175] Use bilinear interpolation to smooth the boundaries between sub-blocks and merge the sub-blocks;
[0176] Enhance the edges of the merged image, retain the strongest pixels in the gradient direction, and remove redundant edges;
[0177] The edges are classified by the double threshold method, and the connected parts of weak edge pixels and strong edge pixels are retained to obtain the final edge area of the image to obtain a new image;
[0178] Perform color conversion on the new image and restore it to a normal image;
[0179] The converted image is displayed after color conversion.
[0180] An embodiment of the present invention further provides a computer-readable storage medium, on which an image processing program is stored. When the image processing program is executed by a processor, the steps of any one of the image processing methods provided in the embodiment of the present invention are implemented.
[0181] It should be understood that the present invention is described by way of some embodiments, and it will be appreciated by those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are intended to be protected by the present invention.
Claims
1. An image processing method, characterized in that: The steps include: Emitting light of different wavelengths through a light source module; Use the light emitted by the light source module as a light source to acquire a real-time image; Perform noise reduction and color space conversion on the acquired real-time images; The converted image is divided into multiple sub-blocks, and histogram equalization is performed independently on each sub-block to enhance the local contrast; Calculate the probability density of the grayscale level of the histogram of each sub-block, set the contrast limit threshold, clip the frequency of grayscale values above the contrast threshold and distribute them to all grayscale levels, and then form a merged image of the sub-blocks; Perform edge enhancement on the merged image to obtain a new image; The new image is converted into a normal image and displayed.
2. The image processing method according to claim 1, wherein: The process of performing edge enhancement on the merged image to obtain a new image further includes: The gradient is calculated by convolution to obtain the edge strength and edge direction of the merged image, and the edge strength is classified to obtain the edge of the final image.
3. The image processing method according to claim 2, wherein: After the edge strength and edge direction of the merged image are obtained by calculating the gradient through convolution, the method further includes: Through local non-maximum suppression, the strongest pixels in the edge intensity direction are retained and redundant edges are removed.
4. The image processing method according to claim 2, wherein: In the step of classifying the edge strength to obtain the edge of the final image, the method further comprises: The edges are classified into the first edge, the second edge and the third edge by using a cool threshold, and only the edge connected by the first edge and the second edge is retained as the final edge region of the image.
5. The image processing method according to claim 1, wherein: After the frequencies of gray values above the contrast threshold are clipped and distributed to all gray levels, the sub-image blocks are formed into a merged image, comprising: The clipped frequency values are evenly distributed to all gray levels, and the cumulative distribution function is calculated based on the clipped histogram and the pixel values are mapped. The cumulative distribution function formula is: The normalized cumulative distribution function is used in the process of mapping pixel values. The normalized cumulative distribution function formula is: Among them, CDF min is the smallest non-zero cumulative distribution value.
6. The image processing method according to claim 5, wherein: After calculating the cumulative distribution function based on the clipped histogram and mapping the pixel values, the method further includes: The boundaries between sub-blocks are smoothed by bilinear interpolation, which is based on weights related to the sub-block distance and the equalization results of the neighboring sub-blocks of the current sub-block. The interpolation formula is: Yo fam (x,y)=w1I′1(x,y)+w2I′2(x,y)+w3I′3(x,y)+w4I′4(x,y) Among them, w1, w2, w3, and w4 are weights related to the sub-block distance, satisfying w1+w2+w3+w4=1.
7. The image processing method according to claim 1, wherein: The process of emitting light of different wavelengths through the light source module includes: A broad spectrum light source for emitting light; The filter adjustment wheel is used to filter light of different wavelengths emitted by the broadband light source; The light outlet is used to emit the light filtered by the filter adjustment wheel.
8. An image processing system, characterized in that: include: A light source module, used to generate light of different wavelengths as a light source for acquiring a target image; An image acquisition module uses the light emitted by the light source module as a light source to acquire a real-time target image; The image processing module converts the real-time image and divides the converted image into multiple sub-blocks. It then performs histogram equalization on each sub-block to enhance the contrast of the sub-block. The sub-blocks are then merged and the edge enhancement is performed on the merged image to obtain a new image and convert it into a normal image. The image display module displays the converted image.
9. An intelligent terminal, characterized in that: The smart terminal includes at least one memory, at least one processor, and an image processing program stored in the memory and executable on the processor. When the image processing program is executed by the processor, the steps of the image processing method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores an image processing program, and when the image processing program is executed by the processor, the steps of the image processing method according to any one of claims 1 to 7 are implemented.
