A method and system for constructing a traditional Chinese medicinal material shape feature database

By constructing a database of the shape features of Chinese medicinal materials and utilizing three-dimensional reconstruction and curvature distribution histogram feature vectors, the problem of feature instability caused by two-dimensional images was solved, thus achieving stability and accuracy in the identification and traceability of the authenticity of Chinese medicinal materials.

CN122432365APending Publication Date: 2026-07-21GUIZHOU JIANYI MEASUREMENT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUIZHOU JIANYI MEASUREMENT TECH CO LTD
Filing Date
2026-06-24
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies rely on two-dimensional images to construct databases of the shape characteristics of Chinese medicinal materials, which leads to defects in feature representation and unstable shape characteristics. This makes it difficult to achieve reliable identification of authenticity and traceability in changing application scenarios.

Method used

By acquiring digital images from multiple fixed spatial perspectives, key points are extracted and cross-perspective matching is performed to reconstruct 3D point clouds, stable key points are selected, surface curvature is calculated, morphological regions are clustered to form morphological regions, curvature distribution histogram feature vectors are generated, and these are associated with and stored with authentic place of origin information to construct a database of Chinese medicinal material shape characteristics.

Benefits of technology

It achieves stable feature description based on three-dimensional geometry, reduces sensitivity to changes in the imaging environment, and improves the accuracy and reliability of the identification of the authenticity of Chinese medicinal materials and the traceability of their origin.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432365A_ABST
    Figure CN122432365A_ABST
Patent Text Reader

Abstract

The application discloses a traditional Chinese medicinal material shape feature database construction method and system, and particularly relates to the technical field of computer vision and three-dimensional image data processing, and is used for solving the problem of unstable features and insufficient authenticity traceability caused by missing three-dimensional shape information in the existing database constructed based on two-dimensional images; three-dimensional point clouds are reconstructed by collecting multi-view images, and stable key points are screened according to spatial distribution uniformity; the three-dimensional coordinates and surface curvatures of each point are calculated, and morphological regions are formed by clustering; the curvature distribution sub-histograms of each region are generated respectively, the similarity measurement of the sub-histograms between regions is calculated to obtain a correlation matrix; the sub-histograms and the correlation matrix are structured and coded to form the curvature distribution histogram feature vector of the sample; finally, the feature vector and the genuineness production area information are associated and stored, and the database construction is completed; stable and essential three-dimensional shape features can be extracted, and the accuracy of traditional Chinese medicinal material genuineness identification and authenticity traceability is significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision and three-dimensional image data processing technology, and more specifically, to a method and system for constructing a database of shape features of Chinese medicinal materials. Background Technology

[0002] In the field of quality control of Chinese medicinal materials, the identification of origin and the traceability of authenticity are key links to ensure the quality and clinical efficacy of medicinal materials. Image analysis-based methods can serve as an important auxiliary identification tool. Currently, relevant methods mainly rely on the construction of a shape feature database of Chinese medicinal materials. This involves collecting two-dimensional digital images of medicinal materials, extracting visual features such as contours and textures, and storing them. Then, by comparing unknown samples with features in the database, the origin can be determined and the authenticity can be identified. This model based on a two-dimensional image feature database provides an objective and digital technical path for the traceability of the origin of Chinese medicinal materials.

[0003] However, the characteristics of Chinese medicinal materials, especially the key morphological information that characterizes their authenticity, originate from their three-dimensional physical entities. When constructing shape feature databases, existing technologies rely on two-dimensional images that are essentially planar projections of three-dimensional objects at specific shooting angles. This process inevitably loses key three-dimensional morphological information such as depth, three-dimensional texture, and continuous changes in complex curved surfaces. As a result, the extracted shape features are not stable descriptions of the intrinsic morphology of the medicinal materials, but rather apparent projection features closely related to the shooting angle and placement posture. Therefore, databases constructed based on such features have inherent information deficiencies and contextual dependencies in their core feature representations. This makes subsequent identification and traceability models extremely sensitive to imaging conditions, lacking stability, and difficult to achieve reliable authenticity identification and genuine traceability in changing application scenarios. Summary of the Invention

[0004] In order to overcome the above-mentioned defects of the prior art, the present invention provides a method and system for constructing a database of the shape features of Chinese medicinal materials to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides the following technical solution: A method for constructing a database of shape features of traditional Chinese medicinal materials includes: S1. Collect digital images of Chinese medicinal herb samples from multiple fixed spatial perspectives; S2. After extracting key points and performing cross-view matching on each digital image, sparse 3D reconstruction is performed to obtain an initial 3D point cloud. Based on the spatial distribution uniformity criterion, the initial 3D point cloud is resampled to select stable key points. S3. Calculate the three-dimensional spatial coordinates corresponding to each stable key point, and fit the local surface to calculate the surface curvature at each stable key point. S4. Clustering is performed based on the three-dimensional spatial coordinates and surface curvature of each stable key point to form multiple morphological regions; S5. Generate curvature distribution sub-histograms for each morphological region, calculate the similarity measure between curvature distribution sub-histograms of any two morphological regions to obtain the curvature distribution correlation matrix between regions, and perform structured encoding on all curvature distribution sub-histograms and the curvature distribution correlation matrix between regions to generate the curvature distribution histogram feature vector of the Chinese medicinal material sample. S6. Link and store the feature vector of the curvature distribution histogram with the authentic origin information of Chinese medicinal materials to construct a database of the shape features of Chinese medicinal materials.

[0006] Furthermore, S1 includes: In three-dimensional space, multiple image acquisition devices are arranged at equal angular intervals along the horizontal rotation direction, with the Chinese medicinal material sample as the center. Multiple image acquisition devices are controlled to simultaneously acquire digital images of Chinese medicinal material samples, with each image acquisition device acquiring a digital image from a fixed spatial perspective. The digital images acquired by each image acquisition device are associated with and stored with the corresponding fixed spatial viewpoint identifier.

[0007] Furthermore, S2 includes: The initial 3D point cloud is divided into spatial grids, and the point cloud density in each grid is calculated. Identify dense and sparse regions in the initial 3D point cloud based on the point cloud density of all grids. Using points in sparse regions as the initial seed point set, perform iterative sampling of the farthest point. In each iteration, select the point that is spatially farthest from the current seed point set from the remaining points of the initial 3D point cloud and add it to the seed point set, and update the selection weight of the remaining points until the number of selected points reaches the preset number. The final seed point set is then used as the stable key points.

[0008] Furthermore, updating the selection weights of the remaining points includes reducing the selection weights of the remaining points in the spatial neighborhood of the points newly added to the seed point set in the previous iteration, in order to suppress duplicate sampling near the spatially sampled region.

[0009] Furthermore, S3 includes: Based on the pixel coordinates of each stable key point in digital images from multiple fixed spatial perspectives and the geometric relationship between the fixed spatial perspectives, the three-dimensional spatial coordinates corresponding to each stable key point are calculated by the triangulation method. For each stable key point, find multiple neighboring points in its spatial neighborhood within the set of three-dimensional spatial coordinates; Principal component analysis is used to fit a plane to the stable key points and their multiple neighboring points, and a local coordinate system is established with the fitted plane as a reference. In the local coordinate system, quadratic surface fitting is performed using the three-dimensional spatial coordinates of the stable key point and its multiple neighboring points. The Gaussian curvature and mean curvature at the stable key point are calculated based on the fitted quadratic surface coefficients, and used as the surface curvature at the stable key point.

[0010] Furthermore, S4 includes: The three-dimensional spatial coordinates and surface curvature of each stable key point are combined into a multi-dimensional feature vector; Each multidimensional feature vector is normalized to make the numerical range of the three-dimensional spatial coordinates and surface curvature consistent. Based on the normalized multidimensional feature vectors, density clustering is used to divide stable keypoints into multiple clusters, with each cluster corresponding to a morphological region.

[0011] Furthermore, based on the normalized multidimensional feature vectors, density clustering is used to divide stable keypoints into multiple clusters, including: Calculate the pairwise Euclidean distance between normalized multidimensional feature vectors; Based on Euclidean distance, core points, boundary points, and noise points are identified by setting the neighborhood radius and minimum number of points threshold; All point sets consisting of the core point and its density-reachable boundary points are divided into a cluster, thus forming multiple morphological regions.

[0012] Furthermore, S5 includes: For each morphological region, the numerical distribution of surface curvature at all stable keypoints within the morphological region is statistically analyzed to generate a curvature distribution sub-histogram. The Bartholomew's distance between the curvature distribution sub-histograms of any two morphological regions is calculated as a similarity measure, and an inter-region curvature distribution correlation matrix is ​​constructed based on the pairwise Bartholomew's distances between all morphological regions. All morphological regions are arranged in a preset numbering order, and the one-dimensional vectors of the flattened curvature distribution sub-histograms of each morphological region are spliced ​​together in this order to obtain the sub-histogram splicing vector. Flatten all elements above the main diagonal of the curvature distribution correlation matrix between regions into a one-dimensional vector according to the row priority of the matrix to obtain the correlation matrix vector. The sub-histogram concatenation vector and the correlation matrix vector are connected in this order to form the final curvature distribution histogram feature vector.

[0013] Furthermore, S6 includes: Establish database records, which must include at least a curvature distribution histogram feature vector field and an authentic origin information field. Fill the curvature distribution histogram feature vector of the Chinese medicinal material samples into the curvature distribution histogram feature vector field, and fill the authentic origin information of the Chinese medicinal material samples into the authentic origin information field. The database records containing the filled curvature distribution histogram feature vectors and authentic origin information are written into the storage medium to complete the construction of the Chinese medicinal material shape feature database.

[0014] On the other hand, the present invention provides a system for constructing a database of shape features of traditional Chinese medicinal materials, including: The image acquisition module is used to acquire digital images of Chinese medicinal herb samples from multiple fixed spatial perspectives. The key point filtering module is used to extract key points from each digital image and perform cross-view matching before sparse 3D reconstruction to obtain an initial 3D point cloud. Based on the spatial distribution uniformity criterion, the initial 3D point cloud is resampled to filter out stable key points. The curvature calculation module is used to calculate the three-dimensional spatial coordinates corresponding to each stable key point, and to fit the local surface to calculate the surface curvature at each stable key point; The region clustering module is used to cluster based on the three-dimensional spatial coordinates and surface curvature of each stable key point to form multiple morphological regions. The feature encoding module is used to generate curvature distribution sub-histograms for each morphological region, calculate the similarity measure of curvature distribution sub-histograms between any two morphological regions to obtain the curvature distribution correlation matrix between regions, and perform structured encoding of all curvature distribution sub-histograms and the curvature distribution correlation matrix between regions to generate the curvature distribution histogram feature vector of the Chinese medicinal material sample. The database construction module is used to associate and store the feature vectors of the curvature distribution histogram with the geographical origin information of Chinese medicinal materials samples, and to construct a database of the shape features of Chinese medicinal materials.

[0015] Compared with the prior art, the present invention has the following beneficial effects: 1. By constructing a feature database based on three-dimensional intrinsic geometry, the feature representation defects caused by relying on two-dimensional images are overcome. First, the three-dimensional point cloud structure of the surface of Chinese medicinal materials is recovered from multi-view images, and stable key points with uniform spatial distribution are selected. This ensures that the feature extraction is based on the real three-dimensional shape of the medicinal materials, rather than unstable two-dimensional projections. Furthermore, by calculating the Gaussian curvature and average curvature at each key point, differential geometric invariants describing the curvature of the local surface are obtained. Such features have rigid body motion invariance, that is, they are not affected by the translation and rotation of the object. This ensures that the extracted shape features are stable descriptors that are independent of the shooting angle and placement posture. The source of database construction is elevated from volatile appearance images to stable three-dimensional geometric entities, laying a highly robust data foundation for subsequent identification and traceability.

[0016] 2. By clustering analysis, key points with similar geometric attributes are aggregated into morphological regions. Innovatively, the curvature statistical characteristics within these regions are integrated with the curvature distribution correlation patterns between regions, jointly encoding the final shape feature vector. This feature construction method not only characterizes the morphological statistical properties of different local parts but also captures the shape correlation patterns between different parts, thus achieving a multi-level, structured description of the overall three-dimensional morphology of Chinese medicinal materials. Ultimately, this high-dimensional essential shape feature is closely associated with and stored with the information on the authentic origin of the medicinal materials. Based on this database, the identification model can make decisions based on stable and rich three-dimensional shape information, significantly reducing the sensitivity to changes in the imaging environment and improving the accuracy and reliability of the identification and authenticity traceability results of Chinese medicinal materials in complex real-world scenarios. Attached Figure Description

[0017] Figure 1 This is a flowchart of a method for constructing a database of shape features of Chinese medicinal materials according to the present invention; Figure 2 This is a schematic diagram of the structure of a Chinese medicinal herb shape feature database construction system according to the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Example 1: Figure 1 This invention provides a method for constructing a database of shape features of traditional Chinese medicinal materials, comprising: S1. Collect digital images of Chinese medicinal herb samples from multiple fixed spatial perspectives; S2. After extracting key points and performing cross-view matching on each digital image, sparse 3D reconstruction is performed to obtain an initial 3D point cloud. Based on the spatial distribution uniformity criterion, the initial 3D point cloud is resampled to select stable key points. S3. Calculate the three-dimensional spatial coordinates corresponding to each stable key point, and fit the local surface to calculate the surface curvature at each stable key point. S4. Clustering is performed based on the three-dimensional spatial coordinates and surface curvature of each stable key point to form multiple morphological regions; S5. Generate curvature distribution sub-histograms for each morphological region, calculate the similarity measure between curvature distribution sub-histograms of any two morphological regions to obtain the curvature distribution correlation matrix between regions, and perform structured encoding on all curvature distribution sub-histograms and the curvature distribution correlation matrix between regions to generate the curvature distribution histogram feature vector of the Chinese medicinal material sample. S6. Link and store the feature vector of the curvature distribution histogram with the authentic origin information of Chinese medicinal materials to construct a database of the shape features of Chinese medicinal materials.

[0020] S1. Collect digital images of Chinese medicinal herb samples from multiple fixed spatial perspectives, specifically implemented as follows: In three-dimensional space, multiple image acquisition devices are arranged at equal angular intervals along the horizontal rotation direction, centered on the sample of the Chinese medicinal material to be tested. The equal angular interval is obtained by dividing 360 degrees by the number of image acquisition devices; for example, when eight image acquisition devices are arranged, the horizontal angular interval between adjacent devices is 45 degrees. The number of image acquisition devices is determined based on the required accuracy and completeness of the 3D reconstruction, and is usually no less than six, to ensure that surface information of the sample can be obtained from a sufficient number of directions. The optical axes of all image acquisition devices approximately intersect at the center of the Chinese medicinal material sample, and the imaging plane of each image acquisition device is perpendicular to the optical axis to ensure that the acquired digital image is directly facing the sample. The image acquisition devices are fixed on a stable support or platform to prevent positional movement or vibration during acquisition, thereby ensuring that the geometric relationship of multiple fixed spatial viewpoints remains strictly unchanged. The Chinese medicinal material sample is placed at the center of a flat, neutral-colored platform, the color of which contrasts sharply with the sample color to facilitate background separation in subsequent image processing.

[0021] After the image acquisition devices are set up, multiple devices are controlled to simultaneously acquire digital images of the medicinal herb samples. Synchronization is achieved by sending a unified hardware trigger signal to all devices, generated by the central controller or one of the main devices, ensuring that all devices are exposed simultaneously within a millisecond-level time window. Each device acquires images according to preset parameters, including image resolution, exposure time, aperture value, and ISO. The exposure time is adjusted based on ambient light intensity and the reflectivity of the sample surface to ensure the digital image is neither overexposed nor underexposed, clearly revealing the texture and contour details of the sample surface. The aperture value is set to achieve sufficient depth of field, ensuring the entire medicinal herb sample is clearly imaged. After acquisition, each device independently acquires and outputs a digital image with a fixed spatial perspective. This fixed-perspective digital image is a two-dimensional pixel matrix containing red, green, and blue color information.

[0022] Each image acquisition device's digital image is associated with and stored along with its corresponding fixed spatial viewpoint identifier. The fixed spatial viewpoint identifier is a unique identifier used to indicate the image acquisition device's orientation in three-dimensional space when acquiring the digital image. Fixed spatial viewpoint identifiers can be generated in several ways. One implementation involves assigning a number to each image acquisition device and combining that number with the horizontal rotation angle determined during the device's setup to form the fixed spatial viewpoint identifier. For example, image acquisition device numbered 1 corresponds to an angle of 0 degrees, and its fixed spatial viewpoint identifier can be recorded as viewpoint 1 or angle 0. Another implementation directly uses the image acquisition device's three-dimensional position and optical axis direction vector in a preset global coordinate system as the fixed spatial viewpoint identifier. The specific operation of the associated storage involves creating a data storage structure. This structure contains at least two fields: the first field stores the digital image data or a path pointing to the digital image's storage location, and the second field stores the corresponding fixed spatial viewpoint identifier. During storage, the system reads digital image data acquired by each image acquisition device and, based on a pre-known mapping relationship between the image acquisition device and fixed spatial viewpoint identifiers, retrieves the corresponding fixed spatial viewpoint identifier. Then, the digital image data and the fixed spatial viewpoint identifier are written as a data pair into the data storage structure. This data storage structure is ultimately stored in a non-volatile storage medium, such as a computer hard drive or solid-state drive, thus persistently saving all digital images and their geometric context information for a single acquisition cycle. This provides a set of image data with clear viewpoint relationships for subsequent cross-view matching and 3D reconstruction. Through this method, it ensures that the acquired digital images not only contain visual information but also accurately record the spatial geometric relationships at the time of image capture, which is the foundation for subsequent 3D shape recovery from 2D images.

[0023] S2. After extracting key points and performing cross-view matching on each digital image, sparse 3D reconstruction is performed to obtain an initial 3D point cloud. Based on the spatial distribution uniformity criterion, the initial 3D point cloud is resampled to select stable key points. The specific implementation is as follows: After acquiring multiple digital images from fixed spatial perspectives, this step first extracts keypoints from each image. Keypoint extraction uses a scale-invariant feature transform (SMT) algorithm. SMT locates keypoints by constructing a Gaussian pyramid in the image and finding extrema at different scales. For each keypoint, a feature descriptor containing a 128-dimensional vector is calculated, representing the local image gradient information around the keypoint. After keypoint extraction for all images, cross-viewpoint keypoint matching is performed. Cross-viewpoint keypoint matching is achieved by calculating the Euclidean distance between the feature descriptors of keypoints in different images. Two keypoints with an Euclidean distance less than a preset matching distance threshold are considered a matching pair. The preset matching distance threshold is obtained by multiplying an empirical coefficient by the average Euclidean distance between all keypoint pairs. The empirical coefficient ranges from 0.6 to 0.8, for example, an empirical coefficient of 0.7 is used. Based on all successfully matched keypoint pairs, sparse 3D reconstruction is performed using the structure-reconstruction-motion algorithm. The Structure for Motion Reconstruction (SMR) algorithm solves the problem of minimizing the reprojection error by considering camera pose parameters and 3D point coordinates. Specifically, it employs a bundled adjustment optimization algorithm, which iteratively optimizes the camera parameters and 3D point positions, ultimately outputting an initial 3D point cloud composed of a series of 3D spatial points. Each point in the initial 3D point cloud corresponds to a physical point that exists in the actual scene and has been successfully matched in at least two digital images.

[0024] After obtaining the initial 3D point cloud, it is resampled according to the spatial distribution uniformity criterion to screen stable key points. First, the initial 3D point cloud is spatially meshed. Spatial meshing is achieved by defining a bounding box that encloses the entire initial 3D point cloud and uniformly dividing the bounding box into multiple smaller cubic meshes of the same size along the three coordinate axes. The side length of each mesh is set based on the total number of points in the initial 3D point cloud and the desired density analysis accuracy. Specifically, it is determined by dividing the maximum side length of the bounding box by a grid number base. The grid number base is selected accordingly within the range of 1000 to 10000 points in the initial 3D point cloud. For example, for an initial 3D point cloud with approximately 50,000 points, a grid number base of 50 is chosen, resulting in a mesh side length that is 1 / 50 of the maximum side length of the bounding box. The point cloud density within each mesh is then calculated, represented by the number of 3D points falling within the mesh.

[0025] The point cloud density of all grid cells is used to identify dense and sparse regions in the initial 3D point cloud. This identification process is achieved by setting a point cloud density threshold, which is calculated as the arithmetic mean of the point cloud densities of all grid cells. Grid cells with a point cloud density greater than the threshold are classified as dense regions, while those with a density less than or equal to the threshold are classified as sparse regions. The set of all grid cells classified as sparse regions constitutes the sparse regions in the initial 3D point cloud.

[0026] Using points within the sparse region as the initial seed point set, iterative farthest point sampling is performed. The initial seed point set contains all 3D points located within the sparse region grid. The iterative farthest point sampling process is as follows: In each iteration, the spatial distance between the remaining points of the initial 3D point cloud and the current seed point set is calculated. For a remaining point, the spatial distance between the remaining point and the current seed point set is defined as the minimum Euclidean distance from the remaining point to all points in the current seed point set. The Euclidean distance is calculated based on the coordinates of two points in 3D space, and the distance value is the square root of the sum of the squares of the differences between the coordinate components of the two points. Then, the point with the farthest spatial distance from the remaining points of the initial 3D point cloud is selected and added to the seed point set. The selected point is then removed from the remaining point set. In each iteration, when a new point is added to the seed point set, the selection weights of the remaining points need to be updated. Updating the selection weights of the remaining points includes reducing the selection weights of the remaining points within the spatial neighborhood of the point newly added to the seed point set in the previous iteration. The spatial neighborhood is defined by a fixed neighborhood radius, which is set to between 1.5 and 3 times the side length of the mesh used in the initial spatial mesh generation, for example, 2 times the side length. For any remaining point, if the Euclidean distance between the remaining point and a point added to the seed point set is less than the fixed neighborhood radius, the remaining point is considered to be within the spatial neighborhood of the newly added point. The selection weight of remaining points within the spatial neighborhood is multiplied by a weight decay coefficient less than 1, with a value between 0.1 and 0.8, for example, a weight decay coefficient of 0.5, to reduce the probability of them being selected in subsequent iterations, thereby suppressing duplicate sampling near already sampled areas in space. The selection weights of the remaining points in the initial 3D point cloud are all initialized to 1 before the first iteration. The iteration process continues until the number of selected points, i.e., the number of points in the current seed point set, reaches a preset number of sampling points. The preset number of sampling points is set according to subsequent calculation needs. It is a proportion of the total number of points in the initial 3D point cloud, ranging from 5% to 20%, for example, set to 10%. An upper limit is also set for the preset number of sampling points, such as 5000 points. The resulting seed point set is used as stable keypoints for subsequent calculations. Through this resampling process, the selected stable keypoints have a more uniform distribution in 3D space, better representing the overall geometry of the medicinal herb sample.

[0027] S3. Calculate the three-dimensional spatial coordinates corresponding to each stable key point, and fit the local surface to calculate the surface curvature at each stable key point. The specific implementation is as follows: This step calculates the 3D spatial coordinates of stable keypoints based on the selected stable keypoints and their correspondences in digital images from multiple fixed spatial perspectives. Each stable keypoint has been identified as appearing in at least two different digital images during the previous keypoint extraction and matching steps. Based on the pixel coordinates of each stable keypoint in the digital images from multiple fixed spatial perspectives and the geometric relationship between the fixed spatial perspective and the pixel coordinates, the 3D spatial coordinates of each stable keypoint are calculated using a triangulation method. The specific process of the triangulation method is as follows: First, for any stable keypoint, obtain the pixel coordinates of the stable keypoint in all digital images that observe it, and simultaneously obtain the camera projection matrix implied by the fixed spatial perspective identifier corresponding to the image acquisition device that captured these digital images. The camera projection matrix is ​​a 3x4 matrix that expresses the linear projection relationship from the 3D world coordinate system to the 2D image pixel coordinate system. The camera projection matrix is ​​predetermined in the camera calibration step. If several cameras observe the same stable keypoint, several projection equations are formed. Each projection equation expresses the pixel coordinates as the camera projection matrix multiplied by the homogeneous coordinates of the 3D spatial point. By constructing an overdetermined system of linear equations, the homogeneous coordinates of stable keypoints in 3D space are solved; this is a least-squares problem. The solution method employs singular value decomposition (SVD), performing SVD on the matrix composed of the coefficients of the projection equations, and taking the right singular vector corresponding to the smallest singular value as the homogeneous coordinate solution for the 3D point. Converting the homogeneous coordinates to 3D Euclidean coordinates yields the 3D coordinates of the stable keypoints. This triangulation process is repeated for each stable keypoint, ultimately obtaining the 3D coordinates of all stable keypoints, which together form a set of 3D coordinates.

[0028] After obtaining the 3D spatial coordinates of all stable keypoints, for each stable keypoint, a local surface needs to be fitted around it to calculate differential geometric properties. First, for each stable keypoint, multiple neighboring points within its spatial neighborhood are searched in the 3D spatial coordinate set. This search process is accelerated using a spatial indexing structure, such as a KD-tree data structure to create a spatial index for all points in the 3D spatial coordinate set. For the currently processed stable keypoint, a search radius is set with the 3D spatial coordinates of the stable keypoint as the center. All points falling within this spherical spatial region are searched in the KD-tree; these points are the multiple neighboring points within the spatial neighborhood. The search radius is adaptively determined based on the overall point cloud density of the 3D spatial coordinate set. Specifically, the average Euclidean distance between all stable keypoints is calculated, and this average distance is multiplied by a scaling factor to obtain the search radius. The scaling factor ranges from 1.5 to 3; for example, a scaling factor of 2.0 is used. Another implementation involves finding the k nearest neighbors to the current stable keypoint using Euclidean distance. The value of k is empirically set to an integer between 20 and 100, for example, k = 50, to ensure a sufficient number of points are available for subsequent surface fitting. If the number of neighbors found using the search radius or the k-nearest neighbor method is less than the minimum number of points required for surface fitting (e.g., a minimum threshold of 10), the search radius is expanded or the value of k is increased to re-search until the required number of points is met.

[0029] After obtaining the stable keypoint and its multiple neighboring points, principal component analysis (PCA) is used to fit a plane to these points. First, the centroid of the 3D coordinates of the stable keypoint and its multiple neighboring points is calculated, which is the arithmetic mean of each coordinate component. Then, the covariance matrix of this set of points relative to the centroid is calculated. The covariance matrix is ​​a 3x3 symmetric matrix whose elements reflect the dispersion of the point set in each coordinate direction. Eigenvalue decomposition is performed on the covariance matrix to obtain three eigenvalues ​​and their corresponding mutually orthogonal eigenvectors. The direction of the eigenvector corresponding to the smallest eigenvalue represents the direction in which the point set is most concentrated, i.e., the normal direction of the local surface. This eigenvector is selected as the normal vector of the fitting plane, and an equation for the fitting plane is determined through the centroid.

[0030] A local coordinate system is established with the fitting plane as a reference. The origin of the local coordinate system is set to the 3D spatial coordinates of the currently processed stable keypoint. The Z-axis direction of the local coordinate system is set to the normal vector direction of the fitting plane. To determine the X-axis direction of the local coordinate system, an arbitrary direction vector that is not collinear with the normal vector is selected on the fitting plane. For example, the vector obtained by subtracting the coordinates of the stable keypoint from the coordinates of any neighboring point in the point set is projected onto the fitting plane and normalized to serve as the X-axis direction of the local coordinate system. The Y-axis direction of the local coordinate system is obtained by cross-product of the Z-axis unit vector and the X-axis unit vector, thus forming a right-handed orthogonal coordinate system. A rotation and translation transformation matrix is ​​established from the original global 3D coordinate system to this local coordinate system. The 3D spatial coordinates of the stable keypoint and its multiple neighboring points are all transformed to the local coordinate system using this transformation matrix, resulting in the new coordinates of the stable keypoint and its multiple neighboring points in the local coordinate system. In the local coordinate system, the Z-coordinate values ​​of the stable keypoint and its multiple neighboring points approximately reflect their heights from the local fitting plane.

[0031] In the local coordinate system, a quadratic surface is fitted using the three-dimensional spatial coordinates of the stable key point and its multiple neighboring points. The local surface approximation is represented by a quadratic surface equation, which in the local coordinate system takes the form Z = a × X. 2 +b×Y 2 The equation is: +c×X×Y+d×X+e×Y+f, where a, b, c, d, e, and f are six undetermined coefficients, each with a specific geometric meaning. Coefficient a primarily controls the curvature of the surface along the local coordinate system's X direction; coefficient b primarily controls the curvature of the surface along the Y direction; coefficient c controls the surface's cross-bending or torsional characteristics in the X and Y directions; coefficients d and e represent the surface's inclination or slope along the X and Y directions at the origin, respectively; and coefficient f is a constant term representing the surface's reference height at the origin (X=0, Y=0). Solving this set of coefficients using the least squares method aims to obtain a quadratic surface model that optimally fits the spatial distribution of stable keypoints and their neighboring points in the sense of minimizing error. Substituting the local coordinates of the stable keypoints and their multiple neighboring points into this equation yields a linear equation for each point. By collecting the overdetermined linear equations formed by all points, the least squares method is used to solve for these six quadratic surface coefficients. The least squares method obtains the coefficient solution that minimizes the sum of squared fitting errors for all points by constructing and solving the normal equation.

[0032] The Gaussian curvature and mean curvature at the stable keypoint are calculated based on the fitted quadratic surface coefficients, and used as the surface curvature at the stable keypoint. In differential geometry, for a surface represented by the form Z=F(X, Y), the curvature can be calculated using the first and second partial derivatives of the function. In the current local coordinate system, the stable keypoint is located at the origin. Using the fitted quadratic surface coefficients, the first partial derivatives Fx=d, Fy=e, and the second partial derivatives Fxx=2a, Fyy=2b, Fxy=c at the origin can be directly obtained. The formula for calculating the Gaussian curvature K is: K=(Fxx×Fyy-Fxy) 2 ) / (1+Fx 2 +Fy 2 ) 2 The formula for calculating the mean curvature H is: H = [Fxx × (1 + Fy)] 2 )+Fyy×(1+Fx 2 )-2×Fxy×Fx×Fy] / [2×(1+Fx 2 +Fy 2 ) (3 / 2) The coefficients are substituted into the formula to calculate the Gaussian curvature K and the average curvature H. These two values ​​are then used together as the surface curvature at the stable key point for subsequent feature analysis. The entire process, from finding neighboring points to calculating curvature, is repeated for all stable key points, thereby assigning each stable key point a set of geometric quantities describing the degree of local surface curvature.

[0033] S4. Clustering is performed based on the three-dimensional spatial coordinates and surface curvature of each stable key point to form multiple morphological regions. The specific implementation is as follows: This step aims to aggregate stable keypoints with similar 3D positions and surface curvature characteristics to form regions with clear morphological significance. First, the 3D spatial coordinates and surface curvature of each stable keypoint are combined into a multidimensional feature vector. For a specific stable keypoint, its 3D spatial coordinates include three scalar values: X, Y, and Z coordinates. The surface curvature of the stable keypoint includes two scalar values: Gaussian curvature K and mean curvature H. The combination method involves concatenating these five scalar values ​​in the order of X, Y, Z, Gaussian curvature K, and mean curvature H to form a five-dimensional multidimensional feature vector. The X, Y, and Z coordinate values ​​are derived from the 3D spatial coordinates obtained through triangulation calculations, while the Gaussian curvature K and mean curvature H values ​​are derived from the Gaussian curvature and mean curvature values ​​obtained through local quadratic surface fitting calculations.

[0034] Because the numerical ranges of three-dimensional spatial coordinates and surface curvature differ by orders of magnitude, directly using the multidimensional feature vectors of the original data combination for clustering will lead to the larger coordinate components dominating distance calculations. Therefore, it is necessary to normalize each multidimensional feature vector to ensure that the numerical ranges of the three-dimensional spatial coordinates and surface curvature are consistent. The normalization process employs a min-max normalization method. Specifically, for a set of multidimensional feature vectors containing all stable keypoints, the global minimum and global maximum values ​​are calculated in each of the five dimensions: X-coordinate, Y-coordinate, Z-coordinate, Gaussian curvature K-value, and mean curvature H-value. Then, for each multidimensional feature vector in the set, the value of each dimension is transformed. The transformation formula is: the transformed dimension value equals the original dimension value minus the global minimum value of that dimension, divided by the difference between the global maximum and global minimum values ​​of that dimension. After this transformation, the value of each dimension is mapped to a closed interval between 0 and 1, thus eliminating the influence of different physical dimensions and orders of magnitude.

[0035] Based on the normalized multidimensional feature vectors, a density-based clustering method is used to divide stable keypoints into multiple clusters, each corresponding to a morphological region. The density-based clustering method employs a density-based noisy spatial clustering algorithm. The specific implementation of the density-based clustering method includes the following steps: Calculate the Euclidean distance between each pair of normalized multidimensional feature vectors. For any two five-dimensional feature vectors, the Euclidean distance is the square root of the sum of the squared differences between the two feature vectors in their corresponding dimensions. Calculate the Euclidean distance between all point pairs for subsequent neighborhood queries.

[0036] Based on the calculated Euclidean distance, core points, boundary points, and noise points are identified by setting a neighborhood radius and a minimum point count threshold. The neighborhood radius is a distance threshold used to define the neighborhood range of a point. For a specific stable keypoint, its neighborhood is defined as the set of all other stable keypoints whose Euclidean distance to that keypoint is less than or equal to the neighborhood radius. The setting of the neighborhood radius needs to refer to the statistical distribution of Euclidean distances between all pairs of stable keypoints. One method is to calculate the median of all Euclidean distances and set the neighborhood radius as this median multiplied by an adjustment coefficient, with the adjustment coefficient ranging from 0.5 to 2, for example, using an adjustment coefficient of 1.2. The minimum point count threshold is a quantity threshold used to determine whether a stable keypoint is a core point. For a stable keypoint, if the number of stable keypoints contained in its neighborhood is greater than or equal to the minimum point count threshold, then the stable keypoint is marked as a core point. The minimum point count threshold is set based on the total number of stable keypoints, and is a percentage between 1% and 5% of the total number of stable keypoints, but not less than 4. All core points can be identified by traversing all stable keypoints and comparing the number of points in their neighborhood with the minimum point count threshold. For stable keypoints that are not core points, if the stable keypoint is located within the neighborhood of a core point, it is marked as a boundary point. If a stable keypoint is neither a core point nor belongs to the neighborhood of any core point, it is marked as a noise point. Noise points are generally considered to be isolated points or points not belonging to any dense region. In this method, stable keypoints marked as noise points do not participate in the construction of morphological regions in subsequent steps.

[0037] All points consisting of core points and their density-reachable boundary points are grouped into clusters, thus forming multiple morphological regions. Density reachability is defined as follows: if there exists a sequence of core points, where the first core point is the starting point and the last core point is the ending point, and each core point in the sequence is within the neighborhood of the previous core point, then the ending point is said to be density-reachable from the starting point. A boundary point is density-reachable from a core point if it is located within its neighborhood. The clustering process begins with an unvisited core point, finds all stable keypoints density-reachable from that core point, assigns these stable keypoints to a unique cluster identifier, forming a cluster. Then, the next unvisited core point is selected, and this process is repeated until all core points have been visited. All stable keypoints marked as boundary points are assigned to the corresponding cluster based on their core point neighborhood. Stable keypoints marked as noise are not assigned to any cluster. Ultimately, each successfully partitioned cluster contains stable keypoints that exhibit a relative clustering of spatial locations and curvature features in the normalized feature space. These stable keypoints correspond to a continuous local region on the surface of the medicinal material with similar geometric properties, which is defined as a morphological region. The granularity of the generated morphological region can be controlled by adjusting the neighborhood radius and the minimum number of points threshold.

[0038] S5. Generate curvature distribution sub-histograms for each morphological region, calculate the similarity measure of curvature distribution sub-histograms between any two morphological regions to obtain the inter-region curvature distribution correlation matrix, and perform structured encoding on all curvature distribution sub-histograms and the inter-region curvature distribution correlation matrix to generate the curvature distribution histogram feature vector of the Chinese medicinal material sample. The specific implementation is as follows: This step aims to extract statistical features from the divided morphological regions and encode the relationships between regions, ultimately forming a comprehensive digital feature vector to characterize the shape of the entire Chinese medicinal herb sample. For each morphological region, the numerical distribution of surface curvature at all stable keypoints within the region is statistically analyzed to generate a curvature distribution sub-histogram. Specifically, for a given morphological region, pre-calculated surface curvature values ​​are collected at each stable keypoint within that region. Surface curvature values ​​include Gaussian curvature K and mean curvature H. Two independent curvature distribution sub-histograms are generated for each morphological region: one for Gaussian curvature and one for mean curvature. For the Gaussian curvature of the morphological region, the range of Gaussian curvature K values ​​at all stable keypoints within that region is determined, i.e., the minimum and maximum K values. This range is then uniformly divided into several continuous intervals, the number of which is set according to the statistical accuracy requirements, for example, 10 intervals. The number of stable keypoints falling within each interval is counted, and this number is converted into a frequency by dividing the number by the total number of stable keypoints within the morphological region. Each interval and its corresponding frequency values ​​are arranged in interval order, forming a Gaussian curvature distribution sub-histogram for that morphological region. The average curvature H value of the morphological region is processed in the same way: its range is determined, intervals are uniformly divided, and frequencies are counted to obtain an average curvature distribution sub-histogram. Each morphological region ultimately outputs two one-dimensional curvature distribution sub-histograms. Each sub-histogram is a vector containing frequency values, with a length equal to the number of intervals.

[0039] The Bartholomew's distance between the curvature distribution sub-histograms of any two morphological regions is used as a similarity measure. Let there be two morphological regions, A and B. First, calculate the Bartholomew's distance between the Gaussian curvature distribution sub-histograms of regions A and B. Let the vector of the Gaussian curvature distribution sub-histogram of region A be P, with length n, where Pi represents the frequency value of the i-th interval. Let the vector of the Gaussian curvature distribution sub-histogram of region B be Q.

[0040] The formula for calculating the Barthel Index (BC) is: The formula for calculating the Bartholin's distance (BD) is: BD = -ln(BC). During calculation, it's necessary to ensure that P and Q are valid probability distributions, meaning the sum of all elements in each vector is 1. For the mean curvature distribution sub-histogram, the same formula is used to obtain another Bartholin's distance value. For regions A and B, two Bartholin's distance values ​​are obtained, one based on a Gaussian curvature distribution and the other on a mean curvature distribution. These two Bartholin's distance values ​​are added together and divided by 2 to obtain the combined Bartholin's distance between regions A and B, which serves as the final similarity measure. The above calculation process is repeated for all pairwise morphological region pairs.

[0041] Construct an inter-region curvature distribution correlation matrix based on the pairwise Bartholomew's distances between all morphological regions. Assume there are M morphological regions. Construct an M x M matrix, called the inter-region curvature distribution correlation matrix. The rows and columns of the matrix are arranged according to the fixed indexing order of the morphological regions. The element value in the q-th row and p-th column of the matrix is ​​the calculated composite Bartholomew's distance between the q-th and p-th morphological regions, where q is the row number and p is the column number. Since Bartholomew's distance is symmetric, the inter-region curvature distribution correlation matrix is ​​a symmetric matrix. The elements on the main diagonal of the matrix represent the distance between a region and itself, and this value is set to 0.

[0042] All morphological regions are arranged in a preset numbering order, and the one-dimensional vectors of the flattened curvature distribution sub-histograms of each morphological region are concatenated in this order to obtain a concatenated sub-histogram vector. The preset numbering order can be the order in which the morphological regions were discovered during the clustering process. For each morphological region, the Gaussian curvature distribution sub-histogram vector and the average curvature distribution sub-histogram vector are concatenated end-to-end to form a one-dimensional feature vector representing that morphological region. Assuming each sub-histogram has n intervals, the length of this one-dimensional feature vector is 2n. Following the numbering order of the morphological regions, the one-dimensional feature vectors of the first morphological region, the second morphological region, and so on up to the Mth morphological region are concatenated sequentially to form a longer concatenated sub-histogram vector. The total length of this concatenated sub-histogram vector is M×2n.

[0043] Flatten all elements above the main diagonal of the inter-region curvature distribution incidence matrix into a one-dimensional vector, following row-major order, to obtain the incidence matrix vector. Since the inter-region curvature distribution incidence matrix is ​​symmetric, only the upper triangular portion is used, excluding the main diagonal. For an M x M matrix, the number of elements in the upper triangular portion is M × (M-1) / 2. Starting from the first row, extract elements whose column number is greater than their row number, then extract elements from the second row, and so on, up to the (M-1)th row. Arrange these extracted elements in the order they were extracted to form a one-dimensional incidence matrix vector.

[0044] The sub-histogram concatenation vector and the correlation matrix vector are concatenated in this order to form the final curvature distribution histogram feature vector. The concatenation operation appends the correlation matrix vector to the end of the sub-histogram concatenation vector. The resulting curvature distribution histogram feature vector is a one-dimensional numerical vector. This vector comprehensively encodes the curvature statistics within each morphological region, as well as the differences and correlations in curvature distribution patterns between any two different morphological regions, thus providing a shape descriptor for Chinese medicinal material samples that contains both local statistical information and global structural relationships. This curvature distribution histogram feature vector will be used for subsequent association and storage with information on the authentic origin of the medicinal materials. The number of intervals n typically ranges from 5 to 20. The number of morphological regions M is determined by the clustering process.

[0045] S6. Associate and store the feature vector of the curvature distribution histogram with the geographical origin information of the Chinese medicinal material samples to construct a database of the shape features of Chinese medicinal materials. The specific implementation is as follows: This step is the final output of the entire method, aiming to persistently associate the calculated digital features representing the three-dimensional shape of the medicinal herb sample with the sample's origin information, thereby constructing a specialized database that can be used for subsequent retrieval, comparison, and traceability. A database record structure template is established. A database record is the basic logical unit for information storage and manipulation in a database. A database record contains at least two core fields: a curvature distribution histogram feature vector field and a geographical origin information field. The curvature distribution histogram feature vector field stores a one-dimensional array of floating-point numbers, which is the curvature distribution histogram feature vector of the medicinal herb sample calculated in the previous step. The geographical origin information field stores a text string that explicitly indicates the recognized or certified geographical origin of the medicinal herb sample. The structure definition of the database record is accomplished through data definition language operations in a database management system. In a relational database management system, a data table is defined by executing a structured query language statement to create a table. This data table contains the aforementioned curvature distribution histogram feature vector field and geographical origin information field. Specify the data type as a real number array for the curvature distribution histogram feature vector field. Specify the data type as a variable-length string for the origin information field. Data Definition Language operations are executed once during database initialization.

[0046] After defining the database record structure, the specific data filling operation is performed. The curvature distribution histogram feature vector of the currently processed medicinal herb sample is filled into the curvature distribution histogram feature vector field. The filling operation means creating a new database record instance in the program memory that conforms to the above data table structure. Each numerical element in the curvature distribution histogram feature vector array is assigned sequentially to the storage location corresponding to the curvature distribution histogram feature vector field in this record instance, according to its order in the array. Simultaneously, the authentic origin information of the currently processed medicinal herb sample is filled into the authentic origin information field. Authentic origin information exists in string form. During filling, this string is completely copied to the storage space of the authentic origin information field in the record instance. In addition to the core fields, the database record instance can also contain auxiliary fields. Auxiliary fields can include a data record number field. The data record number field stores a globally unique identifier, which can be generated by incrementing a global counter. Auxiliary fields can also include a medicinal herb name field. The herbal name field stores the generic name string of a Chinese medicinal herb sample; for example, entering "Sanqi" in the herbal name field. Auxiliary fields may also include a timestamp field. The timestamp field stores the date and time the data record was created. Each auxiliary field must have its data type and constraints specified when defining the data table.

[0047] The database records containing the filled curvature distribution histogram feature vectors and authentic origin information are written to a non-volatile storage medium, completing the construction of the Chinese medicinal material shape feature database. The write operation is performed through the data manipulation interface provided by the database management system. In the program logic, the data insertion method of the database connection object is called, and the filled database record instance is passed as a parameter to the data insertion method. The database management system receives the record data and verifies it according to the predefined data table structure. After the verification is successful, the database management system serializes the record data into a storage format, and then persistently saves the data to the database file on the physical storage medium through the file system's input / output interface. One write operation can store the record of one sample. As more and more Chinese medicinal material samples are processed from steps S1 to S5 and the generated records are continuously written to the storage medium, the number of data record entries in the database continues to grow, thus forming a Chinese medicinal material shape feature database. To improve the efficiency of subsequent identification and traceability based on this database, an index can be created in the database after the write operation is completed. For example, a multi-dimensional index structure can be created on the curvature distribution histogram feature vector field to support efficient nearest neighbor search. One usable multidimensional index structure is the R-tree. The indexing operation is performed by the database management system, which reads stored data and builds additional index files. Through these steps, a digital database of Chinese medicinal materials, with three-dimensional shape curvature features as its core and closely linked to information on the authentic origin of medicinal materials, is constructed. Each record in this database establishes a mapping relationship from the curvature distribution histogram feature vector to the authentic origin information, providing a core data foundation for the automatic identification and authenticity traceability of Chinese medicinal materials using computer technology. The entire construction process ensures the inseparable correlation between feature data and semantic information.

[0048] Example 2: Figure 2 A schematic diagram of a system for constructing a database of shape features of Chinese medicinal materials is provided. The system includes: The image acquisition module is used to acquire digital images of Chinese medicinal herb samples from multiple fixed spatial perspectives. The key point filtering module is used to extract key points from each digital image and perform cross-view matching before sparse 3D reconstruction to obtain an initial 3D point cloud. Based on the spatial distribution uniformity criterion, the initial 3D point cloud is resampled to filter out stable key points. The curvature calculation module is used to calculate the three-dimensional spatial coordinates corresponding to each stable key point, and to fit the local surface to calculate the surface curvature at each stable key point; The region clustering module is used to cluster based on the three-dimensional spatial coordinates and surface curvature of each stable key point to form multiple morphological regions. The feature encoding module is used to generate curvature distribution sub-histograms for each morphological region, calculate the similarity measure of curvature distribution sub-histograms between any two morphological regions to obtain the curvature distribution correlation matrix between regions, and perform structured encoding of all curvature distribution sub-histograms and the curvature distribution correlation matrix between regions to generate the curvature distribution histogram feature vector of the Chinese medicinal material sample. The database construction module is used to associate and store the feature vectors of the curvature distribution histogram with the geographical origin information of Chinese medicinal materials samples, and to construct a database of the shape features of Chinese medicinal materials.

[0049] All calculations involved in the embodiments are dimensionless numerical calculations, and the preset parameters and thresholds in the calculations are set by those skilled in the art according to the actual situation.

[0050] It should be noted that this invention can be deployed on the device itself to realize embedded applications, or it can run on a PC or other terminal with a user interface, thereby meeting various hardware environments and usage requirements.

[0051] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions according to the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wireless or wired transmission; wired transmission methods include optical fiber, twisted pair, coaxial cable, etc.; wireless transmission includes infrared, microwave, etc. Computer-readable storage media can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more sets of available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media. Semiconductor media can be solid-state drives.

[0052] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0053] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0054] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0055] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.

[0056] If a function is implemented as a software module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0057] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0058] In conclusion, the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for constructing a database of shape characteristics of Chinese medicinal materials, characterized in that, include: S1. Collect digital images of Chinese medicinal herb samples from multiple fixed spatial perspectives; S2. After extracting key points and performing cross-view matching on each digital image, sparse 3D reconstruction is performed to obtain an initial 3D point cloud. Based on the spatial distribution uniformity criterion, the initial 3D point cloud is resampled to select stable key points. S3. Calculate the three-dimensional spatial coordinates corresponding to each stable key point, and fit the local surface to calculate the surface curvature at each stable key point. S4. Clustering is performed based on the three-dimensional spatial coordinates and surface curvature of each stable key point to form multiple morphological regions; S5. Generate curvature distribution sub-histograms for each morphological region, calculate the similarity measure between curvature distribution sub-histograms of any two morphological regions to obtain the curvature distribution correlation matrix between regions, and perform structured encoding on all curvature distribution sub-histograms and the curvature distribution correlation matrix between regions to generate the curvature distribution histogram feature vector of the Chinese medicinal material sample. S6. Link and store the feature vector of the curvature distribution histogram with the authentic origin information of Chinese medicinal materials to construct a database of the shape features of Chinese medicinal materials.

2. The method for constructing a database of shape features of traditional Chinese medicinal materials according to claim 1, characterized in that, S1 includes: In three-dimensional space, multiple image acquisition devices are arranged at equal angular intervals along the horizontal rotation direction, with the Chinese medicinal material sample as the center. Multiple image acquisition devices are controlled to simultaneously acquire digital images of Chinese medicinal material samples, with each image acquisition device acquiring a digital image from a fixed spatial perspective. The digital images acquired by each image acquisition device are associated with and stored with the corresponding fixed spatial viewpoint identifier.

3. The method for constructing a database of shape features of traditional Chinese medicinal materials according to claim 1, characterized in that, S2 include: The initial 3D point cloud is divided into spatial grids, and the point cloud density in each grid is calculated. Identify dense and sparse regions in the initial 3D point cloud based on the point cloud density of all grids. Using points in sparse regions as the initial seed point set, perform iterative sampling of the farthest point. In each iteration, select the point that is spatially farthest from the current seed point set from the remaining points of the initial 3D point cloud and add it to the seed point set, and update the selection weight of the remaining points until the number of selected points reaches the preset number. The final seed point set is then used as the stable key points.

4. The method for constructing a database of shape characteristics of Chinese medicinal materials according to claim 3, characterized in that, Updating the selection weights of the remaining points includes reducing the selection weights of the remaining points in the spatial neighborhood of the points newly added to the seed point set in the previous iteration, in order to suppress duplicate sampling near the spatially sampled region.

5. The method for constructing a database of shape characteristics of Chinese medicinal materials according to claim 1, characterized in that, S3 includes: Based on the pixel coordinates of each stable key point in digital images from multiple fixed spatial perspectives and the geometric relationship between the fixed spatial perspectives, the three-dimensional spatial coordinates corresponding to each stable key point are calculated by the triangulation method. For each stable key point, find multiple neighboring points in its spatial neighborhood within the set of three-dimensional spatial coordinates; Principal component analysis is used to fit a plane to the stable key points and their multiple neighboring points, and a local coordinate system is established with the fitted plane as a reference. In the local coordinate system, quadratic surface fitting is performed using the three-dimensional spatial coordinates of the stable key point and its multiple neighboring points. The Gaussian curvature and mean curvature at the stable key point are calculated based on the fitted quadratic surface coefficients, and used as the surface curvature at the stable key point.

6. The method for constructing a database of shape characteristics of Chinese medicinal materials according to claim 1, characterized in that, S4 includes: The three-dimensional spatial coordinates and surface curvature of each stable key point are combined into a multi-dimensional feature vector; Each multidimensional feature vector is normalized to make the numerical range of the three-dimensional spatial coordinates and surface curvature consistent. Based on the normalized multidimensional feature vectors, density clustering is used to divide stable keypoints into multiple clusters, with each cluster corresponding to a morphological region.

7. The method for constructing a database of shape features of traditional Chinese medicinal materials according to claim 6, characterized in that, Based on the normalized multidimensional feature vectors, density clustering is used to divide stable keypoints into multiple clusters, including: Calculate the pairwise Euclidean distance between normalized multidimensional feature vectors; Based on Euclidean distance, core points, boundary points, and noise points are identified by setting the neighborhood radius and minimum number of points threshold; All point sets consisting of the core point and its density-reachable boundary points are divided into a cluster, thus forming multiple morphological regions.

8. The method for constructing a database of shape features of traditional Chinese medicinal materials according to claim 1, characterized in that, S5 include: For each morphological region, the numerical distribution of surface curvature at all stable keypoints within the morphological region is statistically analyzed to generate a curvature distribution sub-histogram. The Bartholomew's distance between the curvature distribution sub-histograms of any two morphological regions is calculated as a similarity measure, and an inter-region curvature distribution correlation matrix is ​​constructed based on the pairwise Bartholomew's distances between all morphological regions. All morphological regions are arranged in a preset numbering order, and the one-dimensional vectors of the flattened curvature distribution sub-histograms of each morphological region are spliced ​​together in this order to obtain the sub-histogram splicing vector. Flatten all elements above the main diagonal of the curvature distribution correlation matrix between regions into a one-dimensional vector according to the row priority of the matrix to obtain the correlation matrix vector. The sub-histogram concatenation vector and the correlation matrix vector are connected in this order to form the final curvature distribution histogram feature vector.

9. The method for constructing a database of shape features of traditional Chinese medicinal materials according to claim 1, characterized in that, S6 include: Establish database records, which must include at least a curvature distribution histogram feature vector field and an authentic origin information field. Fill the curvature distribution histogram feature vector of the Chinese medicinal material samples into the curvature distribution histogram feature vector field, and fill the authentic origin information of the Chinese medicinal material samples into the authentic origin information field. The database records containing the filled curvature distribution histogram feature vectors and authentic origin information are written into the storage medium to complete the construction of the Chinese medicinal material shape feature database.

10. A system for constructing a database of shape features of Chinese medicinal materials, used to implement the method for constructing a database of shape features of Chinese medicinal materials as described in any one of claims 1-9, characterized in that, include: The image acquisition module is used to acquire digital images of Chinese medicinal herb samples from multiple fixed spatial perspectives. The key point filtering module is used to extract key points from each digital image and perform cross-view matching before sparse 3D reconstruction to obtain an initial 3D point cloud. Based on the spatial distribution uniformity criterion, the initial 3D point cloud is resampled to filter out stable key points. The curvature calculation module is used to calculate the three-dimensional spatial coordinates corresponding to each stable key point, and to fit the local surface to calculate the surface curvature at each stable key point; The region clustering module is used to cluster based on the three-dimensional spatial coordinates and surface curvature of each stable key point to form multiple morphological regions. The feature encoding module is used to generate curvature distribution sub-histograms for each morphological region, calculate the similarity measure of curvature distribution sub-histograms between any two morphological regions to obtain the curvature distribution correlation matrix between regions, and perform structured encoding of all curvature distribution sub-histograms and the curvature distribution correlation matrix between regions to generate the curvature distribution histogram feature vector of the Chinese medicinal material sample. The database construction module is used to associate and store the feature vectors of the curvature distribution histogram with the geographical origin information of Chinese medicinal materials samples, and to construct a database of the shape features of Chinese medicinal materials.