CN120726059B - Traditional Chinese medicine tongue image recognition method and system based on image processing - Google Patents

Traditional Chinese medicine tongue image recognition method and system based on image processing

Info

Publication number
CN120726059B
CN120726059B CN202511250099.5A CN202511250099A CN120726059B CN 120726059 B CN120726059 B CN 120726059B CN 202511250099 A CN202511250099 A CN 202511250099A CN 120726059 B CN120726059 B CN 120726059B
Authority
CN
China
Prior art keywords
image
tongue
preprocessed
pixel
illumination
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202511250099.5A
Other languages
Chinese (zh)
Other versions
CN120726059A (en
Inventor
毛盈颖
杨绍雪
雷涵
叶丁
孙晓慧
张浩宇
胡思婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Chinese Medicine University ZCMU
Original Assignee
Zhejiang Chinese Medicine University ZCMU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Chinese Medicine University ZCMU filed Critical Zhejiang Chinese Medicine University ZCMU
Priority to CN202511250099.5A priority Critical patent/CN120726059B/en
Publication of CN120726059A publication Critical patent/CN120726059A/en
Application granted granted Critical
Publication of CN120726059B publication Critical patent/CN120726059B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0012Biomedical image inspection
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • G06V10/806Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Multimedia (AREA)
  • Medical Informatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Molecular Biology (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Databases & Information Systems (AREA)
  • Biomedical Technology (AREA)
  • Data Mining & Analysis (AREA)
  • Nuclear Medicine, Radiotherapy & Molecular Imaging (AREA)
  • Radiology & Medical Imaging (AREA)
  • Quality & Reliability (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本发明涉及图像处理技术领域,尤其是一种基于图像处理的中医舌像识别方法及系统,本发明在对首先采集舌底图像和舌面图像,然后对舌底图像和舌面图像进行常规的图像预处理操作以及光照校正,采取了不同的光照校正工作,对舌面图像采用线性变化法调节亮度;对舌底图像采用分块校正法实现光照校正,并且在对舌底图像进行光照校正时采用改进的高斯权重函数公式对每个小块独立进行光照估计,将梯度计算引入到分块图像的光照估计这一特定应用场景中,在对分块的舌底图像像素进行光照估计时,通过引入分块图像像素梯度项,使得改进的高斯权重函数能根据每块舌底图像的图像细节确定高斯权重函数改进项,使得估计的像素更好地保留舌底图像的细节信息。

This invention relates to the field of image processing technology, and in particular to a method and system for TCM tongue image recognition based on image processing. The invention first acquires images of the tongue base and tongue surface, then performs conventional image preprocessing and illumination correction on these images. Different illumination correction methods are employed: a linear variation method is used to adjust the brightness of the tongue surface image; a block-based correction method is used to correct the illumination of the tongue base image. Furthermore, an improved Gaussian weighting function formula is used to independently estimate the illumination of each small block during illumination correction of the tongue base image. Gradient calculation is introduced into the specific application scenario of illumination estimation for block images. When estimating the illumination of pixels in the block-based tongue base image, the introduction of a pixel gradient term allows the improved Gaussian weighting function to determine the improved term based on the image details of each block of the tongue base image, resulting in estimated pixels that better preserve the detailed information of the tongue base image.

Description

Traditional Chinese medicine tongue image recognition method and system based on image processing
Technical Field
The invention relates to the technical field of image processing, in particular to a traditional Chinese medicine tongue image recognition method and system based on image processing.
Background
The traditional tongue diagnostic method of traditional Chinese medicine mainly relies on subjective visual observation and experience accumulation of doctors, which has a plurality of limitations. First, there may be differences in the observation and judgment of tongue images between different physicians, resulting in inconsistent diagnostic results. Secondly, the experience level of the doctor has a great influence on the accuracy of diagnosis, and the accuracy of tongue diagnosis of the doctor with abundant experience is often far from that of a beginner. In addition, subtle changes in tongue images can be difficult to capture accurately by the naked eye, thereby affecting the accuracy of the diagnosis. Moreover, in an actual medical scenario, a physician needs to diagnose a large number of patients in a short time, which may lead to insufficient scrutiny in observation, thereby affecting the quality of diagnosis.
With the continuous progress of technology, image recognition technology is widely applied in a plurality of fields, and the application of the image recognition technology in the medical field is also focused gradually, so that the image recognition technology can accurately analyze and recognize various features in images, and provides possibility for objectively and accurately diagnosing diseases. In the field of tongue image diagnosis of traditional Chinese medicine, tongue image is acquired, processed and analyzed by utilizing an image recognition technology, so that the defect of a traditional method is hopeful to be overcome, and the standardization and objectification of tongue image diagnosis are realized.
The digitization and intellectualization of tongue diagnosis in traditional Chinese medicine have been advanced to some extent. For example, chen Keju et al propose a traditional Chinese medicine pattern recognition model (SI-MTF) based on multi-view tongue image feature fusion, which is characterized in that a large number of tongue surface and tongue bottom images are collected, the color, shape and texture features of tongue images are extracted by using a deep learning technology, and the fusion capability of the model to the tongue surface and tongue bottom features is improved by combining with a college-hospital network, so that the intelligent recognition of the traditional Chinese medicine pattern is finally realized. Zeng Lili et al propose a cross-task transfer learning tongue diagnostic method (M2T-Net) based on multi-source data, and through multi-source data pre-training and a cross-attention mechanism, accurate classification of coronary heart disease and patients with diabetes is achieved. Zhang Mo et al explored the intelligent application of traditional Chinese medicine tongue diagnosis based on a multi-mode large model, and realized the efficient diagnosis of helicobacter pylori infection by utilizing the multi-mode large model through combining tongue image and doctor preliminary description.
However, when the tongue image is preprocessed by the traditional Chinese medicine tongue image diagnosis method, the tongue image comprises a tongue surface image and a tongue bottom image, and the positions of the tongue image are different, so that the illumination in the acquisition process is different, and the problem of low preprocessing accuracy exists in the image preprocessing flow in the prior art.
Disclosure of Invention
In order to solve the technical problems, the invention provides a traditional Chinese medicine tongue image identification method and system based on image processing, which are used for solving the problems existing in the prior art.
The invention provides a traditional Chinese medicine tongue image identification method based on image processing, which comprises the following steps:
s1, collecting tongue surface and tongue bottom images through image collecting equipment;
S2, performing first image preprocessing operation on the lingual surface and the lingual bottom image to obtain a first preprocessed lingual surface image and a first preprocessed lingual bottom image;
s3, performing second image preprocessing operation on the first preprocessed tongue surface image and the first preprocessed tongue bottom image to obtain a second preprocessed tongue surface image and a second preprocessed tongue bottom image;
The second image preprocessing operation specifically comprises the steps of adopting a linear change method to adjust the brightness of the first preprocessed tongue surface image for the first preprocessed tongue surface image;
the implementation of illumination correction on the first preprocessed tongue bottom image by adopting a block correction method is specifically as follows:
Sa dividing the first preprocessed tongue bottom image into a plurality of small blocks;
sb, adopting an improved Gaussian weight function formula to independently carry out illumination estimation on each small block;
Sc, carrying out image correction on each small block according to the pixel local illumination estimated value of each small block;
And Sd, carrying out image fusion on each corrected small block to realize illumination correction on the first preprocessed tongue bottom image by adopting a block correction method.
S4, inputting the second preprocessed tongue surface image and the second preprocessed tongue bottom image into a tongue image recognition model to obtain a tongue image recognition result.
Preferably, in Sb, a local weighted average method is used to calculate an illumination estimation component, different weights are given to the neighborhood of each pixel of each small block according to the distance between the pixel and the center pixel, and the illumination estimation component of the pixel is obtained by calculating the weighted average value of the gray values of the pixels in the neighborhood, where the specific formula is as follows:
;
Where N (x, y) is a neighborhood centered on pixel (x, y), I (I, j) is a gray value of pixel (I, j), w (I, j) is a weight of pixel (I, j), and I illumination (I, j) is an illumination estimation component of pixel (I, j).
Preferably, the modified gaussian weight function formula is:
;
Where w (i, j) is the weight, (x, y) is the position of the center pixel, (i, j) is the pixel position in the neighborhood, σ is the standard deviation of the Gaussian weight function, Is the gradient value at pixel (i, j) for each image,Is the maximum value of the gradient of each image.
Preferably, the Sd is specifically that different weights are given to the overlapping region of the small blocks according to the distance between each pixel and the center of the small block, smooth fusion is carried out, the weight is calculated by adopting the improved Gaussian weight function formula, and the fused pixel value I fused(i,j) of the overlapping region is calculated according to the weight;
The specific formula is as follows:
;
Where I corrected,k (I, j) is the gray value of the corrected image of the kth patch at pixel (I, j), and w k (I, j) is the weight of the kth patch at pixel (I, j).
Preferably, the first image preprocessing operation includes image denoising, image segmentation, and image enhancement.
Preferably, the image denoising is to remove random noise in an image by adopting median filtering, the image is segmented into extracting tongue contours in the tongue surface image by adopting a Canny edge detection algorithm, and the tongue contours in the tongue bottom image are extracted by adopting a segmentation method based on a color threshold value.
Preferably, the tongue outline in the tongue bottom image is extracted by a segmentation method based on a color threshold, specifically, the tongue bottom image is converted from RGB to HSV color space by using a color space conversion function, the color threshold is set according to the color characteristics of the tongue bottom image, the tongue bottom image is segmented by using the color threshold, the pixels meeting the conditions are set to be white, and other pixels are set to be black, so that a tongue area is extracted.
Preferably, the color threshold is set according to the color characteristics of the sublingual image, specifically, a histogram analysis tool is used for observing the color distribution of the sublingual image in an HSV color space, then a typical color range of the sublingual is selected according to the observation result, and the color threshold range is set according to the typical color range.
Preferably, the color threshold range is:
H (hue) 0 to 30 degrees;
s (saturation) 0 to 100 degrees;
V (brightness) 100 to 255 degrees.
According to another aspect of the present invention, there is provided an image processing-based tongue image recognition system of traditional Chinese medicine, the system adopting the above-mentioned image processing-based tongue image recognition method, the system comprising:
the image acquisition equipment acquires tongue surface and tongue bottom images;
The first preprocessing module is used for performing first image preprocessing operation on the lingual surface and the lingual bottom image to obtain a first preprocessed lingual surface image and a first preprocessed lingual bottom image;
the second preprocessing module is used for performing second image preprocessing operation on the first preprocessed tongue surface image and the first preprocessed tongue bottom image to obtain a second preprocessed tongue surface image and a second preprocessed tongue bottom image;
The tongue image recognition module is used for inputting the second preprocessed tongue image and the second preprocessed tongue bottom image into a tongue image recognition model to obtain a tongue image recognition result.
The embodiment of the invention has the following technical effects:
the invention firstly collects the tongue bottom image and the tongue surface image, then carries out conventional image preprocessing operation and illumination correction work on the tongue bottom image and the tongue surface image, wherein in the illumination correction process, according to the difference of sensitivity of illumination conditions caused by different structures and position characteristics of the tongue surface and the tongue bottom, different illumination correction works are adopted to adjust brightness of the tongue surface image by adopting a linear change method, illumination correction is realized on the tongue bottom image by adopting a block correction method, and illumination estimation is independently carried out on each small block by adopting an improved Gaussian weight function formula when the illumination correction is carried out on the tongue bottom image, gradient calculation is introduced into a specific application scene of illumination estimation of the block image, and when illumination estimation is carried out on the pixels of the block tongue bottom image, the improved Gaussian weight function can determine a Gaussian weight function improvement item according to image details of each block tongue bottom image by introducing the gradient item of the block image, thereby improving the processing pertinence of illumination estimation and further ensuring that detail information of the tongue bottom image better remains.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for recognizing a tongue image of traditional Chinese medicine based on image processing according to an embodiment of the present invention;
FIG. 2 is a flowchart for implementing illumination correction on the first preprocessed tongue bottom image by using a block correction method according to an embodiment of the present invention;
Fig. 3 is a comparison of a tongue surface image before and after preprocessing provided in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the invention, are within the scope of the invention.
Embodiment 1, fig. 1 shows a flowchart of a method for identifying a tongue image of traditional Chinese medicine based on image processing, and as shown in fig. 1, the method for identifying a tongue image of traditional Chinese medicine based on image processing comprises the following steps:
s1, collecting tongue surface and tongue bottom images through image collecting equipment;
The image acquisition equipment comprises a high-resolution camera, a uniform light source and image acquisition software;
The high-resolution camera is used for shooting tongue surface and tongue bottom images, the high-resolution camera is required to have high resolution so as to ensure that fine features of tongue images, such as tongue color, tongue coating color, tongue shape, tongue coating quality and the like, can be clearly captured, and meanwhile, the high-resolution camera is required to have an automatic focusing function so as to adapt to tongue positions and shapes of different patients.
The uniform light source is used for providing stable illumination conditions, can ensure the color accuracy and consistency of tongue image, and reduce the image quality degradation caused by uneven illumination.
The image acquisition software is used for controlling shooting parameters of the camera and the acquisition process of the image, and has the function of automatically adjusting shooting angles and light rays, so that the acquired tongue image is clear and stable.
Wherein, the process of collecting the lingual surface and the lingual bottom image comprises the following steps:
and initializing equipment, namely starting the image acquisition equipment before the tongue surface and tongue bottom images are acquired, and ensuring that the high-resolution camera and the uniform light source are in a normal working state.
And the tongue image acquisition is that a tongue image to be acquired stretches out of a tongue, an operator controls the camera to shoot tongue image through the image acquisition software, the tongue image comprises a tongue surface and a tongue bottom image, and the image acquisition software can automatically adjust the shooting angle of the camera and the intensity of the light source to ensure that the acquired tongue image is clear and stable.
S2, performing first image preprocessing operation on the lingual surface and the lingual bottom image to obtain a first preprocessed lingual surface image and a first preprocessed lingual bottom image;
The first image preprocessing operation comprises image denoising, image segmentation and image enhancement;
in the step, the image denoising is to remove random noise in the image by adopting median filtering, and the basic principle is that each pixel value in the image is replaced by the median in the neighborhood of the pixel, so that the purposes of smoothing the image and removing noise are achieved.
The image segmentation is to extract tongue contours in the tongue surface image by adopting a Canny edge detection algorithm, and the tongue contours in the tongue bottom image are extracted by adopting a segmentation method based on a color threshold;
More further, a Canny edge detection algorithm is adopted to extract the tongue outline in the tongue face image, specifically, gradient calculation is conducted on the tongue face image, gradient intensity and direction of each pixel in the tongue face image are calculated, for each pixel, a neighborhood pixel in the gradient direction of the pixel is checked, if the gradient value of the pixel is not a local maximum value, the gradient value of the pixel is set to be 0, two thresholds are set, a high threshold is used for detecting a strong edge, a low threshold is used for detecting a weak edge, the strong edge and the weak edge are connected through an edge tracking algorithm to form a complete edge, and the Canny edge detection algorithm can effectively extract the tongue outline in the tongue face image through the steps.
Specifically, gradient calculation is carried out on the lingual image, and the gradient intensity and the direction of each pixel in the lingual image are calculated by using a Sobel operator, namely, the gradient of the lingual image in the horizontal direction and the vertical direction is calculated respectively, and then the gradient intensity and the direction of each pixel in the lingual image are calculated.
The blood vessel texture and the color characteristics of the tongue bottom image are obvious, the tongue outline can be extracted through color threshold segmentation, and the tongue outline in the tongue bottom image is extracted by adopting a segmentation method based on the color threshold, specifically, the tongue bottom image is converted into an HSV color space from RGB by using a color space conversion function;
The color of the tongue bottom is usually lighter, pink or light red, the vein texture of the tongue bottom is more obvious, the color is darker, the tongue contour can be effectively extracted according to the color characteristics of the tongue bottom image, and in order to better perform color segmentation, the tongue bottom image is usually required to be converted from an RGB color space to an HSV color space, and the HSV color space is a common choice, because color information and brightness information are separated, so that the setting of a color threshold Value is convenient, wherein H (Hue) is Hue in the HSV color space, the color is represented by the type of the color, S (Saturation) is Saturation, the purity of the color is represented, and V (Value) is brightness, and the brightness of the color is represented by the brightness.
Observing the color distribution of the tongue bottom image in an HSV color space by using a histogram analysis tool, selecting a typical color range of the tongue bottom according to an observation result, and setting a proper color threshold range according to the typical color range;
exemplary, typical colors for the tongue base are typically between pink and reddish, corresponding to H values ranging from 0 to 30 degrees, S values ranging from 0 to 100, and V values ranging from 100 to 255, and thus, the suitable color threshold ranges are:
H (hue) 0 to 30 degrees;
s (saturation) 0 to 100 degrees;
v (brightness) 100 to 255 degrees;
The tongue region is extracted by dividing the tongue bottom image by using the color threshold value, setting the pixels conforming to the condition to be white and setting other pixels to be black, namely, dividing the tongue bottom image by using the color threshold value range, extracting the pixels in the color threshold value range, setting the extracted pixels to be white (255) and setting the other pixels to be black (0), generating a binary image, perfecting the extracted contour through morphological operations such as expansion, corrosion, open operation, closed operation and the like, and removing noise and irregular parts.
Through the steps, the tongue outline in the sublingual image can be effectively extracted, the outline is perfected through morphological operation, and more accurate data support is provided for subsequent feature extraction and analysis.
Image enhancement is an important step in image preprocessing, and aims to improve the visual effect of the lingual image and the lingual image, enhance useful information in the image, improve the identifiability of the image, and histogram equalization is a common image enhancement technology, and is particularly suitable for improving the contrast of the image, thereby enhancing the texture and color characteristics of the image. Further, the image enhancement of the lingual and sublingual images is specifically:
the method comprises the steps of calculating the pixel number of each gray value in the lingual surface and lingual bottom images, calculating a cumulative histogram, namely calculating a Cumulative Distribution Function (CDF) of the histogram to obtain the cumulative histogram, and mapping the gray value of an original image to a new gray value according to the cumulative histogram to enable the new gray value to be distributed more uniformly, so that image enhancement is achieved.
S3, performing second image preprocessing operation on the first preprocessed tongue surface image and the first preprocessed tongue bottom image to obtain a second preprocessed tongue surface image and a second preprocessed tongue bottom image;
The tongue surface and the tongue bottom have different structural characteristics, the tongue surface is relatively flat, the tongue bottom has more folds and vascular textures, so that when the tongue surface image and the tongue bottom image are shot, the tongue surface and the tongue bottom have different reflection and absorption characteristics on illumination, and the sensitivity of the tongue surface and the tongue bottom to illumination conditions is different, so that effective illumination correction is necessary for accurately extracting tongue image features.
The second image preprocessing operation specifically comprises the steps of adjusting the brightness of the first preprocessed tongue surface image by adopting a linear change method, and realizing illumination correction on the first preprocessed tongue bottom image by adopting a block correction method;
Setting a target brightness range, and adjusting the gray value of the first preprocessing tongue surface image to be within the target brightness range by adopting a linear transformation formula so as to realize the brightness adjustment of the first preprocessing tongue surface image;
In this embodiment, the target luminance range is [ mean-offset, mean+offset ], where mean is the target average luminance of the first preprocessed tongue image, and offset is a preset offset value;
the linear transformation formula is as follows:
;
Wherein, I old is the gray value of the first preprocessing tongue image, I new is the gray value of the adjusted first preprocessing tongue image, the brightness of the image can be adjusted to be within a target range by the formula, so that the whole brightness of the image is more uniform, and fig. 3 shows a comparison chart of the tongue image before preprocessing and after preprocessing, as can be seen from fig. 3, the accurate adjustment of the tongue image brightness can be realized by the first preprocessing flow of the embodiment.
Because the tongue bottom image has more folds and vascular textures, the illumination correction needs to process local illumination change more carefully, so as shown in fig. 2, the illumination correction is specifically implemented by adopting a block correction method on the first preprocessed tongue bottom image:
Sa dividing the first preprocessed tongue bottom image into a plurality of small blocks;
Specifically, in this step, the size of the small blocks may be adjusted according to the resolution of the first preprocessed tongue bottom image, and the image may be divided into small blocks of 32×32 or 64×64, for example, and a certain overlapping area is ensured between the small blocks during the blocking so as to perform smoothing in a subsequent fusion process, where the size of the overlapping area may be adjusted according to the size of the small blocks, and is typically 1/4 to 1/2 of the side length of the small blocks.
Sb, adopting an improved Gaussian weight function formula to independently carry out illumination estimation on each small block;
in the step, a local weighted average method is adopted to estimate illumination components, different weights are given in the neighborhood of each pixel of each small block according to the distance between the pixel and a central pixel, the closer the distance is, the larger the weight is, and the illumination estimated components of the pixel are obtained by calculating the weighted average value of the gray values of the pixels in the neighborhood, wherein the specific formula is as follows:
;
Where N (x, y) is a neighborhood centered on pixel (x, y), w (I, j) is the weight of pixel (I, j), and I illumination (I, j) is the illumination estimation component of pixel (I, j);
In this step, the determination of the weights has a large influence on the calculation of the illumination estimation values, and the weights are generally calculated by using a Gaussian function in the prior art, namely
;
However, for a sublingual image, the method comprises more detail information such as more folds and vascular textures, and the like, and the Gaussian weight function can cause loss of some detail information when processing the edge and detail parts of the image, so that in order to improve the point, the embodiment provides an improved technical scheme for determining the weight by the Gaussian weight function;
wherein the improved Gaussian weight function formula is:
;
where w (i, j) is the weight, (x, y) is the position of the center pixel, (i, j) is the pixel position in the neighborhood, σ is the standard deviation of the Gaussian weight function, Is the gradient value at pixel (i, j) for each image,Is the maximum value of each image gradient;
According to the improved Gaussian weight function formula, gradient calculation is introduced into a specific application scene of illumination estimation of the segmented image, when illumination estimation is carried out on pixels of the segmented sublingual image, the improved Gaussian weight function can determine Gaussian weight function improvement items according to image details of each sublingual image by introducing the gradient items of the pixels of the segmented image under the condition that the details contained in each segmented image are different, so that the processing pertinence in illumination estimation is improved, and the estimated pixels can better retain the detail information of the sublingual image.
Sc, carrying out image correction on each small block according to the pixel local illumination estimated value of each small block;
and obtaining the corrected image of each small block by dividing the pixel gray value of the original image by the illumination estimation component.
And Sd, carrying out image fusion on each corrected small block to realize illumination correction on the first preprocessed tongue bottom image by adopting a block correction method.
In the fusion process, the main point to be noted is the smooth processing of the edges of the small blocks to avoid obvious splicing marks, so that Sd is specifically that different weights are given to the overlapped areas of the small blocks according to the distance between each pixel and the center of the small blocks, smooth fusion is carried out, the weights are calculated by adopting the improved Gaussian weight function formula, and the fused pixel values of the overlapped areas are calculated according to the weights;
The specific formula is as follows:
;
Where I corrected,k (I, j) is the gray value of the corrected image of the kth patch at pixel (I, j), and w k (I, j) is the weight of the kth patch at pixel (I, j).
In the step, the weight is gradually reduced in the edge area of the small block, so that obvious splicing marks are avoided, and meanwhile, the gray value transition of the fused image in the edge area is ensured to be natural through the smooth attenuation characteristic of the improved Gaussian weight function.
S4, inputting the second preprocessed tongue surface image and the second preprocessed tongue bottom image into a tongue image recognition model to obtain a tongue image recognition result.
In tongue image recognition, a Convolutional Neural Network (CNN) is one of the most commonly used deep learning models, and the CNN has strong feature extraction capability and can automatically learn complex patterns and features in an image, so that the image recognition model of the embodiment is a convolutional neural network model.
The convolutional neural network model comprises a plurality of convolutional layers, a pooling layer and a full-connection layer, wherein the convolutional layers can automatically extract features in an image, the convolutional layers slide on the image through convolutional kernels to extract local features, each convolutional kernel extracts a specific feature such as edges, textures and the like, the pooling layer is used for reducing the space dimension of a feature map, reducing the calculated amount and simultaneously keeping important features, the full-connection layer flattens the feature map into a one-dimensional vector, classification tasks are carried out through a multi-layer neural network, and the output of the full-connection layer is the final prediction result of the image recognition model.
When the convolutional neural network model is adopted for tongue image recognition, the convolutional neural network model needs to be trained by using labeled tongue image data, and in the training process, the weight of the convolutional neural network model is updated through a back propagation algorithm, so that a loss function is minimized, and in the embodiment, the loss function adopts a cross entropy loss function;
In addition, in the training process, super parameters of the convolutional neural network model, such as learning rate, batch size, optimizer and the like, are adjusted so as to improve the training effect of the model.
The tongue image recognition result comprises pale red tongue, pale white tongue, red tongue, dark red tongue, white tongue coating, yellow tongue coating, gray tongue coating, black tongue coating, fat tongue shape, thin tongue shape, tooth trace and crack tongue shape.
By inputting tongue images into a trained deep learning model, automatic Chinese medicine image recognition can be realized, the convolutional neural network model has strong feature extraction capability, complex modes and features in the images can be automatically learned, the accuracy and the efficiency of image recognition are improved, and powerful support is provided for Chinese medicine image recognition.
Embodiment 2 of the present invention further provides an image processing-based tongue image recognition system, where the system adopts the image processing-based tongue image recognition method of embodiment 1, and the system includes:
the image acquisition equipment acquires tongue surface and tongue bottom images;
The first preprocessing module is used for performing first image preprocessing operation on the lingual surface and the lingual bottom image to obtain a first preprocessed lingual surface image and a first preprocessed lingual bottom image;
the second preprocessing module is used for performing second image preprocessing operation on the first preprocessed tongue surface image and the first preprocessed tongue bottom image to obtain a second preprocessed tongue surface image and a second preprocessed tongue bottom image;
The tongue image recognition module is used for inputting the second preprocessed tongue image and the second preprocessed tongue bottom image into a tongue image recognition model to obtain a tongue image recognition result.
Embodiment 3 the present invention also provides an electronic device comprising one or more processors and memory.
The processor may be a Central Processing Unit (CPU) or other form of processing unit having data processing and/or instruction execution capabilities, and may control other components in the electronic device to perform the desired functions.
The memory may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, random Access Memory (RAM) and/or cache memory (cache), and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like. One or more computer program instructions may be stored on the computer readable storage medium and executed by a processor to perform a method of recognition of a tongue image in traditional Chinese medicine and/or other desired functions based on image processing in accordance with any of the embodiments of the present application described above. Various content such as initial arguments, thresholds, etc. may also be stored in the computer readable storage medium.
In one example, the electronic device may also include an input device and an output device, which are interconnected by a bus system and/or other form of connection mechanism (not shown). The input means may comprise, for example, a keyboard, a mouse, etc. The output device can output various information to the outside, including early warning prompt information, braking force and the like. The output means may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, etc.
Of course, components such as buses, input/output interfaces, etc. are omitted for simplicity. In addition, the electronic device may include any other suitable components depending on the particular application.
In addition to the methods and apparatus described above, embodiments of the present application may also be a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to implement the functions of a method for identifying a tongue image of traditional Chinese medicine based on image processing provided by any of the embodiments of the present application.
The computer program product may write program code for performing operations of embodiments of the present application in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server.
In addition, an embodiment of the present application may also be a computer readable storage medium, on which computer program instructions are stored, which when executed by a processor, cause the processor to implement a method for identifying a tongue image of traditional Chinese medicine based on image processing provided by any embodiment of the present application.
The computer readable storage medium may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of a readable storage medium include an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
It should be noted that the above embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that the technical solution described in the above embodiments may be modified or some or all of the technical features may be equivalently replaced, and these modifications or substitutions do not deviate the essence of the corresponding technical solution from the technical solution of the embodiments of the present invention.

Claims (9)

1.一种基于图像处理的中医舌像识别方法,其特征在于,包括以下步骤:1. A method for TCM tongue image recognition based on image processing, characterized by comprising the following steps: S1:通过图像采集设备采集舌面图像和舌底图像;S1: Acquire images of the tongue surface and tongue underside using an image acquisition device; S2:对所述舌面和舌底图像进行第一图像预处理操作,得到第一预处理舌面图像和第一预处理舌底图像;S2: Perform a first image preprocessing operation on the tongue surface and tongue underside images to obtain a first preprocessed tongue surface image and a first preprocessed tongue underside image; S3:对所述第一预处理舌面图像和所述第一预处理舌底图像进行第二图像预处理操作,得到第二预处理舌面图像和第二预处理舌底图像;S3: Perform a second image preprocessing operation on the first preprocessed tongue surface image and the first preprocessed tongue underside image to obtain a second preprocessed tongue surface image and a second preprocessed tongue underside image; 所述第二图像预处理操作具体为:对所述第一预处理舌面图像采用线性变化法调节所述第一预处理舌面图像的亮度;对所述第一预处理舌底图像采用分块校正法实现光照校正;The second image preprocessing operation specifically involves: adjusting the brightness of the first preprocessed tongue surface image using a linear transformation method; and performing illumination correction on the first preprocessed tongue underside image using a block correction method. 对所述第一预处理舌底图像采用分块校正法实现光照校正具体为:The illumination correction for the first preprocessed tongue image is achieved using a block-based correction method, specifically as follows: Sa:将所述第一预处理舌底图像划分为多个小块;Sa: Divide the first preprocessed tongue underside image into multiple small blocks; Sb:采用改进的高斯权重函数公式对每个小块独立进行光照估计;所述Sb中,采用局部加权平均法进行光照估计分量计算,在每个小块的每个像素的邻域内,根据像素与中心像素的距离赋予不同的权重,通过计算邻域内像素灰度值的加权平均值,得到该像素的光照估计分量;具体公式为:Sb: An improved Gaussian weighting function formula is used to independently estimate the illumination for each small block; in Sb, a local weighted average method is used to calculate the illumination estimation component. Within the neighborhood of each pixel in each small block, different weights are assigned based on the distance between the pixel and the center pixel. The illumination estimation component of the pixel is obtained by calculating the weighted average of the pixel grayscale values within the neighborhood; the specific formula is as follows: ; 其中,N(x,y)是以像素(x,y)为中心的邻域,I(i,j) 是像素 (i,j) 的灰度值,w(i,j)是像素(i,j)的权重,Iillumination(i,j) 是像素 (i,j) 的光照估计分量;Where N(x,y) is the neighborhood centered at pixel (x,y), I(i,j) is the gray value of pixel (i,j), w(i,j) is the weight of pixel (i,j), and I illumination (i,j) is the illumination estimation component of pixel (i,j). Sc:根据每个小块的像素局部光照估计值,对每个小块进行图像校正;Sc: Perform image correction on each small block based on the pixel local illumination estimate of each small block; Sd:将校正后的每个小块进行图像融合,实现对所述第一预处理舌底图像采用分块校正法实现光照校正;Sd: Image fusion is performed on each corrected small block to achieve illumination correction of the first preprocessed tongue image using a block correction method; S4:将所述第二预处理舌面图像和所述第二预处理舌底图像输入至舌像识别模型中,得到舌像识别结果。S4: Input the second preprocessed tongue surface image and the second preprocessed tongue underside image into the tongue image recognition model to obtain the tongue image recognition result. 2.根据权利要求1所述的基于图像处理的中医舌像识别方法,其特征在于:2. The TCM tongue image recognition method based on image processing according to claim 1, characterized in that: 所述改进的高斯权重函数公式为:The improved Gaussian weighting function formula is as follows: ; 式中,w(i,j)为像素 (i,j) 的权重,(x,y)是中心像素的位置,(i,j)是邻域内的像素位置,σ是高斯权重函数的标准差,是每块图像在像素(i,j)处的梯度值,是每块图像梯度的最大值。In the formula, w(i,j) is the weight of pixel (i,j), (x,y) is the position of the center pixel, (i,j) is the position of the neighboring pixel, and σ is the standard deviation of the Gaussian weight function. It is the gradient value of each image at pixel (i,j). It is the maximum value of the gradient for each image block. 3.根据权利要求1所述的基于图像处理的中医舌像识别方法,其特征在于:3. The TCM tongue image recognition method based on image processing according to claim 1, characterized in that: 所述Sd具体为:在小块的重叠区域,根据每个像素距离小块中心的距离赋予不同的权重,进行平滑融合,采用所述改进的高斯权重函数公式计算权重,根据所述权重计算重叠区域的融合后的像素值Ifused(i,j)Specifically, Sd is as follows: in the overlapping area of small blocks, different weights are assigned to each pixel according to the distance of each pixel from the center of the small block, and smooth fusion is performed. The weights are calculated using the improved Gaussian weight function formula, and the fused pixel value I fused(i,j) of the overlapping area is calculated according to the weights. 具体公式为:The specific formula is as follows: ; 其中,Icorrected,k(i,j)是第k个小块的校正图像在像素(i,j)处的灰度值,wk(i,j)是第k个小块在像素(i,j)的权重。Where I corrected,k (i,j) is the gray value of the corrected image of the k-th block at pixel (i,j), and wk (i,j) is the weight of the k-th block at pixel (i,j). 4.根据权利要求1所述的基于图像处理的中医舌像识别方法,其特征在于:4. The TCM tongue image recognition method based on image processing according to claim 1, characterized in that: 所述第一图像预处理操作包括图像去噪、图像分割以及图像增强。The first image preprocessing operation includes image denoising, image segmentation, and image enhancement. 5.根据权利要求4所述的基于图像处理的中医舌像识别方法,其特征在于:所述图像去噪为采用中值滤波去除图像中的随机噪声,所述图像分割为采用Canny边缘检测算法提取所述舌面图像中的舌头轮廓,采用基于颜色阈值的分割方法提取所述舌底图像中的舌头轮廓。5. The TCM tongue image recognition method based on image processing according to claim 4, characterized in that: the image denoising is performed by removing random noise in the image using median filtering; the image segmentation is performed by extracting the tongue contour in the tongue surface image using the Canny edge detection algorithm; and the tongue contour in the tongue base image is extracted using a color threshold-based segmentation method. 6.根据权利要求5所述的基于图像处理的中医舌像识别方法,其特征在于:6. The TCM tongue image recognition method based on image processing according to claim 5, characterized in that: 采用基于颜色阈值的分割方法提取所述舌底图像中的舌头轮廓具体为:使用颜色空间转换函数将所述舌底图像从RGB转换到HSV颜色空间;根据所述舌底图像的颜色特征设置颜色阈值;使用所述颜色阈值对所述舌底图像进行分割,将符合条件的像素设置为白色,其他像素设置为黑色,从而提取出舌头区域。The tongue contour extracted from the tongue image using a color threshold-based segmentation method is as follows: the tongue image is converted from RGB to HSV color space using a color space conversion function; a color threshold is set according to the color characteristics of the tongue image; the tongue image is segmented using the color threshold, and pixels that meet the conditions are set to white, while other pixels are set to black, thereby extracting the tongue region. 7.根据权利要求6所述的基于图像处理的中医舌像识别方法,其特征在于:7. The TCM tongue image recognition method based on image processing according to claim 6, characterized in that: 根据所述舌底图像的颜色特征设置颜色阈值具体为:使用直方图分析工具观察所述舌底图像在HSV颜色空间中的颜色分布,然后根据观察结果,选择舌底的典型颜色范围,根据所述典型颜色范围设置颜色阈值范围。Setting the color threshold based on the color characteristics of the tongue image involves: using a histogram analysis tool to observe the color distribution of the tongue image in the HSV color space, then selecting a typical color range for the tongue based on the observation results, and setting the color threshold range based on the typical color range. 8.根据权利要求7所述的基于图像处理的中医舌像识别方法,其特征在于:8. The TCM tongue image recognition method based on image processing according to claim 7, characterized in that: 所述颜色阈值范围为:The color threshold range is: 色调:0到30度;Hue: 0 to 30 degrees; 饱和度:0到100度;Saturation: 0 to 100 degrees; 亮度:100到255度。Brightness: 100 to 255 degrees. 9.一种基于图像处理的中医舌像识别系统,其特征在于,所述系统采用权利要求1-8任一项所述的基于图像处理的中医舌像识别方法,所述系统包括:9. A TCM tongue image recognition system based on image processing, characterized in that the system employs the TCM tongue image recognition method based on image processing as described in any one of claims 1-8, and the system comprises: 图像采集设备,采集舌面和舌底图像;Image acquisition device to capture images of the tongue surface and underside; 第一预处理模块,用于对所述舌面和舌底图像进行第一图像预处理操作,得到第一预处理舌面图像和第一预处理舌底图像;The first preprocessing module is used to perform a first image preprocessing operation on the tongue surface and tongue underside images to obtain a first preprocessed tongue surface image and a first preprocessed tongue underside image. 第二预处理模块,用于对所述第一预处理舌面图像和所述第一预处理舌底图像进行第二图像预处理操作,得到第二预处理舌面图像和第二预处理舌底图像;The second preprocessing module is used to perform a second image preprocessing operation on the first preprocessed tongue surface image and the first preprocessed tongue underside image to obtain a second preprocessed tongue surface image and a second preprocessed tongue underside image. 舌像识别模块,用于将所述第二预处理舌面图像和所述第二预处理舌底图像输入至舌像识别模型中,得到舌像识别结果。The tongue image recognition module is used to input the second preprocessed tongue surface image and the second preprocessed tongue underside image into the tongue image recognition model to obtain the tongue image recognition result.
CN202511250099.5A 2025-09-03 2025-09-03 Traditional Chinese medicine tongue image recognition method and system based on image processing Active CN120726059B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202511250099.5A CN120726059B (en) 2025-09-03 2025-09-03 Traditional Chinese medicine tongue image recognition method and system based on image processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202511250099.5A CN120726059B (en) 2025-09-03 2025-09-03 Traditional Chinese medicine tongue image recognition method and system based on image processing

Publications (2)

Publication Number Publication Date
CN120726059A CN120726059A (en) 2025-09-30
CN120726059B true CN120726059B (en) 2025-11-21

Family

ID=97162890

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202511250099.5A Active CN120726059B (en) 2025-09-03 2025-09-03 Traditional Chinese medicine tongue image recognition method and system based on image processing

Country Status (1)

Country Link
CN (1) CN120726059B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111681238A (en) * 2020-06-12 2020-09-18 电子科技大学 A method and system for tooth mark tongue recognition based on neural network
CN118824523A (en) * 2024-08-09 2024-10-22 南京师范大学 A deep learning-based method for analyzing the tongue base and tongue surface images in the four diagnostic methods of traditional Chinese medicine
CN119251122A (en) * 2024-12-05 2025-01-03 大连冉星信息科技有限公司 A computer vision-based image enhancement method for TCM diagnosis

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110807775A (en) * 2018-08-06 2020-02-18 深圳市前海安测信息技术有限公司 Traditional Chinese medicine tongue image segmentation device and method based on artificial intelligence and storage medium
WO2022096105A1 (en) * 2020-11-05 2022-05-12 Huawei Technologies Co., Ltd. 3d tongue reconstruction from single images
CN114511567B (en) * 2022-04-20 2022-08-05 天中依脉(天津)智能科技有限公司 Tongue body and tongue coating image identification and separation method
CN120411078B (en) * 2025-07-01 2025-09-16 山东衡昊信息技术有限公司 A tongue image processing method for traditional Chinese medicine tongue diagnosis based on computer vision

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111681238A (en) * 2020-06-12 2020-09-18 电子科技大学 A method and system for tooth mark tongue recognition based on neural network
CN118824523A (en) * 2024-08-09 2024-10-22 南京师范大学 A deep learning-based method for analyzing the tongue base and tongue surface images in the four diagnostic methods of traditional Chinese medicine
CN119251122A (en) * 2024-12-05 2025-01-03 大连冉星信息科技有限公司 A computer vision-based image enhancement method for TCM diagnosis

Also Published As

Publication number Publication date
CN120726059A (en) 2025-09-30

Similar Documents

Publication Publication Date Title
Aquino et al. Detecting the optic disc boundary in digital fundus images using morphological, edge detection, and feature extraction techniques
CN109859203B (en) Defect tooth image identification method based on deep learning
EP2188779B1 (en) Extraction method of tongue region using graph-based approach and geometric properties
CN111524080A (en) Face skin feature identification method, terminal and computer equipment
WO2018120942A1 (en) System and method for automatically detecting lesions in medical image by means of multi-model fusion
CN105513077A (en) System for screening diabetic retinopathy
CN106023151B (en) Tongue object detection method under a kind of open environment
CN109087310B (en) Meibomian gland texture region segmentation method and system, storage medium and intelligent terminal
CN110889846A (en) Diabetes retina image optic disk segmentation method based on FCM
CN117764957A (en) Training system for glaucoma image feature extraction based on artificial neural network
CN118097141A (en) An image segmentation method and system based on obstetric images
Kanca et al. Learning hand-crafted features for K-NN based skin disease classification
CN109816665B (en) A method and device for fast segmentation of optical coherence tomography images
CN110930346A (en) Automatic detection method and storage device for fundus image microangioma
CN120411078B (en) A tongue image processing method for traditional Chinese medicine tongue diagnosis based on computer vision
CN106372593B (en) Optic disk area positioning method based on vascular convergence
Malek et al. Automated optic disc detection in retinal images by applying region-based active aontour model in a variational level set formulation
CN108230306A (en) Eyeground color picture blood vessel and arteriovenous recognition methods
CN120726059B (en) Traditional Chinese medicine tongue image recognition method and system based on image processing
CN119251192A (en) Method, device, equipment and medium for extracting image features of ultrasonic images
CN111626974B (en) Quality scoring method and device for coronary angiography image sequence
del Fresno et al. Application of color image segmentation to estrusc detection
CN119992087B (en) A processing method for tumor images
CN116864098B (en) Medical instrument stress information acquisition method and system based on position information
CN118967673B (en) Intelligent identification method and system for zebra fish bone osteoporosis model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant