Medicine information checking method and system
By projecting binary random structured light patterns using digital micromirror devices and reconstructing reflectivity images using compressed sensing algorithms, the problem of OCR recognition failure or misjudgment caused by specular reflection fonts was solved, thus achieving reliability and accuracy in drug information verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-03-13
AI Technical Summary
Existing technologies are prone to OCR recognition failure or misjudgment when recognizing mirror-reflected fonts on medicine boxes because the competition between mirror-reflected light and diffused light can lead to image overexposure, loss of character features, or blurred edges.
A binary random structured light pattern is projected using a digital micromirror device, and a reflectivity image is reconstructed using a compressed sensing algorithm. Drug information is then verified using algorithms such as hash value comparison to eliminate interference from illumination angle and specular reflection.
Ensure the integrity and clarity of mirror-reflected font information, stably capture character features, improve the reliability and accuracy of drug information verification, and avoid recognition failure or misjudgment.
Smart Images

Figure CN121661655A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and optical detection technology, and in particular to a method and system for verifying drug information. Background Technology
[0002] In the pharmaceutical production and packaging process, visually verifying key information on medicine boxes, such as batch numbers and expiration dates, is a crucial step in ensuring medication safety. This information must be accurate to meet regulatory standards and patients' right to know. Currently, the mainstream method uses industrial cameras to capture images of medicine boxes and then performs OCR technology for recognition, which is more efficient than manual inspection.
[0003] Currently, when using OCR technology to identify key information on medicine boxes, for specular reflective fonts, such as gold or silver foil fonts with strong specular reflectivity, the intensity of reflected light is highly dependent on the viewing angle and illumination angle. Traditional fixed-light imaging methods are prone to overexposure of local images due to excessive reflection, resulting in the loss of character features and causing OCR recognition failure or misjudgment. Alternatively, multi-angle illumination can be used to select the best image or perform image fusion, but this method is essentially still a passive imaging method. When specular reflected light and diffuse reflected light compete on the same imaging plane, the difference in light intensity between the two can still cause blurring of character edges or excessive background noise in the fused image, leading to OCR recognition failure or misjudgment. Summary of the Invention
[0004] To address the technical problems existing in the background art, this invention proposes a drug information verification method and system, which abandons the traditional passive approach of imaging first and then processing, and reconstructs character information by acquiring the reflectivity image of the object surface, thereby completely immunizing against specular reflection interference.
[0005] The present invention proposes a drug information verification method, comprising the following steps: S1. Using a digital micromirror device, construct a mapping between each micromirror in the digital micromirror device and the area to be detected; S2. Using a digital micromirror device, the light beam emitted by the light source is modulated into a series of binary random structured light patterns, and the series of binary random structured light patterns are pre-stored; according to the mapping between each micromirror in the digital micromirror device and the area to be detected, a measurement matrix Φ corresponding to the series of binary random structured light patterns is generated. S3. Using a digital micromirror device, a series of pre-stored binary random structured light patterns are sequentially projected onto the detection area of the medicine box to be tested; when each pattern in the series of binary random structured light patterns is projected, a single photodetector is used to synchronously measure the total light intensity value reflected back from the detection area, forming a set of total light intensity measurement values, and a set of total light intensity measurement values corresponds one-to-one with a series of binary random structured light patterns. S4. Based on a set of total light intensity measurements and the measurement matrix Φ, the reflectance image of the area to be detected is obtained by executing a compressed sensing reconstruction algorithm; S5. Perform character recognition on the reflectance image, compare the recognition results with the pre-stored drug information, and output the verification results.
[0006] As an explanation, the identification results can be compared with the pre-stored drug information using hash value comparison algorithms, edit distance algorithms, and regular expression matching algorithms.
[0007] Preferably, in S1, the mapping between each micromirror in the digital micromirror device and the region to be detected is constructed as follows: S11. Place a standard checkerboard calibration plate on the plane of the area to be tested of the medicine box; The physical dimensions of each square in the standard checkerboard calibration board are known values R. The physical coordinates of the corner points in the standard checkerboard calibration board are obtained based on the known values R. As an explanation, a corner point refers to the internal intersection point formed by the intersection of black and white squares on a standard chessboard calibration board; S12. Control the digital micromirror device to project a series of specific calibration patterns in sequence. The specific calibration patterns are several micromirrors that are opened individually at different positions. S13. Each time a specific calibration pattern is projected, an image of the standard checkerboard calibration plate is acquired by the calibration camera to obtain the calibration image; the optical axis of the calibration camera is parallel to the optical path of the single photodetector; the internal parameters of the calibration camera have been pre-calibrated. S14. For the calibration image, obtain the pixel coordinates of all corner points in the standard checkerboard calibration board through image recognition, and form a set of pixel coordinates. A set of physical coordinates is formed based on the physical coordinates of all corner points in the standard checkerboard calibration board; Based on the set of pixel coordinates and the set of physical coordinates, the pose of the calibration camera relative to the standard checkerboard calibration board is obtained by solving the PnP problem. The pose includes the rotation matrix and the translation vector. In the calibration image, the pixel coordinates of the light spot formed by a single micromirror on the digital micromirror device are obtained through image recognition; Based on the pixel coordinates of the light spot and the internal parameters and pose of the calibration camera, the three-dimensional coordinates of the physical space point corresponding to the light spot on the upper surface of the standard checkerboard calibration plate are obtained through the back projection algorithm; the two-dimensional coordinates of the light spot on the standard checkerboard calibration plate are obtained as the two-dimensional coordinates of the light spot. Obtain the coordinates of the micromirrors on the digital micromirror device; Establish a mapping between the micromirror coordinates and the two-dimensional coordinates of the light spot, which serves as the mapping between each micromirror and the area to be detected in the digital micromirror device; As an explanation, a digital micromirror device is a physical device consisting of a two-dimensional array of multiple micromirrors, where each micromirror is a miniature reflector that can be independently controlled and has both on and off states.
[0008] Preferably, in S2, a measurement matrix Φ corresponding to a series of binary random structured light patterns is generated based on the mapping between each micromirror in the digital micromirror device and the area to be detected, as follows: Based on the mapping between the micromirror coordinates and the two-dimensional coordinates of the light spot, a mapping relationship dataset is formed. The global mapping relationship function T is obtained by fitting the mapping relationship dataset using the least squares method. Based on the global mapping function T, the two-dimensional coordinates of each pattern in a series of binary random structured light patterns located in the area to be detected are obtained, and the measurement matrix Φ is generated.
[0009] Preferably, in S2, a series of binary random structured light patterns are generated using a Bernoulli distribution, and each pixel value in the series of binary random structured light patterns is a binary state identifier.
[0010] Preferably, in S2, each pixel value in a series of binary random structured light patterns is a binary state identifier, as follows: Each pixel value in a series of binary random structured light patterns independently takes the value of 0 or 1 with a 50% probability; when the pixel value is 0, the micromirror in the corresponding digital micromirror device is in the closed state, and when the pixel value is 1, the micromirror in the corresponding digital micromirror device is in the open state. For clarity, the pixel value of 1 here refers to the binary state identifier, rather than the actual numerical value of 1.
[0011] Preferably, in S4, based on a set of total light intensity measurements and the measurement matrix Φ, a compressed sensing reconstruction algorithm is executed to obtain a reflectance image of the area to be detected, as follows: S41. Let a set of total light intensity measurements be the measurement vector S, and let the reflectance image of the area to be detected be the reflectance image vector I. Based on the measurement matrix Φ, construct a linear measurement model; The linear measurement model is that the measurement vector S is equal to the product of the measurement matrix Φ and the reflectance image vector I; S42. In the transform domain Ψ, the reflectivity image vector I is transformed to obtain the sparse coefficient vector θ, that is, the sparse coefficient vector θ is equal to the product of the transform domain Ψ and the reflectivity image vector I. The objective is to determine whether the reflectance image I is sparse in the transform domain Ψ; The transform domain Ψ can be one of the wavelet transform domain, discrete cosine transform domain, or gradient domain. S43. With the constraints that the measurement vector S is equal to the product of the measurement matrix Φ and the reflectivity image vector I, and the sparse coefficient vector θ is equal to the product of the transform domain Ψ and the reflectivity image vector I, minimize the L1 norm of the sparse coefficient vector θ. The goal is to transform the problem of reconstructing reflectance images into an optimization problem with sparse constraints. S44. An iterative algorithm is used to solve for the L1 norm of the sparse coefficient vector θ, and the optimal solution of the reflectance image vector I is obtained by successive approximation. S45. Convert the optimal solution of reflectance image vector I into a two-dimensional reflectance image; As an explanation, the optimal solution for the reflectance image vector I at this time is in vector form; S46. Perform contrast enhancement and binarization processing on the two-dimensional reflectance image to highlight the character outline and obtain the reflectance image of the area to be detected.
[0012] Preferably, in S5, character recognition is optical character recognition (OCR) or optical character verification (OCV).
[0013] A drug information verification system, comprising: Micromirror-to-detection-area mapping module: Using digital micromirror devices, a mapping between each micromirror in the digital micromirror device and the detection area is constructed; Binary random structured light pattern generation and measurement matrix construction module: Using a digital micromirror device, the light beam emitted by the light source is modulated into a series of binary random structured light patterns, and the series of binary random structured light patterns are pre-stored; according to the mapping between each micromirror in the digital micromirror device and the area to be detected, a measurement matrix Φ corresponding to the series of binary random structured light patterns is generated. Structured light projection and total light intensity measurement module: Using digital micromirror devices, a series of pre-stored binary random structured light patterns are sequentially projected onto the detection area of the medicine box to be tested; when each pattern in the series of binary random structured light patterns is projected, a single photodetector is used to simultaneously measure the total light intensity value reflected back from the detection area, forming a set of total light intensity measurement values; Compressed sensing reflectance image reconstruction module: Based on a set of total light intensity measurements and measurement matrix Φ, the reflectance image of the area to be detected is obtained by executing a compressed sensing reconstruction algorithm; Character recognition and information verification module: performs character recognition on reflectance images, compares the recognition results with pre-stored drug information, and outputs the verification results.
[0014] The drug information verification method and system proposed in this invention have the following beneficial technical effects: 1. This application projects a series of pre-stored binary random structured light patterns using a digital micromirror device, and simultaneously acquires the total light intensity value reflected from the area to be detected using a single photodetector. Then, it combines the measurement matrix generated based on the mapping between the micromirror and the area to be detected, and reconstructs the reflectivity image of the area to be detected using a compressed sensing algorithm. Since the reflectivity image is an intrinsic property of the object surface and is independent of external lighting conditions, it eliminates interference from lighting angle and specular reflection, ensuring the integrity and clarity of specular reflection font information. This solves the problem that existing specular reflection fonts are prone to causing OCR recognition failure or misjudgment.
[0015] 2. This application first establishes a spatial mapping relationship between the digital micromirror device and the area to be detected through standard checkerboard calibration, ensuring that there is no deviation in the spatial correspondence between optical coding and light intensity measurement. Then, using compressed sensing algorithm, relying on the reconstruction logic of reflectivity image, combined with sparsity constraints in wavelet transform domain, discrete cosine transform domain or gradient domain, optimal solution of iterative algorithm, and subsequent contrast enhancement and binarization processing, it not only fundamentally isolates the interference of factors such as illumination angle variation, light source aging, lens dust, and ambient light fluctuation on imaging, but also stably captures the complete outline and detailed features of mirror-reflected characters, thereby avoiding the problem of character feature loss or edge blurring caused by reflection. This allows for consistent and clear character feature output results when recognizing optical characters (OCR) or verifying optical characters (OCV). Even in dynamic scenarios of continuous detection in pharmaceutical production, it can ensure the accuracy and consistency of recognition results each time, greatly improving the reliability of drug information verification. Attached Figure Description
[0016] Figure 1 This is a flowchart of a drug information verification method according to the present invention; Figure 2 This is a schematic diagram of a drug information verification system according to the present invention. Detailed Implementation
[0017] Embodiments of the present invention are described in detail below. Examples of these embodiments are illustrated in the accompanying drawings, wherein the same or similar symbols denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0018] like Figure 1 The method for verifying drug information shown includes the following steps: S1. Using a digital micromirror device, construct a mapping between each micromirror in the digital micromirror device and the area to be detected; S2. Using a digital micromirror device, the light beam emitted by the light source is modulated into a series of binary random structured light patterns, and the series of binary random structured light patterns are pre-stored; according to the mapping between each micromirror in the digital micromirror device and the area to be detected, a measurement matrix Φ corresponding to the series of binary random structured light patterns is generated. S3. Using a digital micromirror device, a series of pre-stored binary random structured light patterns are sequentially projected onto the detection area of the medicine box to be tested; when each pattern in the series of binary random structured light patterns is projected, a single photodetector is used to synchronously measure the total light intensity value reflected back from the detection area, forming a set of total light intensity measurement values, and a set of total light intensity measurement values corresponds one-to-one with a series of binary random structured light patterns. S4. Based on a set of total light intensity measurements and the measurement matrix Φ, the reflectance image of the area to be detected is obtained by executing a compressed sensing reconstruction algorithm; S5. Perform character recognition on the reflectance image and compare the recognition result with the pre-stored drug information, and output the verification result; if the verification result matches, it passes; if the verification result does not match, an alarm is triggered.
[0019] As an explanation, the identification results can be compared with the pre-stored drug information using hash value comparison algorithms, edit distance algorithms, and regular expression matching algorithms.
[0020] In S5, character recognition is either Optical Character Recognition (OCR) or Optical Character Verification (OCV). OCR refers to Optical Character Recognition, which is an existing technology that uses computer algorithms to convert printed or handwritten characters in an image from pixel information into editable and storable text data. OCV refers to Optical Character Verification, which is an existing technology that uses computer algorithms to compare characters in an image with preset standard character templates / rules character by character to verify whether the characters conform to the prescribed format and whether there are defects such as misprints / omissions / blurriness.
[0021] This application projects a series of pre-stored binary random structured light patterns using a digital micromirror device, and simultaneously acquires the total light intensity value reflected from the area to be detected using a single photodetector. Then, it combines the measurement matrix generated based on the mapping between the micromirror and the area to be detected, and reconstructs the reflectivity image of the area to be detected using a compressed sensing algorithm. Since the reflectivity image is an intrinsic property of the object surface and is independent of external lighting conditions, it eliminates interference from lighting angle and specular reflection, ensuring the integrity and clarity of specular reflection font information. This solves the problem that existing specular reflection fonts easily lead to OCR recognition failure or misjudgment.
[0022] In an optional embodiment, in S1, the mapping between each micromirror in the digital micromirror device and the region to be detected is constructed as follows: S11. Place a standard checkerboard calibration plate on the plane of the area to be tested of the medicine box; The physical dimensions of each square in the standard checkerboard calibration board are known values R. The physical coordinates of the corner points in the standard checkerboard calibration board are obtained based on the known values R. As an explanation, a corner point refers to the internal intersection point formed by the intersection of black and white squares on a standard chessboard calibration board; S12. Control the digital micromirror device to project a series of specific calibration patterns in sequence. The specific calibration patterns are several micromirrors that are opened individually at different positions. S13. Each time a specific calibration pattern is projected, an image of the standard checkerboard calibration plate is acquired by the calibration camera to obtain the calibration image; the optical axis of the calibration camera is parallel to the optical path of the single photodetector; the internal parameters of the calibration camera have been pre-calibrated. S14. For the calibration image, obtain the pixel coordinates of all corner points in the standard checkerboard calibration board through image recognition, and form a set of pixel coordinates. A set of physical coordinates is formed based on the physical coordinates of all corner points in the standard checkerboard calibration board; Based on the set of pixel coordinates and the set of physical coordinates, the pose of the calibration camera relative to the standard checkerboard calibration board is obtained by solving the PnP problem. The pose includes the rotation matrix and the translation vector. As an explanation, the PnP problem is an existing problem that involves calculating the projection relationship between N feature points in the world and N image points in an image to obtain the pose of a camera or object.
[0023] In the calibration image, the pixel coordinates of the light spot formed by a single micromirror on the digital micromirror device are obtained through image recognition; Based on the pixel coordinates of the light spot and the internal parameters and pose of the calibration camera, the three-dimensional coordinates of the physical space point corresponding to the light spot on the upper surface of the standard checkerboard calibration plate are obtained through the back projection algorithm; the two-dimensional coordinates of the light spot on the standard checkerboard calibration plate are obtained as the two-dimensional coordinates of the light spot. Obtain the coordinates of the micromirrors on the digital micromirror device; Establish a mapping between the micromirror coordinates and the two-dimensional coordinates of the light spot, which serves as the mapping between each micromirror and the area to be detected in the digital micromirror device; As an explanation, a digital micromirror device is a physical device consisting of a two-dimensional array of multiple micromirrors, where each micromirror is a miniature reflector that can be independently controlled and has two states: on and off. In an optional embodiment, in S2, a measurement matrix Φ corresponding to a series of binary random structured light patterns is generated based on the mapping between each micromirror in the digital micromirror device and the region to be detected, as follows: Based on the mapping between the micromirror coordinates and the two-dimensional coordinates of the light spot, a mapping relationship dataset is formed. The global mapping relationship function T is obtained by fitting the mapping relationship dataset using the least squares method. Based on the global mapping function T, the two-dimensional coordinates of each pattern in a series of binary random structured light patterns located in the area to be detected are obtained, and the measurement matrix Φ is generated.
[0024] In an optional embodiment, in S2, a series of binary random structured light patterns are generated using a Bernoulli distribution, wherein each pixel value in the series of binary random structured light patterns is a binary state identifier. Each pixel value in a series of binary random structured light patterns is a binary state identifier, as follows: Each pixel value in a series of binary random structured light patterns independently takes the value of 0 or 1 with a 50% probability; when the pixel value is 0, the micromirror in the corresponding digital micromirror device is in the closed state, and when the pixel value is 1, the micromirror in the corresponding digital micromirror device is in the open state. As an explanation, the pixel value of 1 here refers to the binary state identifier, rather than the actual numerical value of 1; In an optional embodiment, in S4, based on a set of total light intensity measurements and a measurement matrix Φ, a reflectance image of the region to be detected is obtained by executing a compressed sensing reconstruction algorithm, as follows: S41. Let a set of total light intensity measurements be the measurement vector S, and let the reflectance image of the area to be detected be the reflectance image vector I. Based on the measurement matrix Φ, construct a linear measurement model; The linear measurement model is that the measurement vector S is equal to the product of the measurement matrix Φ and the reflectance image vector I; S42. In the transform domain Ψ, the reflectivity image vector I is transformed to obtain the sparse coefficient vector θ, that is, the sparse coefficient vector θ is equal to the product of the transform domain Ψ and the reflectivity image vector I. The objective is to determine whether the reflectance image I is sparse in the transform domain Ψ; The transform domain Ψ can be one of the wavelet transform domain, discrete cosine transform domain, or gradient domain. S43. With the constraints that the measurement vector S is equal to the product of the measurement matrix Φ and the reflectivity image vector I, and the sparse coefficient vector θ is equal to the product of the transform domain Ψ and the reflectivity image vector I, minimize the L1 norm of the sparse coefficient vector θ. The goal is to transform the problem of reconstructing reflectance images into an optimization problem with sparse constraints. S44. An iterative algorithm is used to solve for the L1 norm of the sparse coefficient vector θ, and the optimal solution of the reflectance image vector I is obtained by successive approximation. In S44, the iterative algorithm is an iterative soft thresholding algorithm, and the Lipschitz constant of the iterative soft thresholding algorithm is the largest singular value of the measurement matrix Φ. The threshold parameter λ of the iterative soft thresholding algorithm is: λ = a‧max|ΦᵀS|; Where Φᵀ is the transpose of Φ; the value of a ranges from 0.05 to 0.15; In one optional embodiment, a = 0.1; The Lipschitz constant is a parameter in the iterative soft thresholding algorithm that ensures the convergence of the algorithm. S45. Convert the optimal solution of reflectance image vector I into a two-dimensional reflectance image; As an explanation, the optimal solution for the reflectance image vector I at this time is in vector form; S46. Perform contrast enhancement and binarization processing on the two-dimensional reflectance image to highlight the character outline and obtain the reflectance image of the area to be detected.
[0025] This application first establishes a spatial mapping relationship between the digital micromirror device and the area to be detected through standard checkerboard calibration, ensuring that there is no deviation in the spatial correspondence between optical coding and light intensity measurement. Then, using compressed sensing algorithm, relying on the reconstruction logic of reflectivity image, combined with sparsity constraints in wavelet transform domain, discrete cosine transform domain or gradient domain, optimal solution of iterative algorithm, and subsequent contrast enhancement and binarization processing, it not only fundamentally isolates the interference of factors such as changes in illumination angle, light source aging, lens dust, and ambient light fluctuations on imaging, but also stably captures the complete outline and detailed features of mirror-reflected characters, thereby avoiding the problem of character feature loss or edge blurring caused by reflection. This allows for consistent and clear character feature output results when recognizing optical characters (OCR) or verifying optical characters (OCV). Even in dynamic scenarios of continuous detection in pharmaceutical production, it can ensure the accuracy and consistency of recognition results each time, greatly improving the reliability of drug information verification.
[0026] As an explanation, this application cannot replace all traditional visual inspection methods. It is applicable when traditional methods, regardless of adjusting lighting angles, changing cameras, or trying various image processing algorithms, still cannot reliably read characters, such as in cases involving hot stamping at specific angles, laser-engraved codes on uneven curved bottles, or transparent characters on complex textured backgrounds. In the pharmaceutical industry, a single missed or false detection leading to a batch recall carries extremely high costs. In such cases, reliability takes far greater priority than efficiency and cost. Using this application can significantly improve the reliability of drug information verification.
[0027] like Figure 2 The drug information verification system shown includes: Micromirror-to-detection-area mapping module: Using digital micromirror devices, a mapping between each micromirror in the digital micromirror device and the detection area is constructed; Binary random structured light pattern generation and measurement matrix construction module: Using a digital micromirror device, the light beam emitted by the light source is modulated into a series of binary random structured light patterns, and the series of binary random structured light patterns are pre-stored; according to the mapping between each micromirror in the digital micromirror device and the area to be detected, a measurement matrix Φ corresponding to the series of binary random structured light patterns is generated. Structured light projection and total light intensity measurement module: Using digital micromirror devices, a series of pre-stored binary random structured light patterns are sequentially projected onto the detection area of the medicine box to be tested; when each pattern in the series of binary random structured light patterns is projected, a single photodetector is used to simultaneously measure the total light intensity value reflected back from the detection area, forming a set of total light intensity measurement values; Compressed sensing reflectance image reconstruction module: Based on a set of total light intensity measurements and measurement matrix Φ, the reflectance image of the area to be detected is obtained by executing a compressed sensing reconstruction algorithm; Character recognition and information verification module: performs character recognition on reflectance images, compares the recognition results with pre-stored drug information, and outputs the verification results.
[0028] For clarification, "acquisition" in this application refers to obtaining the required content or data using existing technical means.
[0029] Furthermore, any content not described in detail in this specification is existing technology known to those skilled in the art.
[0030] In the embodiments provided by this invention, it should be understood that the disclosed system or method can be implemented in other ways. For example, the embodiments of the invention described above are merely illustrative; for instance, the division of modules is only a logical functional division, and there may be other division methods in actual implementation.
[0031] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0032] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or in the form of hardware plus software functional modules.
[0033] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the basic characteristics of the present invention.
[0034] The above are merely preferred embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for verifying drug information, characterized in that, Includes the following steps: S1. Using a digital micromirror device, construct a mapping between each micromirror in the digital micromirror device and the area to be detected; S2. Using a digital micromirror device, the light beam emitted by the light source is modulated into a series of binary random structured light patterns, and the series of binary random structured light patterns are pre-stored; according to the mapping between each micromirror in the digital micromirror device and the area to be detected, a measurement matrix Φ corresponding to the series of binary random structured light patterns is generated. S3. Using a digital micromirror device, a series of pre-stored binary random structured light patterns are sequentially projected onto the detection area of the medicine box to be tested; When each pattern in a series of binary random structured light patterns is projected, the total light intensity value reflected back from the area to be detected is simultaneously measured using a single photodetector, forming a set of total light intensity measurements. S4. Based on a set of total light intensity measurements and the measurement matrix Φ, the reflectance image of the area to be detected is obtained by executing a compressed sensing reconstruction algorithm; S5. Perform character recognition on the reflectance image, compare the recognition results with the pre-stored drug information, and output the verification results.
2. The drug information verification method according to claim 1, characterized in that, In S1, the mapping between each micromirror in the digital micromirror device and the region to be detected is constructed as follows: S11. Place a standard checkerboard calibration plate on the plane of the area to be tested of the medicine box; The physical dimensions of each square in the standard checkerboard calibration board are known values R. The physical coordinates of the corner points in the standard checkerboard calibration board are obtained based on the known values R. S12. Control the digital micromirror device to project a series of specific calibration patterns in sequence. The specific calibration patterns are several micromirrors that are opened individually at different positions. S13. Each time a specific calibration pattern is projected, an image of the standard checkerboard calibration plate is acquired by the calibration camera to obtain the calibration image; the optical axis of the calibration camera is parallel to the optical path of the single photodetector; the internal parameters of the calibration camera have been pre-calibrated. S14. For the calibration image, obtain the pixel coordinates of all corner points in the standard checkerboard calibration board through image recognition, and form a set of pixel coordinates. A set of physical coordinates is formed based on the physical coordinates of all corner points in the standard checkerboard calibration board; Based on the set of pixel coordinates and the set of physical coordinates, the pose of the calibration camera relative to the standard checkerboard calibration board is obtained by solving the PnP problem. The pose includes the rotation matrix and the translation vector. In the calibration image, the pixel coordinates of the light spot formed by a single micromirror on the digital micromirror device are obtained through image recognition; Based on the pixel coordinates of the light spot and the internal parameters and pose of the calibration camera, the three-dimensional coordinates of the physical space point corresponding to the light spot on the upper surface of the standard checkerboard calibration plate are obtained through the back projection algorithm; the two-dimensional coordinates of the light spot on the standard checkerboard calibration plate are obtained as the two-dimensional coordinates of the light spot. Obtain the coordinates of the micromirrors on the digital micromirror device; A mapping between the micromirror coordinates and the two-dimensional coordinates of the light spot is established as the mapping between each micromirror and the area to be detected in the digital micromirror device.
3. The drug information verification method according to claim 2, characterized in that, In S2, based on the mapping between each micromirror in the digital micromirror device and the region to be detected, a measurement matrix Φ corresponding to a series of binary random structured light patterns is generated, as follows: Based on the mapping between the micromirror coordinates and the two-dimensional coordinates of the light spot, a mapping relationship dataset is formed. The global mapping relationship function T is obtained by fitting the mapping relationship dataset using the least squares method. Based on the global mapping function T, the two-dimensional coordinates of each pattern in a series of binary random structured light patterns located in the area to be detected are obtained, and the measurement matrix Φ is generated.
4. The drug information verification method according to claim 1, characterized in that, In S2, a series of binary random structured light patterns are generated using Bernoulli distribution, and each pixel value in the series of binary random structured light patterns is a binary state identifier.
5. The drug information verification method according to claim 4, characterized in that, In S2, each pixel value in a series of binary random structured light patterns is a binary state identifier, as follows: Each pixel value in a series of binary random structured light patterns independently takes the value of 0 or 1 with a 50% probability; when the pixel value is 0, the micromirror in the corresponding digital micromirror device is in the closed state, and when the pixel value is 1, the micromirror in the corresponding digital micromirror device is in the open state.
6. The drug information verification method according to claim 1, characterized in that, In S4, based on a set of total light intensity measurements and the measurement matrix Φ, a compressed sensing reconstruction algorithm is executed to obtain the reflectance image of the region to be detected, as follows: S41. Let a set of total light intensity measurements be the measurement vector S, and let the reflectance image of the area to be detected be the reflectance image vector I. Based on the measurement matrix Φ, construct a linear measurement model; The linear measurement model is that the measurement vector S is equal to the product of the measurement matrix Φ and the reflectance image vector I; S42. In the transform domain Ψ, the reflectivity image vector I is transformed to obtain the sparse coefficient vector θ, that is, the sparse coefficient vector θ is equal to the product of the transform domain Ψ and the reflectivity image vector I. The transform domain Ψ can be one of the wavelet transform domain, discrete cosine transform domain, or gradient domain. S43. With the constraints that the measurement vector S is equal to the product of the measurement matrix Φ and the reflectivity image vector I, and the sparse coefficient vector θ is equal to the product of the transform domain Ψ and the reflectivity image vector I, minimize the L1 norm of the sparse coefficient vector θ. S44. An iterative algorithm is used to solve for the L1 norm of the sparse coefficient vector θ to obtain the optimal solution for the reflectance image vector I. S45. Convert the optimal solution of reflectance image vector I into a two-dimensional reflectance image; S46. Perform contrast enhancement and binarization processing on the two-dimensional reflectance image to obtain the reflectance image of the area to be detected.
7. The drug information verification method according to claim 1, characterized in that, In S5, character recognition is either Optical Character Recognition (OCR) or Optical Character Verification (OCV).
8. A drug information verification system for using the drug information verification method of any one of claims 1 to 7, characterized in that, include: Micromirror-to-detection-area mapping module: Using digital micromirror devices, a mapping between each micromirror in the digital micromirror device and the detection area is constructed; Binary random structured light pattern generation and measurement matrix construction module: Using a digital micromirror device, the light beam emitted by the light source is modulated into a series of binary random structured light patterns, and the series of binary random structured light patterns are pre-stored; according to the mapping between each micromirror in the digital micromirror device and the area to be detected, a measurement matrix Φ corresponding to the series of binary random structured light patterns is generated. Structured light projection and total light intensity measurement module: Using digital micromirror devices, a series of pre-stored binary random structured light patterns are sequentially projected onto the detection area of the medicine box to be tested; When each pattern in a series of binary random structured light patterns is projected, the total light intensity value reflected back from the area to be detected is simultaneously measured using a single photodetector, forming a set of total light intensity measurements. Compressed sensing reflectance image reconstruction module: Based on a set of total light intensity measurements and measurement matrix Φ, the reflectance image of the area to be detected is obtained by executing a compressed sensing reconstruction algorithm; Character recognition and information verification module: performs character recognition on reflectance images, compares the recognition results with pre-stored drug information, and outputs the verification results.