Whole industry chain tracing method and system for traditional Chinese medicine decoction pieces and medium

By embedding watermark information in the traceability QR code of Chinese herbal medicines and verifying it, combined with the search for traceability data of the entire industry chain, the problem that the traceability technology of Chinese herbal medicines is not effectively combined with environmental factors is solved, and the accurate and true traceability of Chinese herbal medicines is achieved.

CN119887245AInactive Publication Date: 2025-04-25THE CHINESE MEDICINE RAW MATERIALO PROCESSING PLANT OF THE GUANGDONG TRADITIONAL CHINESE MEDICINE CORP
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510270769.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-04-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing traceability technology of traditional Chinese herbal medicines has not been effectively combined with environmental factors, resulting in the impact of pollutants carried by traditional Chinese herbal medicines during the planting process that cannot be fully tracked and verified, affecting the efficacy and safety of medicine.

Method used

By embedding watermark information in the traceability QR code of Chinese herbal medicines, and after extracting and verifying the watermark information in the scanning terminal, searching and displaying the traceability data of the entire industry chain, including the environmental data in the planting data.

Benefits of technology

The entire industrial chain traceability of Chinese herbal medicines is realized, the authenticity and effectiveness of traceability is ensured, and through the inclusion of environmental data, the impact of environmental pollution on Chinese herbal medicines during the planting process can be accurately tracked.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887245A_ABST
    Figure CN119887245A_ABST
Patent Text Reader

Abstract

The invention discloses a whole industry chain tracing method and system for traditional Chinese medicine decoction pieces and a medium, and the method comprises the steps: obtaining a tracing two-dimensional code image corresponding to a to-be-traced traditional Chinese medicine decoction piece, and carrying out the preprocessing, thereby obtaining a preprocessed image; watermark information carried by the preprocessed image is extracted, after the watermark information is judged to be effective information, traceability data is searched, the traceability data at least comprises planting data, harvesting and processing data, logistics storage data and circulation data, and the planting data further comprises environment data; and transmitting the traceability data to a scanning terminal for display, thereby completing the whole industry chain traceability of the to-be-traced traditional Chinese medicine decoction pieces. The method belongs to the technical field of data processing, the watermark information is read through the graphic data to reflect the authenticity and validity of the traceability two-dimensional code image, the traceability data is set to contain the environmental data reflecting the influence of the environmental factors on the traditional Chinese medicinal materials in the planting process, the traceability is ensured to be true and effective, and meanwhile the traceability efficiency is improved. And the traditional Chinese medicine decoction pieces are accurately and comprehensively traced in the whole industry chain in combination with environmental factors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a whole-industry chain traceability method, system and medium for Chinese herbal medicine slices. Background Art

[0002] Chinese herbal medicine slices are preparations made from Chinese medicinal materials that have been processed, sliced ​​or cooked and can be directly used in prescriptions. Their quality directly affects the clinical efficacy and patient medication safety. Currently, in order to ensure the quality and safety of Chinese herbal medicine slices, a traceability mechanism can be set up for Chinese herbal medicine slices. Through traceability, the entire process of Chinese herbal medicine slices from the planting of Chinese medicinal materials, production and processing, transportation and storage to sales and circulation can be tracked to ensure the safety of each link in the whole process. However, this whole process traceability focuses on each link of the Chinese herbal medicine slices from planting to circulation, and does not involve the impact of environmental factors on Chinese herbal medicine slices, especially environmental pollution factors during the planting process. Environmental pollution during the planting process can cause Chinese medicinal materials to carry pollutants, causing the important herbal medicine slices to also carry pollutants and affect their efficacy.

[0003] In addition, although there are various ways to achieve the whole process traceability of Chinese herbal medicines, for example, traceability can be achieved through QR codes, RFID (Radio Frequency IDentification), blockchain, Internet of Things, etc. For consumers, QR code traceability is relatively convenient. By scanning the QR code through a mobile phone or other terminal, you can learn about the whole process traceability of Chinese herbal medicines from planting to circulation. However, while QR code traceability brings convenience to consumers, it also increases the risk of fraud by criminals, such as making fake QR codes for consumers to scan.

[0004] Therefore, how to combine environmental factors to accurately trace the source of Chinese herbal medicines throughout the entire industry chain and ensure the authenticity and effectiveness of the traceability is one of the technical problems that need to be solved at present. Summary of the invention

[0005] The main purpose of the present invention is to provide a method, system and medium for tracing the entire industrial chain of Chinese herbal medicines, aiming to solve the technical problem of how to accurately trace the entire industrial chain of Chinese herbal medicines in combination with environmental factors, and to ensure the authenticity and effectiveness of the traceability, which is one of the technical problems that need to be solved at present.

[0006] To achieve the above object, the present invention provides a whole industry chain traceability method for Chinese herbal medicine slices, the whole industry chain traceability method comprising:

[0007] Obtaining a traceability two-dimensional code image corresponding to the Chinese herbal medicine to be traced based on a scanning terminal, and preprocessing the traceability two-dimensional code image to obtain a preprocessed image;

[0008] Extracting watermark information carried by the preprocessed image, and determining whether the watermark information is valid information;

[0009] If the watermark information is valid information, then searching for traceability data corresponding to the traceability two-dimensional code image, wherein the traceability data at least includes planting data, harvesting and processing data, logistics and warehousing data, and circulation data, and the planting data includes environmental data;

[0010] The traceability data is transmitted to the scanning terminal for display, completing the traceability of the entire industrial chain of the Chinese herbal medicine to be traced.

[0011] Preferably, the step of extracting the watermark information carried by the pre-processed image and determining whether the watermark information is valid information comprises:

[0012] Obtaining the grayscale value of each pixel in the preprocessed image, and searching for a target grayscale value that is less than a preset grayscale threshold among the grayscale values, and extracting the target pixel corresponding to each target grayscale value as the watermark information;

[0013] Determine the position coordinates of each target pixel point in the image coordinate system corresponding to the preprocessed image, and form each target grayscale value into a grayscale matrix according to each position coordinate;

[0014] Acquire a reference grayscale matrix corresponding to the watermark information, and align the reference grayscale matrix with the grayscale matrix in rows and columns;

[0015] Calculating the correlation between the reference grayscale matrix and the grayscale matrix to obtain a correlation value, and judging whether the watermark information is valid information based on the correlation value;

[0016] The formula for calculating the correlation is:

[0017]

[0018] Among them, K represents the correlation value, u1 represents the number of rows of the reference grayscale matrix, u2 represents the number of columns of the reference grayscale matrix, E(j1, j2) represents the element value corresponding to the j1th row and j2th column in the grayscale matrix, and E0(j1, j2) represents the element value corresponding to the j1th row and j2th column in the reference grayscale matrix.

[0019] Preferably, the step of judging whether the watermark information is valid information based on the correlation value comprises:

[0020] Comparing the correlation value with a preset correlation threshold to determine whether the correlation value is greater than or equal to the preset correlation threshold;

[0021] If the correlation value is greater than or equal to a preset correlation threshold, the watermark information is determined to be valid information;

[0022] If the correlation value is less than a preset correlation threshold, it is determined that the watermark information is not valid information.

[0023] Preferably, the step of searching for the traceability data corresponding to the traceability two-dimensional code image includes:

[0024] Obtaining environmental data monitored at preset intervals during the planting process of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, and generating pollutant concentration parameters of the preset period based on the environmental data;

[0025] Obtaining the fertilization data, irrigation data, and pest and disease control data of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced during the planting process;

[0026] The environmental data and pollutant concentration parameters corresponding to each of the preset periods, as well as the fertilization data, irrigation data and pest control data are generated as the planting data.

[0027] Preferably, the step of generating the pollutant concentration parameter of the preset period based on the environmental data comprises:

[0028] Obtaining the planting base information of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, wherein the planting base information includes the base area and the monitoring location information of each monitoring point in the planting base;

[0029] generating a monitoring area according to each of the monitoring location information;

[0030] According to a preset calculation formula, the monitoring area, the base area, the pollutant monitoring concentration and the monitoring wind speed of each monitoring point in the environmental data are calculated to generate the pollutant concentration parameter;

[0031] The preset calculation formula is:

[0032]

[0033] Among them, P represents the pollutant concentration parameter, A0 represents the base area, Ai represents the monitoring area, n1 represents the number of monitoring points, n2 represents the number of pollutant types contained in the environmental data, αt represents the weight value corresponding to the t-th pollutant, Qit represents the pollutant monitoring concentration of the t-th pollutant monitored by the ith monitoring point, Ui represents the monitoring wind speed of the ith monitoring point, αi represents the horizontal diffusion parameter corresponding to the monitoring wind speed Ui, βi represents the vertical diffusion parameter corresponding to the monitoring wind speed Ui, Yi represents the Y-axis coordinate value of the ith monitoring point in the coordinate system corresponding to the planting base, Zi represents the Z-axis coordinate value of the ith monitoring point in the coordinate system corresponding to the planting base, and the coordinate system corresponding to the planting base is a three-dimensional coordinate system with the ground where the planting base is located as the XOY plane and the direction perpendicular to the ground as the Z axis.

[0034] Preferably, the step of searching for the traceability data corresponding to the traceability two-dimensional code image includes:

[0035] Arranging each first data element in the planting data based on the formation time of each first data element to form a planting data sequence;

[0036] Arranging each of the second data elements in the collected and processed data based on the formation time of each of the second data elements to form a collected and processed data sequence;

[0037] Arranging each of the third data elements in the logistics warehousing data based on the formation time of each of the third data elements to form a logistics warehousing data sequence;

[0038] Arranging each of the fourth data elements in the circulation data based on the formation time of each of the fourth data elements to form a circulation data sequence;

[0039] An encryption key is generated based on the planting data sequence, harvesting and processing data sequence, logistics and warehousing data sequence, and circulation data sequence, and the planting data, harvesting and processing data, logistics and warehousing data, and circulation data are encrypted and stored based on the encryption key.

[0040] Preferably, the step of generating an encryption key based on the planting data sequence, the harvesting and processing data sequence, the logistics and warehousing data sequence and the circulation data sequence comprises:

[0041] Respectively obtain the first data quantity and the first median sequence number of the planting data sequence, the second data quantity and the second median sequence number of the harvesting and processing data sequence, the third data quantity and the third median sequence number of the logistics and warehousing data sequence, and the fourth data quantity and the fourth median sequence number of the circulation data sequence;

[0042] Performing a mean operation on the first data quantity, the second data quantity, the third data quantity, and the fourth data quantity to generate a data quantity parameter;

[0043] Calculating the first data quantity, the first median sequence number, the second data quantity, the second median sequence number, the third data quantity, the third median sequence number, the fourth data quantity, the fourth median sequence number and the data quantity parameter based on a preset formula group to generate an encryption key;

[0044] The preset formula group is:

[0045]

[0046] Among them, T1 represents the first parameter, m represents the data quantity parameter, W1 represents the first data quantity, S1 represents the first median sequence number, T2 represents the second parameter, W2 represents the second data quantity, S2 represents the second median sequence number, T3 represents the third parameter, W3 represents the third data quantity, S3 represents the third median sequence number, T4 represents the fourth parameter, W4 represents the fourth data quantity, S4 represents the fourth median sequence number, and F represents the encryption key.

[0047] Preferably, the step of searching for the traceability data corresponding to the traceability two-dimensional code image includes:

[0048] Receiving the collection data, processing data and quality inspection data of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, and generating the collection data, processing data and quality inspection data into collection and processing data;

[0049] Receiving logistics transportation data and storage data corresponding to the Chinese herbal medicine pieces to be traced, and generating the logistics transportation data and storage data into logistics warehousing data;

[0050] Receive the transaction data and market sampling data corresponding to the Chinese herbal medicine pieces to be traced, and generate the transaction data and market sampling data into circulation data.

[0051] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a whole industry chain traceability system for Chinese herbal medicine pieces, the whole industry chain traceability system for Chinese herbal medicine pieces comprising a memory, a processor, a communication bus and a control program stored in the memory:

[0052] The communication bus is used to realize the connection and communication between the processor and the memory;

[0053] The processor is used to execute the control program to implement the steps of the whole industry chain traceability method of Chinese herbal medicine pieces as described above.

[0054] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a medium, which is a readable storage medium, on which a control program is stored, and when the control program is executed by a processor, the steps of the whole industry chain traceability method of Chinese herbal medicines are implemented as described above.

[0055] The whole industry chain traceability method, system and medium of the Chinese herbal medicine slices of the present invention first obtain the traceability two-dimensional code image corresponding to the Chinese herbal medicine slices to be traced through a scanning terminal, and pre-process the obtained traceability two-dimensional code image to obtain a pre-processed image; then extract the watermark information from the pre-processed image, and judge whether the watermark information is valid information; if it is valid information, then search for the traceability data corresponding to the traceability two-dimensional code image, and the traceability data searched includes at least planting data, harvesting and processing data, logistics and warehousing data, and circulation data, and the planting data also includes environmental data; and then transmit the traceability data obtained by the search to the scanning terminal for display, and complete the whole industry chain traceability of the Chinese herbal medicine slices to be traced. In this way, by setting the traceability two-dimensional code image to carry watermark information, only when the watermark information is determined to be valid information, indicating that the traceability two-dimensional code image is true and valid, the corresponding whole industry chain traceability data is searched for traceability, thereby ensuring the authenticity and validity of the traceability. At the same time, the traceability data of the whole industry chain contains environmental data reflecting the impact of environmental factors in the planting process on Chinese herbal medicines. It has achieved accurate and comprehensive traceability of the entire industry chain of Chinese herbal medicines by combining environmental factors, and ensured the authenticity and effectiveness of the traceability. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is a schematic diagram of the process of the first embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces of the present invention;

[0057] Figure 2 It is a schematic flow chart of a second embodiment of the whole industry chain traceability method of Chinese herbal medicine slices of the present invention;

[0058] Figure 3 It is a schematic flow chart of a third embodiment of the whole industry chain traceability method of Chinese herbal medicine slices of the present invention;

[0059] Figure 4 It is a schematic flow chart of a fourth embodiment of the whole industry chain traceability method of Chinese herbal medicine slices of the present invention;

[0060] Figure 5 It is a structural schematic diagram of the hardware operating environment involved in an embodiment of the whole industry chain traceability system of Chinese herbal medicine pieces of the present invention.

[0061] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0062] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0063] The present invention provides a method for tracing the source of the entire industrial chain of Chinese herbal medicine slices. Figure 1 , Figure 1 It is a schematic flow chart of the first embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces of the present invention.

[0064] The embodiment of the present invention provides an embodiment of a method for tracing the source of the entire industry chain of Chinese herbal medicines. It should be noted that although the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in a different order than that here. Specifically, the method for tracing the source of the entire industry chain of Chinese herbal medicines in this embodiment includes:

[0065] Step S10, obtaining the traceability two-dimensional code image corresponding to the Chinese herbal medicine to be traced based on the scanning terminal, and preprocessing the traceability two-dimensional code image to obtain a preprocessed image.

[0066] The whole industry chain traceability method of Chinese herbal medicine slices in this embodiment is applied to the traceability system, and the traceability system can be set to include a server and a database. The database stores the full chain data of various types and batches of Chinese herbal medicine slices from planting to circulation, and the server is used for traceability data processing. Various types and batches of Chinese herbal medicine slices have a two-dimensional code representing their own uniqueness. When consumers or purchasing companies have a traceability demand for a certain Chinese herbal medicine slice, they can scan the two-dimensional code of the Chinese herbal medicine slice to be traced through a scanning terminal such as a mobile phone, obtain a two-dimensional code image by scanning, and upload the two-dimensional code image to the server of the traceability system. The server receives the two-dimensional code image and uses it as the two-dimensional code image corresponding to the Chinese herbal medicine slice to be traced. Then the two-dimensional code image is preprocessed to obtain a preprocessed image.

[0067] Among them, preprocessing includes but is not limited to grayscale processing, noise reduction processing, image enhancement, geometric correction, edge detection, etc. Grayscale processing is the process of converting a color QR code image into a grayscale image, which can reduce the amount of data for subsequent processing. It can be specifically achieved through the RGB value and grayscale value conversion formula. Noise reduction processing is the process of removing noise from the image and improving the recognizability of the QR code. It can be achieved through median filtering, Gaussian filtering, etc. The purpose of image enhancement is to improve image contrast and clarity, which can be achieved through histogram equalization, contrast stretching, etc. Geometric correction is the process of correcting image deformation caused by shooting angle or lens distortion, which can be achieved through perspective transformation and affine transformation. Edge detection is to assist positioning by extracting the edge information of the QR code, which can be achieved through Canny operator, Sobel operator, etc.

[0068] Step S20, extracting the watermark information carried by the pre-processed image, and determining whether the watermark information is valid information.

[0069] Furthermore, in order to prevent the Chinese herbal medicines and the QR codes they carry from being counterfeited, watermark information is set in advance for the QR codes carried on the Chinese herbal medicines, and the watermark information is stored in the database as reference watermark information. The traceability QR code image obtained by the server through the scanning terminal correspondingly contains the watermark information, and the preprocessed image obtained by preprocessing the traceability QR code image also contains the watermark information. The server extracts the watermark information contained in the preprocessed image, reads the reference watermark information from the database, and then compares the extracted watermark information with the reference watermark information, and determines whether the watermark information is valid information based on the correlation between the two.

[0070] Step S30: if the watermark information is valid information, then search for traceability data corresponding to the traceability two-dimensional code image, wherein the traceability data at least includes planting data, harvesting and processing data, logistics and warehousing data, and circulation data, and the planting data includes environmental data.

[0071] Furthermore, if the watermark information is determined to be valid information, indicating that the Chinese herbal medicine slices and the QR codes they carry are authentic Chinese herbal medicine slices and QR codes, then the traceability data corresponding to the traceability QR code is searched from the database. The traceability data searched for at least includes planting data, harvesting and processing data, logistics and warehousing data, and circulation data. Among them, the planting data are various data such as environment, fertilization, irrigation, pests and diseases recorded during the planting process of the Chinese medicinal materials corresponding to the Chinese herbal medicine slices; the harvesting and processing data are mainly the harvesting, processing, and quality inspection data of the Chinese medicinal materials after they mature; the logistics and warehousing data are mainly the storage logistics data of the Chinese medicinal materials after they are processed into Chinese herbal medicine slices; and the circulation data are mainly the sales and sampling data of the Chinese herbal medicine slices. Each item of data is recorded in its corresponding link and transmitted to the database for storage. Specifically, for the harvesting and processing data, logistics and warehousing data, and circulation data of the Chinese herbal medicine slices to be traced, the step of searching for the traceability data corresponding to the traceability QR code image includes:

[0072] Step a1, receiving the collection data, processing data and quality inspection data of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, and generating the collection data, processing data and quality inspection data into collection and processing data;

[0073] Step a2, receiving the logistics transportation data and storage data corresponding to the Chinese herbal medicine to be traced, and generating the logistics transportation data and storage data into logistics warehousing data;

[0074] Step a3, receiving the transaction data and market sampling data corresponding to the Chinese herbal medicine pieces to be traced, and generating the transaction data and market sampling data into circulation data.

[0075] Furthermore, in the process of harvesting the Chinese herbal medicines to be traced, the harvesting time, harvesting method, harvesting personnel, etc. are recorded as harvesting data; the time, method, equipment and operators of the primary processing processes such as cleaning, drying and slicing, the key parameters such as the processing method, auxiliary material use, processing time, temperature, etc. are recorded as processing data; and the quality inspection results after processing, such as the content of active ingredients, heavy metal residues, pesticide residues, etc. are recorded as quality inspection data. The recorded harvesting data, processing data and quality inspection data are transmitted to the server. After receiving the data, the server generates the harvesting data, processing data and quality inspection data into harvesting and processing data according to the QR code corresponding to the Chinese herbal medicines to be traced, and transmits the generated harvesting and processing data to the database for storage.

[0076] Furthermore, for the logistics and transportation process of the processed Chinese herbal medicines to be traced, the transportation mode, transportation time, transportation conditions (such as temperature and humidity control) and quality monitoring during transportation are recorded as logistics and transportation data. And, for the storage process of the Chinese herbal medicines to be traced, the storage conditions (such as temperature and humidity), storage time, inventory location, etc. are recorded as storage data. Then, the recorded logistics and transportation data and storage data are transmitted to the server. After receiving the data, the server generates the logistics and transportation data and storage data into logistics and warehousing data according to the QR code corresponding to the Chinese herbal medicines to be traced, and transmits the generated logistics and warehousing data to the database for storage.

[0077] Furthermore, for the sales process of the Chinese herbal medicines to be traced, the sales object, sales time, sales quantity, etc. are recorded as transaction data. And, for the sampling inspection process of the Chinese herbal medicines to be traced when they are circulated in the market, the sampling inspection results, sampling inspection time, sampling inspection location and sampling inspection personnel are recorded as market sampling inspection data. Then the recorded transaction data and market sampling inspection data are sent to the server. After the server receives them, the transaction data and market sampling inspection data are generated as circulation data based on the QR code corresponding to the Chinese herbal medicines to be traced, and the generated circulation data is transmitted to the database for storage. In this way, by obtaining various types of data from the planting to the sales of the Chinese herbal medicines to be traced and storing them according to the QR code of the Chinese herbal medicines to be traced, it is convenient for the subsequent tracing of the Chinese herbal medicines based on the QR code image.

[0078] Step S40, transmitting the traceability data to the scanning terminal for display, completing the traceability of the entire industry chain of the Chinese herbal medicine to be traced.

[0079] Furthermore, after finding the traceability data corresponding to the traceability QR code image from the database, the traceability data is transmitted to the scanning terminal for display, so that the holder of the scanning terminal can view the relevant data of each link from planting to sales of the Chinese herbal medicine to be traced, and realize the traceability of the whole industry chain of the Chinese herbal medicine to be traced. In addition, for easy viewing, the display template can be pre-set, and the display template is divided into multiple display areas. For example, the planting data display area, the harvesting and processing data display area, the logistics and warehousing data display area, and the circulation data display area. The traceability data found is added according to each display area to form a corresponding display page, so that the relevant data of the Chinese herbal medicine to be traced in each link of the whole industry chain can be viewed according to each display page.

[0080] The whole industry chain traceability method of Chinese herbal medicine slices implemented in this embodiment first obtains the traceability QR code image corresponding to the Chinese herbal medicine slices to be traced through the scanning terminal, and pre-processes the obtained traceability QR code image to obtain the pre-processed image; then extracts the watermark information from the pre-processed image, and determines whether the watermark information is valid information; if it is valid information, then searches for the traceability data corresponding to the traceability QR code image, and the traceability data searched includes at least planting data, harvesting and processing data, logistics and warehousing data, and circulation data, and the planting data also includes environmental data; then the traceability data obtained by the search is transmitted to the scanning terminal for display, and the whole industry chain traceability of the Chinese herbal medicine slices to be traced is completed. In this way, by setting the traceability QR code image to carry watermark information, only when the watermark information is determined to be valid information, indicating that the traceability QR code image is true and valid, the corresponding whole industry chain traceability data is searched for traceability, ensuring the authenticity and effectiveness of the traceability. At the same time, the traceability data of the whole industry chain contains environmental data reflecting the impact of environmental factors in the planting process on Chinese herbal medicines. It has achieved accurate and comprehensive traceability of the entire industry chain of Chinese herbal medicines by combining environmental factors, and ensured the authenticity and effectiveness of the traceability.

[0081] For further information, please refer to Figure 2 Based on the first embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces of the present invention, a second embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces of the present invention is proposed.

[0082] The difference between the second embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces and the first embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces is that the step of extracting the watermark information carried by the pre-processed image and judging whether the watermark information is valid information includes:

[0083] Step S21, obtaining the grayscale value of each pixel in the preprocessed image, and searching for a target grayscale value that is less than a preset grayscale threshold among the grayscale values, and extracting the target pixel corresponding to each target grayscale value as the watermark information;

[0084] Step S22, determining the position coordinates of each target pixel point in the image coordinate system corresponding to the preprocessed image, and forming each target grayscale value into a grayscale matrix according to each position coordinate;

[0085] Step S23, obtaining a reference grayscale matrix corresponding to the watermark information, and aligning the reference grayscale matrix with the grayscale matrix in rows and columns;

[0086] Step S24, performing correlation calculation on the reference grayscale matrix and the grayscale matrix to obtain a correlation value, and judging whether the watermark information is valid information based on the correlation value.

[0087] In this embodiment, the watermark information preferably exists in the form of a specific grayscale value of a pixel. In the process of adding a QR code to the Chinese medicinal materials corresponding to the Chinese herbal medicines to be traced, the image corresponding to the QR code is obtained, and the image is converted into a grayscale image, and the grayscale value of each pixel in the grayscale image is identified. The target grayscale value whose grayscale value in each pixel is less than the preset threshold is screened, and the numerical value of each target grayscale value is converted to zero, and then the zero value is adjusted to a uniform numerical value. The size of the uniform numerical value is less than the preset threshold to distinguish it from other pixels in the grayscale image. The pattern formed by each pixel with a uniform numerical value is the watermark pattern. The watermark pattern is added to the image corresponding to the original QR code to form a QR code with watermark information. The QR code is added to the Chinese medicinal materials corresponding to the Chinese herbal medicines to be traced, and the coding operation of the Chinese medicinal materials is completed.

[0088] Furthermore, in the process of extracting watermark information from the preprocessed image, the grayscale value of each pixel in the preprocessed image is first obtained, and each grayscale value obtained is compared with a preset grayscale threshold to determine a target grayscale value that is less than the preset grayscale threshold. Then, the pixel points from which each target grayscale value originates are determined, and such pixel points are extracted as target pixel points as watermark information. The preset grayscale threshold can be set to be the same as the above preset threshold, so as to accurately extract the watermark information.

[0089] Furthermore, an image coordinate system is set for the preprocessed image, for example, the point at the upper left corner of the preprocessed image is used as the coordinate origin, and the width direction to the left and the length direction downward of the preprocessed image are used as the X coordinate axis and the Y coordinate axis respectively. Then, the coordinate points of each target pixel point forming the watermark information in the image coordinate system are identified as position coordinates. Then, according to each position coordinate, each target grayscale value is formed into a grayscale matrix. The number of rows of the grayscale matrix is ​​the maximum Y value in each position coordinate, and the number of columns of the grayscale matrix is ​​the maximum X value in each position coordinate. Each position coordinate corresponds to an element position in the grayscale matrix, and the element value of the element position is the target grayscale value of the target pixel point corresponding to each position coordinate. For the element position that does not correspond to the target grayscale value in the grayscale matrix, its element value is zero. In a specific embodiment, the maximum values ​​of the preprocessed image on the X-axis and Y-axis of the image coordinate system are both 1000, indicating that the preprocessed image has 1000*1000 pixels. Among them, the maximum X value of each target pixel in the position coordinate system of the image coordinate system is 600, and the maximum Y value is 700, so a matrix of 700 rows and 600 columns is formed. The second, 98th and 409th bits in the first row correspond to the target grayscale values. The element values ​​of the first row and the first column, the element values ​​of the first row and the 98th column and the element values ​​of the first row and the 409th column are set to their corresponding target grayscale values, and the element values ​​of other columns in the first row are set to zero, and the second to the 700th row are analogous to form a grayscale matrix.

[0090] Further, a matrix is ​​formed in advance for the watermark pattern added to the two-dimensional code image, and the formation method can be the same as the grayscale matrix method mentioned above, and the formed matrix is ​​stored in the database as a reference grayscale matrix corresponding to the watermark information. The server obtains the reference grayscale matrix from the database and aligns the reference grayscale matrix and the grayscale matrix in rows and columns. Row and column alignment is to set the number of rows and columns of the two matrices to be the same. The alignment method is to add rows to the smaller number of rows based on the larger number of rows in the two matrices, and to add columns to the smaller number of columns based on the larger number of columns in the two matrices, so that the reference grayscale matrix and the grayscale matrix have the same number of rows and columns. In addition, the element values ​​corresponding to the added number of rows and columns are zero. For example, for the grayscale matrix with 700 rows and 600 columns formed above, if the corresponding reference grayscale matrix has 690 rows and 620 columns, then based on the number of rows of the grayscale matrix, the number of rows of the reference grayscale matrix is ​​increased from 690 to 700, and the element values ​​of rows 691 to 700 are all set to zero; and, based on the number of columns of the reference grayscale matrix, the number of columns of the grayscale matrix is ​​increased from 600 to 620, and the element values ​​of rows 601 to 620 are all set to zero.

[0091] Furthermore, a correlation calculation formula is pre-set, and the correlation calculation formula is used to calculate the correlation of the reference grayscale matrix and the gambling matrix to obtain a correlation value. The correlation value is a value indicating the degree of similarity between the reference grayscale matrix and the grayscale matrix. Among them, the higher the correlation value, the higher the similarity between the two matrices, the smaller the difference between the two matrices, and the greater the possibility that the extracted watermark information is valid real information; conversely, if the correlation value is lower, it means that the similarity between the two matrices is lower, the difference between the two matrices is greater, and the possibility that the extracted watermark information is valid real information is smaller. In this way, whether the watermark information is valid information is judged by the correlation value.

[0092] The correlation calculation formula can be specifically referred to in the following formula (1).

[0093]

[0094] Among them, K represents the correlation value, u1 represents the number of rows of the reference grayscale matrix, u2 represents the number of columns of the reference grayscale matrix, E(j1, j2) represents the element value corresponding to the j1th row and j2th column in the grayscale matrix, and E0(j1, j2) represents the element value corresponding to the j1th row and j2th column in the reference grayscale matrix.

[0095] Specifically, the step of judging whether the watermark information is valid information based on the correlation value includes:

[0096] Step S241, comparing the correlation value with a preset correlation threshold to determine whether the correlation value is greater than or equal to the preset correlation threshold;

[0097] Step S242: if the correlation value is greater than or equal to a preset correlation threshold, the watermark information is determined to be valid information;

[0098] Step S243: If the correlation value is less than a preset correlation threshold, it is determined that the watermark information is not valid information.

[0099] Furthermore, in order to indicate the degree of similarity between the reference gray matrix and the gray matrix, a preset correlation threshold is set in advance based on the similarity error of the test. The calculated correlation value is compared with the preset correlation threshold to determine whether the correlation value is greater than or equal to the preset correlation threshold. If the correlation value is greater than or equal to the preset correlation threshold after comparison, it means that the difference between the reference gray matrix and the gray matrix is ​​small, so the watermark information is determined to be true and valid information. On the contrary, if the correlation value is less than the preset correlation threshold after comparison, it means that the difference between the reference gray matrix and the gray matrix is ​​large, so the watermark information is determined to be not true and valid information.

[0100] In this embodiment, the watermark information extracted from the preprocessed image is generated as a grayscale matrix based on the position coordinates of the pixel points, and the grayscale matrix is ​​correlated with the reference grayscale matrix representing the real watermark information, and the correlation value obtained by the correlation calculation of the two matrices is used to determine the authenticity and validity of the watermark information extracted from the preprocessed image. Since the grayscale matrix generated by the position coordinates of the pixel points has a smaller granularity, it can accurately reflect the watermark information, thereby making the calculated correlation value more accurate, thereby improving the accuracy of the watermark information validity judgment.

[0101] For further information, please refer to Figure 3 Based on the first and second embodiments of the whole industry chain traceability method for Chinese herbal medicine pieces of the present invention, a third embodiment of the whole industry chain traceability method for Chinese herbal medicine pieces of the present invention is proposed.

[0102] The third embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces is different from the first and second embodiments of the whole industry chain traceability method of Chinese herbal medicine pieces in that the step of searching for traceability data corresponding to the traceability two-dimensional code image includes:

[0103] Step S50, obtaining environmental data monitored at preset intervals during the planting process of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, and generating pollutant concentration parameters of the preset period based on the environmental data;

[0104] Step S60, obtaining fertilization data, irrigation data, and pest control data of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced during the planting process;

[0105] Step S70, generating the planting data from the environmental data and pollutant concentration parameters corresponding to each of the preset periods, as well as the fertilization data, irrigation data and pest control data.

[0106] Understandably, the environmental factors in the process of planting the Chinese medicinal materials corresponding to the Chinese medicinal slices will affect the performance of the Chinese medicinal slices. For example, the presence of substances that pollute the air or water in the planting environment may remain in the Chinese medicinal materials and affect the performance of the Chinese medicinal slices. To this end, this embodiment is provided with a mechanism for monitoring and recording environmental data during the planting of Chinese medicinal materials, so as to facilitate subsequent tracing to determine whether the Chinese medicinal slices carry certain pollutants or pesticide and fertilizer residues.

[0107] Specifically, for the Chinese medicinal materials corresponding to the Chinese herbal medicines to be traced, a preset cycle is pre-set during the planting process, and multiple monitoring points are set in the planting environment, and multiple monitoring instruments are set at each monitoring point. The environmental data of the environment where the Chinese medicinal materials are located is monitored by each monitoring instrument at intervals of the preset cycle, and the monitored environmental data is transmitted to the server. After obtaining the environmental data, the server analyzes whether it contains pollutants, as well as the types and concentrations of the pollutants contained, and obtains the pollutant concentration parameter. The pollutant concentration parameter represents the pollution situation of the planting environment where the Chinese medicinal materials are located during the preset cycle. Among them, the environmental data monitored in each preset cycle and the corresponding pollutant concentration parameters generated are uploaded to the server, and added to the database storage by the server.

[0108] Understandably, the Chinese medicinal materials corresponding to the Chinese herbal medicines to be traced usually need to be fertilized and irrigated during the planting process, and the fertilization data of each fertilization and the irrigation data of each irrigation are recorded. The fertilization data at least includes the fertilization time, fertilization type, fertilization amount and fertilization operator. The irrigation data at least includes the irrigation time, irrigation water source, irrigation amount and irrigation personnel. At the same time, Chinese medicinal materials may be diseased and pests during the planting process, and prevention and control are required, and the data for the disease and pest control are recorded. The recorded disease and pest control data at least includes the time of disease and pest, the type and amount of medicine used for prevention and control, and the operator of prevention and control. Each recorded data is uploaded to the server and added to the database storage by the server. When the Chinese medicinal materials reach the time of harvesting, the environmental data monitored in each preset period during the planting stage of the Chinese medicinal materials and the corresponding pollutant concentration parameters, as well as the fertilization data, irrigation data and disease and pest control data of each time are jointly formed as planting data.

[0109] Furthermore, the step of generating the pollutant concentration parameter of the preset period based on the environmental data includes:

[0110] Step S61, obtaining the planting base information of the Chinese medicinal material corresponding to the Chinese medicinal piece to be traced, wherein the planting base information includes the base area and the monitoring location information of each monitoring point in the planting base;

[0111] Step S62, generating a monitoring area according to each monitoring position information;

[0112] Step S63, calculating the monitoring area, the base area, the pollutant monitoring concentration and the monitoring wind speed of each monitoring point in the environmental data according to a preset calculation formula to generate the pollutant concentration parameter.

[0113] Furthermore, the planting base of the Chinese medicinal material corresponding to the Chinese medicinal material to be traced is determined, and the information of the planting base is obtained. The obtained planting base information includes at least the base area, the number of monitoring points set in the planting base, and the monitoring position information of each monitoring point in the planting base. Among them, the monitoring position information can be determined by establishing a coordinate system for the planting base, taking a vertex of the planting base as the coordinate origin, taking the two sides of the ground where the planting base passes through the origin and are perpendicular to each other as the X-axis and Y-axis, and taking the direction perpendicular to the ground as the Z-axis to establish a three-dimensional coordinate system, and the positive direction of the X-axis and the Y-axis is preferably the boundary line of the planting base or preferably across the inside of the planting base when the planting base is an irregular rectangle, and the positive direction of the Z-axis is the direction away from the planting base, that is, pointing to the sky. Each monitoring point can be evenly divided and set according to the area of ​​the planting base, for example, the planting base is divided according to the nine-square grid, and each intersection in the nine-square grid is selected as a monitoring point. Alternatively, the monitoring point is set according to a certain image, for example, the circumscribed circle of the planting base and the largest five-pointed star in the circumscribed circle are determined, and the intersection of two lines in the five-pointed star is selected as the monitoring point. By determining the position coordinates of each monitoring point in the coordinate system as the detection position information, and then generating the monitoring area based on each monitoring position information, the adjacent position coordinates can be connected as straight lines in the coordinate system, and the area of ​​the geometric figure formed by the straight lines can be calculated to obtain the monitoring area.

[0114] Furthermore, a preset calculation formula is pre-set, and the monitoring area, base area, and pollutant monitoring concentration and monitoring wind speed of each monitoring point in the environmental data are calculated by the preset calculation formula to obtain the calculation result as the pollutant concentration parameter, wherein the preset calculation formula can be specifically referred to as the following formula (2).

[0115]

[0116] Among them, P represents the pollutant concentration parameter, A0 represents the base area, Ai represents the monitoring area, n1 represents the number of monitoring points, n2 represents the number of pollutant types contained in the environmental data, αt represents the weight value corresponding to the t-th pollutant, Qit represents the pollutant monitoring concentration of the t-th pollutant monitored by the ith monitoring point, Ui represents the monitoring wind speed of the ith monitoring point, αi represents the horizontal diffusion parameter corresponding to the monitoring wind speed Ui, βi represents the vertical diffusion parameter corresponding to the monitoring wind speed Ui, Yi represents the Y-axis coordinate value of the ith monitoring point in the coordinate system corresponding to the planting base, Zi represents the Z-axis coordinate value of the ith monitoring point in the coordinate system corresponding to the planting base, and the coordinate system corresponding to the planting base is a three-dimensional coordinate system with the ground where the planting base is located as the XOY plane and the direction perpendicular to the ground as the Z axis.

[0117] Understandably, the types of pollutants monitored at different monitoring points in the planting base may be different, and even the same types may have different concentrations. At the same time, different monitoring points usually have different wind speeds, and different wind speeds cause different diffusion speeds of pollutants. Chinese medicinal materials are usually generated in the vertical direction, so each wind speed is divided into horizontal direction and vertical direction to reflect the degree to which different monitoring points are affected by wind speed at the same horizontal plane, and the degree to which Chinese medicinal materials at the same monitoring point are affected by wind speed at different heights. In addition, for the horizontal plane, the X-axis coordinate value can be used to represent the position of different monitoring points in the horizontal plane, and the Y-axis coordinate value can also be used to represent the position of different monitoring points in the horizontal plane. In this embodiment, the Y-axis coordinate value is preferably used.

[0118] Furthermore, the diffusion speeds corresponding to different wind speeds in the horizontal direction and the diffusion speeds corresponding to different wind speeds in the vertical direction are tested in advance, and the horizontal diffusion parameters representing the diffusion speeds of different wind speeds in the horizontal direction and the vertical diffusion parameters representing the diffusion speeds in the vertical direction are set according to the test. For the current preset period, by searching the monitored wind speeds and their corresponding horizontal diffusion parameters and vertical diffusion parameters of each monitoring point in the environmental data, and combining the types and concentrations of pollutants monitored at each monitoring point to calculate the pollutant concentration parameters, the calculated pollutant concentration parameters more accurately reflect the overall impact of various pollutants on the Chinese medicinal materials in the planting base. At the same time, the weight values ​​corresponding to each pollutant are pre-set in combination with the different degrees of influence of different pollutant concentrations on Chinese medicinal materials. In the process of calculating the pollutant concentration parameters, the corresponding weight values ​​of different types of pollutants monitored at each monitoring point are searched and calculated, which further improves the accuracy of the calculation of the pollutant concentration parameters, that is, the pollutant concentration parameters more accurately reflect the degree of influence of environmental factors on the Chinese medicinal materials corresponding to the Chinese medicinal materials to be traced during the planting process.

[0119] This embodiment regularly records the environmental data of the Chinese medicinal materials corresponding to the Chinese medicinal materials to be traced, as well as the fertilization data, irrigation data and pest and disease control data of each time, and generates pollutant environmental concentration parameters representing the degree of environmental pollution of the planting base based on the environmental data. The Chinese medicinal materials to be traced can then be traced based on the data, making the traceability data more comprehensive and accurate.

[0120] For further information, please refer to Figure 4 Based on the first, second and third embodiments of the whole industry chain traceability method of Chinese herbal medicine pieces of the present invention, a fourth embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces of the present invention is proposed.

[0121] The fourth embodiment of the whole industry chain traceability method of Chinese herbal medicine pieces is different from the first, second and third embodiments of the whole industry chain traceability method of Chinese herbal medicine pieces in that the step of searching for traceability data corresponding to the traceability two-dimensional code image includes:

[0122] Step S80, arranging each first data element in the planting data based on the formation time of each first data element to form a planting data sequence;

[0123] Step S90, arranging each second data element in the collected and processed data based on the formation time of each second data element to form a collected and processed data sequence;

[0124] Step S100, based on the formation time of each third data element in the logistics warehousing data, arranging each third data element to form a logistics warehousing data sequence;

[0125] Step S110, arranging each fourth data element in the circulation data based on the formation time of each fourth data element to form a circulation data sequence;

[0126] Step S120, generating an encryption key based on the planting data sequence, harvesting and processing data sequence, logistics and warehousing data sequence and circulation data sequence, and encrypting and storing the planting data, harvesting and processing data, logistics and warehousing data and circulation data based on the encryption key.

[0127] Furthermore, in order to ensure the security of traceability data such as planting data, processing data, logistics warehousing data and circulation data stored in the database, this embodiment is provided with a mechanism for encrypting each data and transmitting it to the database for storage. Specifically, each data contained in the planting data is taken as its first data element, and each first data element is arranged according to the formation time of each first data element to form a planting data sequence. As mentioned above, the data contained in the planting data includes environmental data monitored at each preset period, and fertilization data, irrigation data and pest control data generated each time fertilization, irrigation, pest control and other operations are performed. Therefore, each data, that is, the first data element, can be arranged in the order of the time corresponding to this type of data to obtain a planting data sequence.

[0128] Furthermore, the various data contained in the collected and processed data, namely the collected data, the processed data and the quality inspection data, are taken as the second data elements, and the second data elements are arranged according to the formation time of the collected data, the processed data and the quality inspection data, to obtain the collected and processed data sequence. For the logistics and warehousing data, the logistics and transportation data and the storage data contained therein are taken as the third data elements, and the third data elements are arranged according to the formation time of the logistics and transportation data and the storage data, to form the physical warehousing data sequence. For the circulation data, the transaction data and the market sampling data contained therein are also taken as the fourth data elements, and the fourth data elements are arranged according to the formation time of the transaction data and the market sampling data, to form the circulation data sequence.

[0129] Furthermore, an encryption key is generated based on the planting data sequence, the harvesting and processing data sequence, the logistics and warehousing data sequence, and the circulation data sequence, and then the planting data, the harvesting and processing data, the logistics and warehousing data, and the circulation data are encrypted based on the encryption key and transmitted to the database for storage. The step of generating an encryption key based on the planting data sequence, the harvesting and processing data sequence, the logistics and warehousing data sequence, and the circulation data sequence includes:

[0130] Step S131, respectively obtaining the first data quantity and the first median sequence number of the planting data sequence, the second data quantity and the second median sequence number of the harvesting and processing data sequence, the third data quantity and the third median sequence number of the logistics and warehousing data sequence, and the fourth data quantity and the fourth median sequence number of the circulation data sequence;

[0131] Step S132, performing a mean operation on the first data quantity, the second data quantity, the third data quantity and the fourth data quantity to generate a data quantity parameter;

[0132] Step S133, based on a preset formula group, the first data quantity, the first median sequence number, the second data quantity, the second median sequence number, the third data quantity, the third median sequence number, the fourth data quantity, the fourth median sequence number and the data quantity parameter are calculated to generate an encryption key.

[0133] Furthermore, for the planting data sequence, the harvesting and processing data sequence, the logistics and warehousing data sequence, and the circulation data sequence, the amount of data contained in each is counted to form the first data quantity, the second data quantity, the third data quantity, and the fourth data quantity. At the same time, the sequence numbers of the data located in the middle position of the planting data sequence, the harvesting and processing data sequence, the logistics and warehousing data sequence, and the circulation data sequence are searched as the first median sequence number, the second median sequence number, the third median sequence number, and the fourth median sequence number. Among them, for a sequence with an odd number of data, the sequence number of the data located in the middle position can be directly obtained; and for a sequence with an even number of data, after finding the two data located in the middle position, the sequence number of the data in the previous position is used as the sequence number of the data in the middle position. For example, if the planting data sequence and the processing data sequence both contain 5 data amounts, then the sequence number of the third data in the two, that is, the value 3, is determined as the first median sequence number and the second median sequence number; if the logistics warehousing data sequence and the circulation data sequence contain 6 data amounts and 8 data amounts respectively, then the sequence number of the third data in the logistics warehousing data sequence, that is, the value 3, is determined as the third median sequence number, and the sequence number of the fourth data in the circulation data sequence, that is, the value 4, is determined as the fourth median sequence number.

[0134] Furthermore, the first data quantity, the second data quantity, the third data quantity and the fourth data quantity are averaged, and the averaged result is obtained as the data quantity parameter. In addition, a preset formula group for calculating the encryption key is pre-set, and the first data quantity, the first median sequence number, the second data quantity, the second median sequence number, the third data quantity, the third median sequence number, the fourth data quantity, the fourth median sequence number and the data quantity parameter are calculated by the preset formula group, and the calculation result obtained is the encryption key. The preset formula group can be specifically referred to as the following formula (3).

[0135]

[0136] Among them, T1 represents the first parameter, m represents the data quantity parameter, W1 represents the first data quantity, S1 represents the first median sequence number, T2 represents the second parameter, W2 represents the second data quantity, S2 represents the second median sequence number, T3 represents the third parameter, W3 represents the third data quantity, S3 represents the third median sequence number, T4 represents the fourth parameter, W4 represents the fourth data quantity, S4 represents the fourth median sequence number, and F represents the encryption key.

[0137] The first parameter is obtained by calculating the first data quantity, the first median sequence number and the data quantity parameter; the second parameter is calculated by combining the first parameter with the second data quantity, the second median sequence number and the data quantity parameter to obtain the second parameter; the third parameter is calculated by combining the second parameter with the third data quantity, the third median sequence number and the data quantity parameter to obtain the third parameter; and the fourth parameter is calculated by combining the third parameter with the fourth data quantity, the fourth median sequence number and the data quantity parameter to obtain the fourth parameter. The encryption key is generated by the mean operation of the first parameter, the second parameter, the third parameter and the fourth parameter. In this way, the generated encryption key is highly correlated with the amount of data contained in the planting data sequence, the harvesting and processing data sequence, the logistics and warehousing data sequence and the circulation data sequence and the sequence number of the data in the middle position. If any of the data is wrong, the correct encryption key cannot be generated. The encryption key has higher security, making the encrypted and stored planting data, processing data, logistics and warehousing data and circulation data safer.

[0138] It should be noted that for the planting data, harvesting and processing data, logistics and warehousing data, and circulation data encrypted and stored in this embodiment, after the watermark information carried by the pre-processed image is determined to be valid information, the traceability data corresponding to the traceability two-dimensional code image found in the above embodiment 1, that is, the planting data, harvesting and processing data, logistics and warehousing data, and circulation data are encrypted data. At this time, the traceability data found needs to be decrypted according to the inverse operation of the encryption in this embodiment. Then, the decrypted traceability data is transmitted to the scanning terminal for display, completing the traceability of the entire industry chain of the Chinese herbal medicine to be traced.

[0139] In addition, the embodiment of the present invention also provides a whole industry chain traceability system for Chinese herbal medicine pieces. Figure 5 , Figure 5 It is a structural schematic diagram of the equipment hardware operating environment involved in the embodiment scheme of the whole industry chain traceability system of Chinese herbal medicine pieces of the present invention.

[0140] like Figure 5 As shown, the whole industry chain traceability system of the Chinese herbal medicine slices may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0141] Those skilled in the art will understand that Figure 5 The hardware structure of the whole industry chain traceability system for Chinese herbal medicines shown in the figure does not constitute a limitation of the whole industry chain traceability system for Chinese herbal medicines, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0142] like Figure 5 As shown, the memory 1005 as a medium may include an operating system, a network communication module, a user interface module and a control program. The operating system is a program for managing and controlling the traceability system and software resources of the entire industry chain of Chinese herbal medicine pieces, and supports the operation of the network communication module, the user interface module, the control program and other programs or software; the network communication module is used to manage and control the network interface 1004; the user interface module is used to manage and control the user interface 1003.

[0143] exist Figure 5 In the hardware structure of the whole industry chain traceability system of Chinese herbal medicine pieces shown in the figure, the network interface 1004 is mainly used to connect to the system server and communicate data with the system server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; the processor 1001 can call the control program stored in the memory 1005 and perform the following operations:

[0144] Obtaining a traceability two-dimensional code image corresponding to the Chinese herbal medicine to be traced based on a scanning terminal, and preprocessing the traceability two-dimensional code image to obtain a preprocessed image;

[0145] Extracting watermark information carried by the preprocessed image, and determining whether the watermark information is valid information;

[0146] If the watermark information is valid information, then searching for traceability data corresponding to the traceability two-dimensional code image, wherein the traceability data at least includes planting data, harvesting and processing data, logistics and warehousing data, and circulation data, and the planting data includes environmental data;

[0147] The traceability data is transmitted to the scanning terminal for display, completing the traceability of the entire industrial chain of the Chinese herbal medicine to be traced.

[0148] Furthermore, the step of extracting the watermark information carried by the preprocessed image and determining whether the watermark information is valid information includes:

[0149] Obtaining the grayscale value of each pixel in the preprocessed image, and searching for a target grayscale value that is less than a preset grayscale threshold among the grayscale values, and extracting the target pixel corresponding to each target grayscale value as the watermark information;

[0150] Determine the position coordinates of each target pixel point in the image coordinate system corresponding to the preprocessed image, and form each target grayscale value into a grayscale matrix according to each position coordinate;

[0151] Acquire a reference grayscale matrix corresponding to the watermark information, and align the reference grayscale matrix with the grayscale matrix in rows and columns;

[0152] Calculating the correlation between the reference grayscale matrix and the grayscale matrix to obtain a correlation value, and judging whether the watermark information is valid information based on the correlation value;

[0153] The formula for calculating the correlation is:

[0154]

[0155] Among them, K represents the correlation value, u1 represents the number of rows of the reference grayscale matrix, u2 represents the number of columns of the reference grayscale matrix, E(j1, j2) represents the element value corresponding to the j1th row and j2th column in the grayscale matrix, and E0(j1, j2) represents the element value corresponding to the j1th row and j2th column in the reference grayscale matrix.

[0156] Further, the step of judging whether the watermark information is valid information based on the correlation value includes:

[0157] Comparing the correlation value with a preset correlation threshold to determine whether the correlation value is greater than or equal to the preset correlation threshold;

[0158] If the correlation value is greater than or equal to a preset correlation threshold, the watermark information is determined to be valid information;

[0159] If the correlation value is less than a preset correlation threshold, it is determined that the watermark information is not valid information.

[0160] Furthermore, before the step of searching for the traceability data corresponding to the traceability two-dimensional code image, the processor 1001 may call the control program stored in the memory 1005 and perform the following operations:

[0161] Obtaining environmental data monitored at preset intervals during the planting process of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, and generating pollutant concentration parameters of the preset period based on the environmental data;

[0162] Obtaining the fertilization data, irrigation data, and pest and disease control data of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced during the planting process;

[0163] The environmental data and pollutant concentration parameters corresponding to each of the preset periods, as well as the fertilization data, irrigation data and pest control data are generated as the planting data.

[0164] Furthermore, the step of generating the pollutant concentration parameter of the preset period based on the environmental data includes:

[0165] Obtaining the planting base information of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, wherein the planting base information includes the base area and the monitoring location information of each monitoring point in the planting base;

[0166] generating a monitoring area according to each of the monitoring location information;

[0167] According to a preset calculation formula, the monitoring area, the base area, the pollutant monitoring concentration and the monitoring wind speed of each monitoring point in the environmental data are calculated to generate the pollutant concentration parameter;

[0168] The preset calculation formula is:

[0169]

[0170] Among them, P represents the pollutant concentration parameter, A0 represents the base area, Ai represents the monitoring area, n1 represents the number of monitoring points, n2 represents the number of pollutant types contained in the environmental data, αt represents the weight value corresponding to the t-th pollutant, Qit represents the pollutant monitoring concentration of the t-th pollutant monitored by the ith monitoring point, Ui represents the monitoring wind speed of the ith monitoring point, αi represents the horizontal diffusion parameter corresponding to the monitoring wind speed Ui, βi represents the vertical diffusion parameter corresponding to the monitoring wind speed Ui, Yi represents the Y-axis coordinate value of the ith monitoring point in the coordinate system corresponding to the planting base, Zi represents the Z-axis coordinate value of the ith monitoring point in the coordinate system corresponding to the planting base, and the coordinate system corresponding to the planting base is a three-dimensional coordinate system with the ground where the planting base is located as the XOY plane and the direction perpendicular to the ground as the Z axis.

[0171] Furthermore, before the step of searching for the traceability data corresponding to the traceability two-dimensional code image, the processor 1001 may call the control program stored in the memory 1005 and perform the following operations:

[0172] Arranging each first data element in the planting data based on the formation time of each first data element to form a planting data sequence;

[0173] Arranging each of the second data elements in the collected and processed data based on the formation time of each of the second data elements to form a collected and processed data sequence;

[0174] Arranging each of the third data elements in the logistics warehousing data based on the formation time of each of the third data elements to form a logistics warehousing data sequence;

[0175] Arranging each of the fourth data elements in the circulation data based on the formation time of each of the fourth data elements to form a circulation data sequence;

[0176] An encryption key is generated based on the planting data sequence, harvesting and processing data sequence, logistics and warehousing data sequence, and circulation data sequence, and the planting data, harvesting and processing data, logistics and warehousing data, and circulation data are encrypted and stored based on the encryption key.

[0177] Furthermore, the step of generating an encryption key based on the planting data sequence, the harvesting and processing data sequence, the logistics and warehousing data sequence, and the circulation data sequence includes:

[0178] Respectively obtain the first data quantity and the first median sequence number of the planting data sequence, the second data quantity and the second median sequence number of the harvesting and processing data sequence, the third data quantity and the third median sequence number of the logistics and warehousing data sequence, and the fourth data quantity and the fourth median sequence number of the circulation data sequence;

[0179] Performing a mean operation on the first data quantity, the second data quantity, the third data quantity, and the fourth data quantity to generate a data quantity parameter;

[0180] Calculating the first data quantity, the first median sequence number, the second data quantity, the second median sequence number, the third data quantity, the third median sequence number, the fourth data quantity, the fourth median sequence number and the data quantity parameter based on a preset formula group to generate an encryption key;

[0181] The preset formula group is:

[0182]

[0183] Among them, T1 represents the first parameter, m represents the data quantity parameter, W1 represents the first data quantity, S1 represents the first median sequence number, T2 represents the second parameter, W2 represents the second data quantity, S2 represents the second median sequence number, T3 represents the third parameter, W3 represents the third data quantity, S3 represents the third median sequence number, T4 represents the fourth parameter, W4 represents the fourth data quantity, S4 represents the fourth median sequence number, and F represents the encryption key.

[0184] Furthermore, before the step of searching for the traceability data corresponding to the traceability two-dimensional code image, the processor 1001 may call the control program stored in the memory 1005 and perform the following operations:

[0185] Receiving the collection data, processing data and quality inspection data of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, and generating the collection data, processing data and quality inspection data into collection and processing data;

[0186] Receiving logistics transportation data and storage data corresponding to the Chinese herbal medicine pieces to be traced, and generating the logistics transportation data and storage data into logistics warehousing data;

[0187] Receive the transaction data and market sampling data corresponding to the Chinese herbal medicine pieces to be traced, and generate the transaction data and market sampling data into circulation data.

[0188] The specific implementation methods of the whole industry chain traceability system of the Chinese herbal medicine pieces of the present invention are basically the same as the embodiments of the whole industry chain traceability method of the Chinese herbal medicine pieces mentioned above, and will not be repeated here.

[0189] The embodiment of the present invention further provides a medium. The medium is a readable storage medium, on which a control program is stored, and when the control program is executed by a processor, the steps of the whole industry chain traceability method of Chinese herbal medicine slices are implemented.

[0190] The storage medium of the present invention may be a computer-readable storage medium, and its implementation method is basically the same as the embodiments of the above-mentioned method for tracing the source of the entire industrial chain of Chinese herbal medicines, and will not be repeated here.

[0191] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are protected by the present invention.

Claims

1. A method for tracing the source of Chinese herbal medicines in the entire industry chain, characterized in that: The whole industry chain traceability method includes: Obtaining a traceability two-dimensional code image corresponding to the Chinese herbal medicine to be traced based on a scanning terminal, and preprocessing the traceability two-dimensional code image to obtain a preprocessed image; Extracting watermark information carried by the preprocessed image, and determining whether the watermark information is valid information; If the watermark information is valid information, then searching for traceability data corresponding to the traceability two-dimensional code image, wherein the traceability data at least includes planting data, harvesting and processing data, logistics and warehousing data, and circulation data, and the planting data includes environmental data; The traceability data is transmitted to the scanning terminal for display, completing the traceability of the entire industrial chain of the Chinese herbal medicine to be traced.

2. The whole industry chain traceability method according to claim 1, characterized in that: The step of extracting the watermark information carried by the pre-processed image and determining whether the watermark information is valid information comprises: Obtaining the grayscale value of each pixel in the preprocessed image, and searching for a target grayscale value that is less than a preset grayscale threshold among the grayscale values, and extracting the target pixel corresponding to each target grayscale value as the watermark information; Determine the position coordinates of each target pixel point in the image coordinate system corresponding to the preprocessed image, and form each target grayscale value into a grayscale matrix according to each position coordinate; Acquire a reference grayscale matrix corresponding to the watermark information, and align the reference grayscale matrix with the grayscale matrix in rows and columns; Calculating the correlation between the reference grayscale matrix and the grayscale matrix to obtain a correlation value, and judging whether the watermark information is valid information based on the correlation value; The formula for calculating the correlation is: Among them, K represents the correlation value, u1 represents the number of rows of the reference grayscale matrix, u2 represents the number of columns of the reference grayscale matrix, E(j1, j2) represents the element value corresponding to the j1th row and j2th column in the grayscale matrix, and E0(j1, j2) represents the element value corresponding to the j1th row and j2th column in the reference grayscale matrix.

3. The whole industry chain traceability method according to claim 2, characterized in that: The step of judging whether the watermark information is valid information based on the correlation value comprises: Comparing the correlation value with a preset correlation threshold to determine whether the correlation value is greater than or equal to the preset correlation threshold; If the correlation value is greater than or equal to a preset correlation threshold, the watermark information is determined to be valid information; If the correlation value is less than a preset correlation threshold, it is determined that the watermark information is not valid information.

4. The whole industry chain traceability method according to claim 1, characterized in that: The step of searching for the traceability data corresponding to the traceability two-dimensional code image includes: Obtaining environmental data monitored at preset intervals during the planting process of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, and generating pollutant concentration parameters of the preset period based on the environmental data; Obtaining the fertilization data, irrigation data, and pest and disease control data of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced during the planting process; The environmental data and pollutant concentration parameters corresponding to each of the preset periods, as well as the fertilization data, irrigation data and pest control data are generated as the planting data.

5. The whole industry chain traceability method according to claim 4, characterized in that: The step of generating the pollutant concentration parameter of the preset period based on the environmental data comprises: Obtaining the planting base information of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, wherein the planting base information includes the base area and the monitoring location information of each monitoring point in the planting base; generating a monitoring area according to each of the monitoring location information; According to a preset calculation formula, the monitoring area, the base area, the pollutant monitoring concentration and the monitoring wind speed of each monitoring point in the environmental data are calculated to generate the pollutant concentration parameter; The preset calculation formula is: Among them, P represents the pollutant concentration parameter, A0 represents the base area, Ai represents the monitoring area, n1 represents the number of monitoring points, n2 represents the number of pollutant types contained in the environmental data, αt represents the weight value corresponding to the t-th pollutant, Qit represents the pollutant monitoring concentration of the t-th pollutant monitored by the ith monitoring point, Ui represents the monitoring wind speed of the ith monitoring point, αi represents the horizontal diffusion parameter corresponding to the monitoring wind speed Ui, βi represents the vertical diffusion parameter corresponding to the monitoring wind speed Ui, Yi represents the Y-axis coordinate value of the ith monitoring point in the coordinate system corresponding to the planting base, Zi represents the Z-axis coordinate value of the ith monitoring point in the coordinate system corresponding to the planting base, and the coordinate system corresponding to the planting base is a three-dimensional coordinate system with the ground where the planting base is located as the XOY plane and the direction perpendicular to the ground as the Z axis.

6. The whole industry chain traceability method according to any one of claims 1 to 5, characterized in that: The step of searching for the traceability data corresponding to the traceability two-dimensional code image includes: Arranging each first data element in the planting data based on the formation time of each first data element to form a planting data sequence; Arranging each of the second data elements in the harvested and processed data based on the formation time of each of the second data elements to form a harvested and processed data sequence; Based on the formation time of each third data element in the logistics warehousing data, the third data elements are arranged to form a logistics warehousing data sequence; Arranging each of the fourth data elements in the circulation data based on the formation time of each of the fourth data elements to form a circulation data sequence; An encryption key is generated based on the planting data sequence, harvesting and processing data sequence, logistics and warehousing data sequence, and circulation data sequence, and the planting data, harvesting and processing data, logistics and warehousing data, and circulation data are encrypted and stored based on the encryption key.

7. The whole industry chain traceability method according to claim 6, characterized in that: The step of generating an encryption key based on the planting data sequence, the harvesting and processing data sequence, the logistics and warehousing data sequence, and the circulation data sequence comprises: Respectively obtain the first data quantity and the first median sequence number of the planting data sequence, the second data quantity and the second median sequence number of the harvesting and processing data sequence, the third data quantity and the third median sequence number of the logistics and warehousing data sequence, and the fourth data quantity and the fourth median sequence number of the circulation data sequence; Performing a mean operation on the first data quantity, the second data quantity, the third data quantity, and the fourth data quantity to generate a data quantity parameter; Calculating the first data quantity, the first median sequence number, the second data quantity, the second median sequence number, the third data quantity, the third median sequence number, the fourth data quantity, the fourth median sequence number and the data quantity parameter based on a preset formula group to generate an encryption key; The preset formula group is: Among them, T1 represents the first parameter, m represents the data quantity parameter, W1 represents the first data quantity, S1 represents the first median sequence number, T2 represents the second parameter, W2 represents the second data quantity, S2 represents the second median sequence number, T3 represents the third parameter, W3 represents the third data quantity, S3 represents the third median sequence number, T4 represents the fourth parameter, W4 represents the fourth data quantity, S4 represents the fourth median sequence number, and F represents the encryption key.

8. The whole industry chain traceability method according to any one of claims 1 to 5, characterized in that: The step of searching for the traceability data corresponding to the traceability two-dimensional code image includes: Receiving the collection data, processing data and quality inspection data of the Chinese medicinal materials corresponding to the Chinese medicinal pieces to be traced, and generating the collection data, processing data and quality inspection data into collection and processing data; Receiving logistics transportation data and storage data corresponding to the Chinese herbal medicine pieces to be traced, and generating the logistics transportation data and storage data into logistics warehousing data; Receive the transaction data and market sampling data corresponding to the Chinese herbal medicine pieces to be traced, and generate the transaction data and market sampling data into circulation data.

9. A whole industry chain traceability system for Chinese herbal medicine pieces, characterized in that: The whole industry chain traceability system of Chinese herbal medicine pieces includes a memory, a processor, a communication bus and a control program stored in the memory: The communication bus is used to realize the connection and communication between the processor and the memory; The processor is used to execute the control program to implement the steps of the whole industry chain traceability method of Chinese herbal medicine pieces as described in any one of claims 1-8.

10. A medium, characterized in that The medium is a readable storage medium having a control program stored thereon. When the control program is executed by a processor, the steps of the whole-industry chain traceability method for Chinese herbal medicine pieces as described in any one of claims 1 to 8 are implemented.

Citation Information

Cited By

  • Traditional Chinese medicine traceability management method and system

    CN120765119A

  • Traditional Chinese medicine decoction piece full life cycle data management system and method

    CN120996834A