Traditional Chinese medicinal material production quality analysis system and method based on machine vision
Through the quality analysis system for production of Chinese medicinal materials based on machine vision, the problems of light interference, complex morphology and insufficient adaptability and high precision requirements in the quality detection of Chinese medicinal materials are solved, and the efficiency, accuracy and automation of quality detection of Chinese medicinal materials are achieved.
Patent Information
- Application Number
- CN202411835030.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-13
AI Technical Summary
The prior art has problems such as light and background interference in the quality detection of traditional Chinese medicinal materials, insufficient adaptability to complex medicinal materials, and difficult to achieve high-precision requirements.
Through a machine vision-based Chinese herbal medicine production quality analysis system, medicinal materials images are collected and pre-processed, including denoising, color correction and edge enhancement. Then, morphological analysis, color, texture and deterioration analysis were carried out, and the quality of Chinese medicinal materials was finally evaluated and classified.
It has achieved efficient, accurate and automated quality testing of traditional Chinese medicinal materials, and can adapt to various forms of medicinal materials, reduce manual intervention, improve production efficiency and reduce the risk of inferior medicinal materials entering the market.
Smart Images

Figure CN119693343A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of Chinese medicinal material quality analysis, and in particular to a Chinese medicinal material production quality analysis system and method based on machine vision. Background Art
[0002] With the advancement of modern industrial production, the production and processing of Chinese herbal medicines are gradually developing towards automation and standardization. In order to ensure that the quality of Chinese herbal medicines meets the standards, traditional quality inspection methods have gradually failed to meet the needs of large-scale production. The quality of Chinese herbal medicines not only depends on their appearance, but also involves many aspects such as texture, color and deterioration. In this process, traditional manual quality inspection faces problems such as high labor intensity, low efficiency and human error.
[0003] With the rapid development of computer vision, image processing and artificial intelligence technologies, machine vision systems can automatically sort and screen Chinese medicinal materials through high-definition camera equipment, image acquisition, processing, analysis and artificial intelligence technology, and can also evaluate whether their morphology meets quality standards. Although these existing technologies can help improve the degree of automation of quality inspection, there are also the following problems: 1) Interference from light and background: In a complex production environment, changes in light and interference from the background often lead to a decrease in image quality; 2) Lack of adaptability to medicinal materials with complex morphology: Many Chinese medicinal materials (such as rhizomes, flowers, etc. of Chinese herbal medicines) have complex and irregular shapes; 3) High precision requirements: The quality analysis of Chinese medicinal materials requires extremely high precision.
[0004] For example, a Chinese patent with authorization announcement number CN108982788B discloses a Chinese herbal medicine quality evaluation system based on big data, including a Chinese herbal medicine data acquisition module, an image acquisition module, a herbal medicine raw material detection module, a server and a display terminal, and the server is connected to the Chinese herbal medicine data acquisition module, the image acquisition module, the herbal medicine raw material detection module and the display terminal respectively. The invention effectively analyzes the basic data information, image information and the water content, pesticide residue, aflatoxin content and the total heavy metal content of Chinese herbal medicines through the Chinese herbal medicine data acquisition module, the image acquisition module, the herbal medicine raw material detection module and the server to judge the quality of each Chinese herbal medicine, facilitate the screening and classification of the quality of Chinese herbal medicines, avoid wasting time, manpower and material resources in the manual evaluation process, and has the characteristics of high accuracy and fast speed in the evaluation of Chinese herbal medicines, which greatly facilitates the selection of Chinese herbal medicines and ensures the consistency of the evaluation standards of Chinese herbal medicines.
[0005] The defects of the above patent are: it does not take into account the characteristics of Chinese medicinal materials such as texture, color and deterioration. Summary of the invention
[0006] In view of the shortcomings of the existing technology, the present invention proposes a Chinese medicinal material production quality analysis system and method based on machine vision, which aims to comprehensively analyze the multi-dimensional characteristics of Chinese medicinal materials such as appearance, texture, color, etc. through image information, and realize efficient, accurate and automated quality inspection of Chinese medicinal materials.
[0007] To achieve the above object, the present invention provides the following technical solutions: The method for analyzing the production quality of Chinese medicinal materials based on machine vision includes the following specific steps: Step S1: collecting images of Chinese medicinal materials and preprocessing the collected images of Chinese medicinal materials; Step S2: performing morphological analysis on the pre-processed Chinese medicinal material images to analyze the morphology of the Chinese medicinal materials; Step S3: analyzing the color, texture and deterioration of the pre-processed Chinese medicinal material image; Step S4: evaluating and analyzing the quality of the Chinese medicinal materials and classifying the quality; Step S5: storing the quality assessment and analysis data of each batch of Chinese medicinal materials in a database for quality traceability and analysis.
[0008] Specifically, the specific steps of step S2 are: Step S201: extract the contour of the Chinese medicinal material in the preprocessed Chinese medicinal material image, and calculate the gradient amplitude of the preprocessed Chinese medicinal material image at the pixel point (x, y). The calculation formula is: , Among them, G(x,y) represents the gradient amplitude of the preprocessed Chinese herbal medicine image at the pixel point (x,y), I(x,y) represents the gray value of the preprocessed Chinese herbal medicine image at the pixel point (x,y), It represents the horizontal gradient of the preprocessed Chinese medicinal material image. Represents the vertical gradient of the preprocessed Chinese medicinal material image. It means to find partial derivative; Step S202: dynamically adjust the scale of edge detection according to the range of gradient value and set the scale factor , ,in, represents the standard deviation of the local area, Represents the overall standard deviation of the preprocessed Chinese medicinal materials image; Step S203: When the gradient magnitude at position (x, y) is greater than or equal to the scale factor When , it is determined that the pixel point (x, y) belongs to the edge area, and the contour of the Chinese medicinal materials in the preprocessed Chinese medicinal materials image is obtained.
[0009] Specifically, the specific steps of step S2 also include: Step S204: Set the contour point set of the Chinese medicinal material to P, where P={p1, p2, ..., p n}, p n Represents the contour point of the nth Chinese medicinal material, and sets the convex hull point set of the Chinese medicinal material to H(P). , for any contour point p i , contour point p i Neighborhood points satisfy the constraints: , where p j and p k Represents the contour point p i The neighboring points of Represented by point p i 、p j and p k Determine the determinant. When the value of the determinant is greater than or equal to zero, it is determined that the three points form a convex shape. Step S205: By rotating, the area of the minimum rectangle is calculated based on the convex hull. The specific formula is: , Among them, A min Indicates the area of the smallest rectangle surrounding the outline of the Chinese medicinal material. represents the rotation angle, Represents the coordinates of the jth point in the convex hull point set of the Chinese medicinal material; Step S206: According to A min Get the length and width of the minimum rectangle surrounding the outline of the Chinese medicinal material and evaluate the shape of the Chinese medicinal material. The specific formula is: ,in, Represents the morphological evaluation value of Chinese medicinal materials, r min Represents the aspect ratio of the smallest rectangle surrounding the outline of the Chinese medicinal material, r bz Represents the aspect ratio of the minimum rectangle of standard Chinese medicinal materials.
[0010] Specifically, the specific steps of step S3 are: Step S301: convert the pre-processed Chinese medicinal material image from RGB space to Lab space, and analyze the color deviation of the pre-processed Chinese medicinal material image. The specific formula is: , in, Indicates the color deviation of the preprocessed Chinese medicinal materials image. , and They represent the three component values of the preprocessed Chinese herbal medicine image in Lab space, and Lmean, amean and bmean represent the three component means of all pixels in the preprocessed Chinese herbal medicine image in Lab space; Step S302: Count the grayscale of the pre-processed Chinese medicinal material image, set it as Hd, and evaluate the texture of the pre-processed Chinese medicinal material image. The specific formula is: , It represents the texture evaluation value of Chinese medicinal materials, and Hdbz represents the gray level of standard Chinese medicinal materials; Step S303: Evaluate the deterioration of the Chinese medicinal materials according to the pre-processed Chinese medicinal materials image. The specific formula is: ,in, It represents the evaluation value of the deterioration of Chinese medicinal materials, Sbz represents the deterioration area of Chinese medicinal materials, and Sz represents the total area of Chinese medicinal materials.
[0011] Specifically, the specific steps of step S4 are: Step S401: Evaluate the quality of the Chinese medicinal materials based on the analysis results of the morphology, color, texture and deterioration of the Chinese medicinal materials. The specific formula is: , Where Zl represents the quality evaluation value of Chinese medicinal materials, exp represents the exponential function, represents the nonlinear weighting coefficient, and b represents the bias term; Step S402: According to the quality assessment results of the Chinese medicinal materials, the Chinese medicinal materials are divided into different quality grades. When Zl>0.8, it is judged as high quality; when 0.6≤Zl≤0.8, it is judged as medium quality; when Zl<0.6, it is judged as low quality.
[0012] Specifically, the preprocessing in step S1 includes: denoising, color correction and edge enhancement; The denoising is used to remove noise in the Chinese medicinal material image; The color correction is used to eliminate the influence of different lighting conditions on the color of the Chinese medicinal materials image; The edge enhancement is used to enhance edge information in an image.
[0013] A Chinese medicinal material production quality analysis system based on machine vision, used to implement the Chinese medicinal material production quality analysis method based on machine vision, comprising: an image acquisition module, a morphological analysis module, a quality analysis module, a quality assessment module and a data storage module; The image acquisition module is used to acquire images of Chinese medicinal materials and pre-process the acquired images of Chinese medicinal materials; The morphological analysis module is used to perform morphological analysis on the preprocessed Chinese medicinal material images and analyze the morphology of the Chinese medicinal materials; The quality analysis module is used to analyze the color, texture and deterioration of the pre-processed Chinese medicinal material image; The quality assessment module is used to assess and analyze the quality of Chinese medicinal materials and to classify their quality; The data storage module is used to store the quality assessment and analysis data of each batch of Chinese medicinal materials in a database for quality traceability and analysis.
[0014] Specifically, the morphological analysis module includes: a contour extraction unit, a minimum rectangle calculation unit and a morphological evaluation unit; The contour extraction unit is used to dynamically adjust the scale of edge detection and extract edge contours according to the variation range of the gradient value of the preprocessed Chinese medicinal material image; The minimum rectangle calculation unit is used to find the convex hull according to the extracted edge contour, and calculate the area of the minimum rectangle based on the convex hull; The morphology evaluation unit is used to evaluate the morphology of the Chinese medicinal material according to the length and width of the minimum rectangle.
[0015] Specifically, the quality analysis module includes: a color deviation analysis unit, a texture assessment unit and a deterioration assessment unit; The color deviation analysis unit is used to analyze the color deviation of the preprocessed Chinese medicinal material image; The texture evaluation unit is used to evaluate the texture of the pre-processed Chinese medicinal material image; The deterioration assessment unit is used to assess the deterioration of the Chinese medicinal materials based on the preprocessed Chinese medicinal materials images.
[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention proposes a method for analyzing the production quality of Chinese medicinal materials based on machine vision, which can realize fully automated detection and significantly reduce manual intervention, not only improving production efficiency but also avoiding the impact of human errors. Especially in large-scale production, the machine vision system can quickly process image data of a large amount of medicinal materials, achieve real-time detection and classification, and thus improve the overall efficiency of the production line.
[0017] 2. The present invention proposes a method for analyzing the production quality of Chinese medicinal materials based on machine vision, which can flexibly adapt to medicinal materials of various forms, including Chinese herbal medicines with complex and changeable shapes, medicinal materials with irregular surfaces after drying, etc., and can adapt to medicinal materials of different batches and specifications, thereby improving the universality and reliability of the detection system.
[0018] 3. The present invention proposes a method for analyzing the production quality of Chinese medicinal materials based on machine vision, which can not only identify the appearance problems of medicinal materials, but also detect potential quality defects, such as surface cracks, mildew, impurities, dimensional deviations, etc. This allows unqualified medicinal materials to be screened out in time during the production process, reducing the risk of inferior medicinal materials entering the market and ensuring the quality and efficacy of Chinese medicinal materials. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A flow chart of the method for analyzing the production quality of Chinese medicinal materials based on machine vision provided by the present invention; Figure 2 This is an architecture diagram of the Chinese medicinal materials production quality analysis system based on machine vision provided by the present invention. DETAILED DESCRIPTION
[0020] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, in the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside" and the like indicate the orientation or position relationship based on the orientation or position relationship shown in the accompanying drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "No. 1", "No. 2" and "No. 3" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The present invention is further explained below in conjunction with specific embodiments.
[0021] Example 1 See also Figure 1 The present invention provides an embodiment: a method for analyzing the production quality of Chinese medicinal materials based on machine vision, comprising the following specific steps: Step S1: using a high-resolution camera or an industrial camera to collect images of Chinese medicinal materials, and preprocessing the collected images of Chinese medicinal materials; When collecting images of Chinese medicinal material samples, it is necessary to shoot them from multiple angles and in all directions, and use appropriate light source configuration during the shooting process to ensure the uniformity and clarity of the image quality; The preprocessing includes steps such as denoising, color correction and edge enhancement to ensure that the image data is suitable for subsequent analysis. The denoising is used to remove noise in the Chinese medicinal material image (such as changes in illumination during shooting, equipment noise or environmental interference, etc.) to make the important information in the image clearer. The color correction is used to eliminate the influence of different illumination conditions on the color of the Chinese medicinal material image. The edge enhancement is used to enhance the edge information in the image to make the outline, shape and other features of the Chinese medicinal material more obvious, which is convenient for subsequent morphological analysis, feature extraction and classification. Preprocessing also includes operations such as grayscale; Common denoising methods include median filtering, Gaussian filtering, and mean filtering, etc., the purpose of which is to reduce unnecessary details (noise) by smoothing the image, thereby improving the quality of the image; color correction usually involves converting the image from one color space to another, and the common conversion is from RGB color space to HSV or Lab color space; common edge enhancement techniques include Sobel operator, Laplace operator, etc., through which the edge of the image can be highlighted and the impact of flat areas can be reduced; Step S2: performing morphological analysis on the pre-processed Chinese medicinal material images to analyze the morphology of the Chinese medicinal materials; The specific steps of step S2 are: Step S201: extract the contour of the Chinese medicinal material in the preprocessed Chinese medicinal material image, and calculate the gradient amplitude of the preprocessed Chinese medicinal material image at the pixel point (x, y). The calculation formula is: , Among them, G(x,y) represents the gradient amplitude of the preprocessed Chinese herbal medicine image at the pixel point (x,y), which describes the edge strength of the preprocessed Chinese herbal medicine image at this position, and I(x,y) represents the gray value of the preprocessed Chinese herbal medicine image at the pixel point (x,y). It represents the gradient of the preprocessed Chinese medicinal material image in the horizontal direction (x direction). Represents the gradient of the preprocessed Chinese medicinal material image in the vertical direction (y direction), It means to find partial derivative; The gradient amplitude indicates the intensity of the change in image brightness (grayscale) and is the key to image edge detection. When the grayscale value around a pixel changes greatly, the gradient amplitude of the pixel is large, indicating that the position may be the edge of the image. Step S202: dynamically adjust the scale of edge detection according to the range of gradient value and set the scale factor , ,in, Represents the standard deviation of the local area, describing the discrete degree of pixel grayscale change in the local area. It represents the overall standard deviation of the preprocessed Chinese medicinal material image, describing the grayscale variation of the entire image; The purpose of adaptive scale selection is to select a suitable scale according to the grayscale change of the local area of the image. If the grayscale change of the local area is large (high contrast), a smaller scale is selected to capture the details. If the change of the local area is small (low contrast), a larger scale is selected to smooth the image. Step S203: When the gradient magnitude at position (x, y) is greater than or equal to the scale factor When , it is determined that the pixel point (x, y) belongs to the edge area, and the outline of the Chinese medicinal materials in the preprocessed Chinese medicinal materials image is obtained; According to the obtained outline of the Chinese medicinal material, the background of the Chinese medicinal material can be removed to obtain a complete image of the Chinese medicinal material; Step S204: Set the contour point set of the Chinese medicinal material to P, where P={p1, p2, ..., p n}, p n Represents the contour point of the nth Chinese medicinal material, and sets the convex hull point set of the Chinese medicinal material to H(P). , for any contour point p i , contour point p i Neighborhood points satisfy the constraints: , where p j and p k Represents the contour point p i The neighboring points of Represented by point p i 、p j and p k The determinant determined is used to determine whether the three points form a convex shape. When the value of the determinant is greater than or equal to zero, the three points are judged to form a convex shape; The convex hull is the smallest convex polygon that encloses a set of points. When calculating the convex hull, the determinant is used to determine whether the three points are on the same plane and whether a convex hull can be formed. If the determinant is negative, it means that the three points form a concave shape, so they need to be removed to retain the convex boundary. Step S205: By rotating, the area of the minimum rectangle is calculated based on the convex hull. The specific formula is: , Among them, A min Indicates the area of the smallest rectangle surrounding the outline of the Chinese medicinal material. represents the rotation angle, Represents the coordinates of the jth point in the convex hull point set of the Chinese medicinal material; By rotating the point set of the convex hull, we can find a minimum rectangle that encloses the image contour. By rotating at different angles, we can calculate the width and height of the rectangle at each angle. The aspect ratio of this rectangle can be used to describe the appearance characteristics of the medicinal material. Step S206: According to A min Get the length and width of the minimum rectangle surrounding the outline of the Chinese medicinal material and evaluate the shape of the Chinese medicinal material. The specific formula is: ,in, Represents the morphological evaluation value of Chinese medicinal materials, r min Represents the aspect ratio of the smallest rectangle surrounding the outline of the Chinese medicinal material, r bz Represents the aspect ratio of the minimum rectangle of standard Chinese medicinal materials.
[0022] By comparing the shapes with those of standard Chinese medicinal materials, Chinese medicinal materials that do not meet the specifications can be detected. For example, if the ratio of the length-to-width ratio of a certain Chinese medicinal material to that of the standard Chinese medicinal material is far beyond the expected range, it may indicate that there are problems in the processing and production of the Chinese medicinal material.
[0023] Step S3: analyzing the color, texture and deterioration of the pre-processed Chinese medicinal material image; The specific steps of step S3 are: Step S301: convert the pre-processed Chinese medicinal material image from RGB space to Lab space, and analyze the color deviation of the pre-processed Chinese medicinal material image. The specific formula is: , in, Indicates the color deviation of the preprocessed Chinese medicinal materials image. , and They represent the three component values of the Lab space of the preprocessed Chinese medicinal materials image, L mean 、a mean and b mean They represent the three component means of all pixels in the Lab space of the preprocessed Chinese medicinal materials image; A smaller deviation value means better color consistency. When converting RGB values to Lab color space, you first need to normalize the RGB values to the [0,1] interval, then perform Gamma correction and XYZ conversion, and finally obtain the three components of Lab space; Step S302: Count the grayscale of the pre-processed Chinese medicinal material image, set it as Hd, and evaluate the texture of the pre-processed Chinese medicinal material image. The specific formula is: , Indicates the texture evaluation value of Chinese medicinal materials, Hd bz Indicates the gray level of standard Chinese medicinal materials; By analyzing the surface texture, we can extract the surface microstructure information of Chinese medicinal materials, which is important for quality judgment. The surface texture of Chinese medicinal materials may be closely related to factors such as their growth environment and processing methods, and can reflect the authenticity and naturalness of medicinal materials. The grayscale represents the maximum number of different grayscale values in the image. When the texture quality of Chinese medicinal materials is relatively low, that is, when there are more spots on Chinese medicinal materials, the grayscale is relatively large, and when the texture of Chinese medicinal materials is relatively good, the grayscale is relatively small. Step S303: Evaluate the deterioration of the Chinese medicinal materials according to the pre-processed Chinese medicinal materials image. The specific formula is: ,in, Indicates the deterioration assessment value of Chinese medicinal materials, S bz Indicates the deterioration area of Chinese medicinal materials, S zIndicates the total area of Chinese medicinal materials.
[0024] The total area here is the surface area obtained based on the pre-processed Chinese medicinal material image.
[0025] Step S4: evaluating and analyzing the quality of the Chinese medicinal materials and classifying the quality; The specific steps of step S4 are: Step S401: Evaluate the quality of the Chinese medicinal materials based on the analysis results of the morphology, color, texture and deterioration of the Chinese medicinal materials. The specific formula is: , Where Zl represents the quality evaluation value of Chinese medicinal materials, exp represents the exponential function, represents the nonlinear weighting coefficient, and b represents the bias term, which is used to adjust the output of the quality assessment value; It can adaptively adjust the contribution of each feature to the final evaluation, so that the relationship between features is more consistent with the complexity of actual Chinese medicinal materials quality assessment; Nonlinear weighting coefficient It is obtained through experimental simulation by personnel in this field or set according to actual conditions; Step S402: According to the quality assessment results of the Chinese medicinal materials, the Chinese medicinal materials are divided into different quality grades. When Zl>0.8, it is judged as high quality; when 0.6≤Zl≤0.8, it is judged as medium quality; when Zl<0.6, it is judged as low quality.
[0026] Step S5: storing the quality assessment and analysis data of each batch of Chinese medicinal materials in a database for quality traceability and analysis.
[0027] Example 2 See also Figure 2 , another embodiment provided by the present invention: a Chinese herbal medicine production quality analysis system based on machine vision, comprising: an image acquisition module, a morphological analysis module, a quality analysis module, a quality assessment module and a data storage module; The image acquisition module is used to acquire images of Chinese medicinal materials and pre-process the acquired images of Chinese medicinal materials; The morphological analysis module is used to perform morphological analysis on the preprocessed Chinese medicinal material images and analyze the morphology of the Chinese medicinal materials; The quality analysis module is used to analyze the color, texture and deterioration of the pre-processed Chinese medicinal material image; The quality assessment module is used to assess and analyze the quality of Chinese medicinal materials and to classify their quality; The data storage module is used to store the quality assessment and analysis data of each batch of Chinese medicinal materials in a database for quality traceability and analysis.
[0028] The morphological analysis module comprises: a contour extraction unit, a minimum rectangle calculation unit and a morphological evaluation unit; The contour extraction unit is used to dynamically adjust the scale of edge detection and extract edge contours according to the variation range of the gradient value of the preprocessed Chinese medicinal material image; The minimum rectangle calculation unit is used to find the convex hull according to the extracted edge contour, and calculate the area of the minimum rectangle based on the convex hull; The morphology evaluation unit is used to evaluate the morphology of the Chinese medicinal material according to the length and width of the minimum rectangle.
[0029] The quality analysis module includes: a color deviation analysis unit, a texture assessment unit and a deterioration assessment unit; The color deviation analysis unit is used to analyze the color deviation of the preprocessed Chinese medicinal material image; The texture evaluation unit is used to evaluate the texture of the pre-processed Chinese medicinal material image; The deterioration assessment unit is used to assess the deterioration of the Chinese medicinal materials based on the preprocessed Chinese medicinal materials images.
[0030] In addition, the parts of the above-mentioned technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive redundancy.
[0031] The specific implementation modes as described above further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation mode of the present invention and is not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for analyzing the production quality of Chinese medicinal materials based on machine vision, characterized in that: The specific steps include: Step S1: collecting images of Chinese medicinal materials and preprocessing the collected images of Chinese medicinal materials; Step S2: performing morphological analysis on the pre-processed Chinese medicinal material images to analyze the morphology of the Chinese medicinal materials; Step S3: analyzing the color, texture and deterioration of the pre-processed Chinese medicinal material image; Step S4: evaluating and analyzing the quality of the Chinese medicinal materials and classifying the quality; Step S5: storing the quality assessment and analysis data of each batch of Chinese medicinal materials in a database for quality traceability and analysis.
2. The method for analyzing the production quality of Chinese medicinal materials based on machine vision according to claim 1, characterized in that: The specific steps of step S2 are: Step S201: extract the contour of the Chinese medicinal material in the preprocessed Chinese medicinal material image, and calculate the gradient amplitude of the preprocessed Chinese medicinal material image at the pixel point (x, y). The calculation formula is: , Among them, G(x,y) represents the gradient amplitude of the preprocessed Chinese herbal medicine image at the pixel point (x,y), I(x,y) represents the gray value of the preprocessed Chinese herbal medicine image at the pixel point (x,y), It represents the horizontal gradient of the preprocessed Chinese medicinal material image. Represents the vertical gradient of the preprocessed Chinese medicinal material image. It means to find partial derivative; Step S202: dynamically adjust the scale of edge detection according to the range of gradient value and set the scale factor , ,in, represents the standard deviation of the local area, Represents the overall standard deviation of the preprocessed Chinese medicinal materials image; Step S203: When the gradient magnitude at position (x, y) is greater than or equal to the scale factor When , it is determined that the pixel point (x, y) belongs to the edge area, and the contour of the Chinese medicinal materials in the preprocessed Chinese medicinal materials image is obtained.
3. The method for analyzing the production quality of Chinese medicinal materials based on machine vision according to claim 2, characterized in that: The specific steps of step S2 also include: Step S204: Set the contour point set of the Chinese medicinal material to P, where P={p1, p2, ..., p n }, p n Represents the contour point of the nth Chinese medicinal material, and sets the convex hull point set of the Chinese medicinal material to H(P). , for any contour point p i , contour point p i Neighborhood points satisfy the constraints: , where p j and p k Represents the contour point p i The neighboring points of Represented by point p i 、p j and p k Determine the determinant. When the value of the determinant is greater than or equal to zero, it is determined that the three points form a convex shape. Step S205: By rotating, the area of the minimum rectangle is calculated based on the convex hull. The specific formula is: , Among them, A min Represents the area of the smallest rectangle surrounding the outline of the Chinese medicinal material. represents the rotation angle, Represents the coordinates of the jth point in the convex hull point set of the Chinese medicinal material; Step S206: According to A min Get the length and width of the minimum rectangle surrounding the outline of the Chinese medicinal material and evaluate the shape of the Chinese medicinal material. The specific formula is: ,in, Represents the morphological evaluation value of Chinese medicinal materials, r min Represents the aspect ratio of the smallest rectangle surrounding the outline of the Chinese medicinal material, r bz Represents the aspect ratio of the minimum rectangle of standard Chinese medicinal materials.
4. The method for analyzing the production quality of Chinese medicinal materials based on machine vision according to claim 3, characterized in that: The specific steps of step S3 are: Step S301: convert the pre-processed Chinese medicinal material image from RGB space to Lab space, and analyze the color deviation of the pre-processed Chinese medicinal material image. The specific formula is: , in, Indicates the color deviation of the preprocessed Chinese medicinal materials image. , and They represent the three component values of the preprocessed Chinese herbal medicine image in Lab space, and Lmean, amean and bmean represent the three component means of all pixels in the preprocessed Chinese herbal medicine image in Lab space; Step S302: Count the grayscale of the pre-processed Chinese medicinal material image, set it as Hd, and evaluate the texture of the pre-processed Chinese medicinal material image. The specific formula is: , It represents the texture evaluation value of Chinese medicinal materials, and Hdbz represents the gray level of standard Chinese medicinal materials; Step S303: Evaluate the deterioration of the Chinese medicinal materials according to the pre-processed Chinese medicinal materials image. The specific formula is: ,in, It represents the evaluation value of the deterioration of Chinese medicinal materials, Sbz represents the deterioration area of Chinese medicinal materials, and Sz represents the total area of Chinese medicinal materials.
5. The method for analyzing the production quality of Chinese medicinal materials based on machine vision according to claim 4, characterized in that: The specific steps of step S4 are: Step S401: Evaluate the quality of the Chinese medicinal materials based on the analysis results of the morphology, color, texture and deterioration of the Chinese medicinal materials. The specific formula is: , Where Zl represents the quality evaluation value of Chinese medicinal materials, exp represents the exponential function, represents the nonlinear weighting coefficient, and b represents the bias term; Step S402: According to the quality assessment results of the Chinese medicinal materials, the Chinese medicinal materials are divided into different quality grades. When Zl>0.8, it is judged as high quality; when 0.6≤Zl≤0.8, it is judged as medium quality; when Zl<0.6, it is judged as low quality.
6. The method for analyzing the production quality of Chinese medicinal materials based on machine vision according to claim 5, characterized in that: The preprocessing in step S1 includes: denoising, color correction and edge enhancement; The denoising is used to remove noise in the Chinese medicinal material image; The color correction is used to eliminate the influence of different lighting conditions on the color of the Chinese medicinal materials image; The edge enhancement is used to enhance edge information in an image.
7. A Chinese herbal medicine production quality analysis system based on machine vision, used to implement the Chinese herbal medicine production quality analysis method based on machine vision as claimed in any one of claims 1 to 6, characterized in that: include: Image acquisition module, morphology analysis module, quality analysis module, quality assessment module and data storage module; The image acquisition module is used to acquire images of Chinese medicinal materials and pre-process the acquired images of Chinese medicinal materials; The morphological analysis module is used to perform morphological analysis on the preprocessed Chinese medicinal material images and analyze the morphology of the Chinese medicinal materials; The quality analysis module is used to analyze the color, texture and deterioration of the pre-processed Chinese medicinal material image; The quality assessment module is used to assess and analyze the quality of Chinese medicinal materials and to classify their quality; The data storage module is used to store the quality assessment and analysis data of each batch of Chinese medicinal materials in a database for quality traceability and analysis.
8. The machine vision-based Chinese medicinal material production quality analysis system according to claim 7, characterized in that: The morphological analysis module comprises: a contour extraction unit, a minimum rectangle calculation unit and a morphological evaluation unit; The contour extraction unit is used to dynamically adjust the scale of edge detection and extract edge contours according to the variation range of the gradient value of the preprocessed Chinese medicinal material image; The minimum rectangle calculation unit is used to find the convex hull according to the extracted edge contour, and calculate the area of the minimum rectangle based on the convex hull; The morphology evaluation unit is used to evaluate the morphology of the Chinese medicinal material according to the length and width of the minimum rectangle.
9. The machine vision-based Chinese medicinal material production quality analysis system according to claim 8, characterized in that: The quality analysis module includes: a color deviation analysis unit, a texture assessment unit and a deterioration assessment unit; The color deviation analysis unit is used to analyze the color deviation of the preprocessed Chinese medicinal material image; The texture evaluation unit is used to evaluate the texture of the pre-processed Chinese medicinal material image; The deterioration assessment unit is used to assess the deterioration of the Chinese medicinal materials based on the preprocessed Chinese medicinal materials images.
Citation Information
Patent Citations
A Big Data-Based Quality Assessment System for Chinese Medicinal Herbs
CN108982788B
Visual detection and analysis system for quality of traditional Chinese medicine decoction pieces
CN116862911A
Traditional Chinese medicine decoction piece quality detection and analysis system and method based on machine vision
CN118045773A
Assembly line counting method based on industrial visual identification
CN119027417A
Medicinal material production quality detection method based on image recognition
CN119091259A
Cited By
Vision-based traditional Chinese medicinal material defect detection method
CN120374870A
Vision-based defect detection method for traditional Chinese medicine
CN120374870B
Traditional Chinese medicine beverage raw material traceability analysis method and system based on neural network
CN120765272A
Method for automatically extracting and analyzing phenotypic features of traditional Chinese medicinal materials based on image recognition
CN121121290A
Traditional Chinese medicinal material defect detection method based on machine vision
CN121685376A