A transparent capsule liquid leakage detection method, device, equipment and storage medium
By combining reflectance spectroscopy detection and structured light three-dimensional measurement in a tandem detection method, the problems of high efficiency and high accuracy in detecting leakage from transparent capsules have been solved, enabling rapid screening and accurate verification of transparent capsules and improving the accuracy and speed of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TIANJIN UNIV OF TECH & EDUCATION (TEACHER DEV CENT OF CHINA VOCATIONAL TRAINING & GUIDANCE)
- Filing Date
- 2026-03-30
- Publication Date
- 2026-06-09
AI Technical Summary
Existing methods for detecting leakage in transparent capsules suffer from high equipment costs, long detection cycles, susceptibility to ambient light and random capsule positioning, low detection efficiency, and inability to meet the needs of rapid online detection.
A detection method combining a reflectance spectroscopy detection unit and a structured light three-dimensional measurement unit is adopted. Through a series detection strategy that combines rapid screening with rapid screening with precise three-dimensional verification with structured light, the capsule attitude is adjusted by the transmission control unit, and a criterion is constructed based on statistical parameters of depth distribution characteristics.
It achieves high-precision and high-efficiency leakage detection of transparent capsules, improves detection speed and accuracy, reduces false detections and false negatives, and meets the needs of online rapid detection.
Smart Images

Figure CN121933213B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of capsule testing, and in particular relates to a method, apparatus, equipment and storage medium for detecting leakage in transparent capsules. Background Technology
[0002] Various methods for testing the seal integrity of transparent soft capsules used in pharmaceuticals and health products mainly include physical testing methods, chemical testing methods, visual testing methods, multimodal fusion testing methods, and spectroscopic analysis methods. Specifically:
[0003] Physical / chemical detection methods, such as the pressure decay method which involves filling the test chamber with gas and monitoring the pressure change, and helium mass spectrometry leak detection which uses helium as a tracer gas to detect concentration, can achieve high sensitivity and accurate quantification.
[0004] Optical visual inspection methods, including transmitted light imaging and surface scattered light imaging, make judgments by analyzing images to achieve non-contact and high-efficiency inspection.
[0005] Spectroscopic analysis methods, such as reflectance spectroscopy, are based on Fresnel's law of reflection. They detect changes in reflectance at the top interface of a capsule due to a drop in the internal liquid level, achieving rapid and non-destructive testing.
[0006] Structured light 3D detection method projects coded light patterns onto the surface of an object and acquires deformed images. It then uses triangulation and phase calculation principles to reconstruct the three-dimensional shape of the object, achieving the effect of obtaining surface depth information and identifying minute deformations with high precision.
[0007] In the process of achieving detection results through the aforementioned methods using existing technologies, the following drawbacks exist due to the inherent limitations of the technical principles or the complexity of the application scenarios: physical / chemical detection methods have high equipment costs and long detection cycles, making it difficult to integrate them into high-speed production lines for full inspection; visual detection methods are easily affected by ambient light and the random pose of capsules, leading to false detections or missed detections; although the single reflectance spectroscopy detection method is fast, it is easily interfered with by contaminants on the capsule surface and is not sensitive to the location of the leak; although the single structured light three-dimensional detection method can accurately capture the tiny air bubbles at the top caused by the leak, it takes too long to reconstruct the three dimensions of all capsule samples one by one, resulting in low detection efficiency and failing to meet the needs of online rapid detection. Summary of the Invention
[0008] The purpose of this application is to overcome the defects in the prior art and provide a method, apparatus, equipment and storage medium for detecting leakage in transparent capsules.
[0009] This application provides a method for detecting leakage in transparent capsules, applied to a transparent capsule leakage detection system. The transparent capsule leakage detection system includes a reflectance spectroscopy detection unit, a structured light three-dimensional measurement unit, and a transmission control unit. The method includes:
[0010] The transmission control unit adjusts the orientation of the capsule to be inspected to a preset direction;
[0011] When the capsule is in the preset direction, the reflectance spectrum detection unit acquires the reflectance spectrum of the top of the capsule, determines the reflectance attenuation value based on the reflectance spectrum, compares the reflectance attenuation value with a first threshold, and generates a preliminary judgment result of the capsule. The preliminary judgment result includes qualified, suspected leakage, or leakage.
[0012] If the preliminary judgment result is suspected leakage, the delivery control unit will deliver the capsule to the detection position of the structured light three-dimensional measurement unit;
[0013] The structured light 3D measurement unit projects structured light onto the surface of the capsule located at the detection position and acquires images. Based on the images, it reconstructs 3D point cloud data of the capsule surface, extracts depth distribution features from the 3D point cloud data, and constructs depth criteria based on the statistical parameters of the depth distribution features.
[0014] Based on the preliminary judgment result and the depth criterion, the final leakage status judgment result of the capsule is determined; wherein, if the preliminary judgment result is leakage, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is greater than the second threshold, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is less than or equal to the second threshold, the final leakage status judgment result is determined to be qualified.
[0015] Optionally, the reflectance spectrum of the top of the capsule is acquired by the reflectance spectrum detection unit, a reflectance attenuation value is determined based on the reflectance spectrum, and the reflectance attenuation value is compared with a first threshold to generate a preliminary judgment result of the capsule, including:
[0016] Obtain the first absolute light intensity value of the reflected spectrum at the first characteristic wavelength;
[0017] Obtain the second absolute light intensity value of the reflected spectrum at the second characteristic wavelength;
[0018] The first absolute light intensity value is compared with the third threshold, and the second absolute light intensity value is compared with the fourth threshold;
[0019] When the first absolute light intensity value is lower than the third threshold and the second absolute light intensity value is higher than the fourth threshold, the preliminary determination result of generating the capsule is leakage.
[0020] Optionally, the structured light 3D measurement unit projects structured light onto the surface of the capsule located at the detection position and acquires an image, reconstructs 3D point cloud data of the capsule surface based on the image, and extracts depth distribution features based on the 3D point cloud data, including:
[0021] Remove the point cloud data corresponding to the two ends of the capsule from the three-dimensional point cloud data to obtain the three-dimensional point cloud data of the middle region;
[0022] Based on the three-dimensional point cloud data of the central region, calculate the first statistical parameter, the second statistical parameter, the third statistical parameter, and the fourth statistical parameter;
[0023] The first statistical parameter is the area percentage of the deep anomaly region;
[0024] The second statistical parameter is the average depth deviation of the depth anomaly region;
[0025] The third statistical parameter is the peak depth deviation of the depth anomaly region;
[0026] The fourth statistical parameter is the dispersion of the depth anomaly region.
[0027] Optionally, a depth criterion is constructed based on statistical parameters of the depth distribution features, including:
[0028] The first statistical parameter is weighted using the first weighting coefficient;
[0029] The second statistical parameter, after the first normalization process, is weighted using a second weighting coefficient.
[0030] The third statistical parameter, after the second normalization process, is weighted using a third weighting coefficient.
[0031] The fourth statistical parameter, after the third normalization process, is weighted using a fourth weighting coefficient.
[0032] The weighted first statistical parameter, the weighted second statistical parameter, the weighted third statistical parameter, and the weighted fourth statistical parameter are summed to construct a comprehensive leakage coefficient, which is used as the depth criterion.
[0033] Optionally, the reflectance spectrum of the top of the capsule is acquired by the reflectance spectrum detection unit, and the reflectance attenuation value is determined based on the reflectance spectrum, including:
[0034] Select a specific wavelength as the characteristic wavelength;
[0035] Calculate the reflectance attenuation value of the capsule at the characteristic wavelength;
[0036] Based on the correlation model between reflectivity and the internal cavity of the capsule, a quantitative relationship model between the reflectivity attenuation value and the amount of liquid leakage is established.
[0037] Optionally, the structured light 3D measurement unit projects structured light onto the capsule surface located at the detection position and acquires an image, and reconstructs 3D point cloud data of the capsule surface based on the image, including:
[0038] A phase-shifted structured light pattern with multiple spatial frequencies is projected onto the surface of the capsule;
[0039] Multiple phase images modulated by the surface of the capsule were acquired;
[0040] Calculate the absolute phase based on the multiple phase images;
[0041] Reconstruct the three-dimensional point cloud data of the capsule surface based on the absolute phase.
[0042] Optionally, the transmission control unit adjusts the orientation of the capsule to be inspected to a preset direction, including:
[0043] The capsule is delivered via a guide channel with a specific geometry;
[0044] By utilizing the geometric constraints of the guide channel, the long axis direction of the capsule is adjusted to a preset direction that is perpendicular to the direction of the structured light stripes projected by the structured light three-dimensional measurement unit.
[0045] This application also provides a transparent capsule leakage detection device, applied to a transparent capsule leakage detection system. The transparent capsule leakage detection system includes a reflectance spectroscopy detection unit, a structured light three-dimensional measurement unit, and a transmission control unit. The device includes:
[0046] The attitude module, through the transmission control unit, adjusts the attitude of the capsule to be inspected to a preset direction;
[0047] The comparison module, when the capsule is in the preset direction, obtains the reflection spectrum of the top of the capsule by the reflection spectrum detection unit, determines the reflectance attenuation value based on the reflection spectrum, compares the reflectance attenuation value with a first threshold, and generates a preliminary judgment result of the capsule. The preliminary judgment result includes qualified, suspected leakage, or leakage.
[0048] If the preliminary judgment result is suspected leakage, the delivery module will deliver the capsule to the detection position of the structured light three-dimensional measurement unit.
[0049] The analysis module projects structured light onto the surface of the capsule located at the detection position using the structured light 3D measurement unit and acquires images. Based on the images, it reconstructs 3D point cloud data of the capsule surface, extracts depth distribution features from the 3D point cloud data, and constructs depth criteria based on the statistical parameters of the depth distribution features.
[0050] The judgment module determines the final leakage status judgment result of the capsule based on the preliminary judgment result and the depth criterion; wherein, if the preliminary judgment result is leakage, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is greater than the second threshold, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is less than or equal to the second threshold, the final leakage status judgment result is determined to be qualified.
[0051] This application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0052] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the above-described method.
[0053] The beneficial effects of this application are:
[0054] This application provides a method for detecting leakage in a transparent capsule, applied to a transparent capsule leakage detection system. The system includes a reflectance spectroscopy detection unit, a structured light three-dimensional measurement unit, and a transmission control unit. The method includes: the transmission control unit adjusting the orientation of the capsule to be inspected to a preset direction; when the capsule is in the preset direction, the reflectance spectroscopy detection unit acquires the reflectance spectrum of the top of the capsule, determines a reflectance attenuation value based on the reflectance spectrum, compares the reflectance attenuation value with a first threshold, and generates a preliminary judgment result for the capsule, the preliminary judgment result including qualified, suspected leakage, or leakage; if the preliminary judgment result is suspected leakage, the transmission control unit transmits the capsule to the detection position of the structured light three-dimensional measurement unit; the method further includes: adjusting the orientation of the capsule to a preset direction; when the capsule is in the preset direction, the reflectance spectroscopy detection unit acquires the reflectance spectrum of the top of the capsule, determines a reflectance attenuation value based on the reflectance spectrum, compares the reflectance attenuation value with a first threshold, and generates a preliminary judgment result for the capsule, including qualified, suspected leakage, or leakage; if the preliminary judgment result is suspected leakage, the transmission control unit transmits the capsule to the detection position of the structured light three-dimensional measurement unit; the method further includes: adjusting the orientation of the capsule to a preset direction; ... A structured light 3D measurement unit projects structured light onto the surface of the capsule located at the detection position and acquires images. Based on the images, it reconstructs 3D point cloud data of the capsule surface, extracts depth distribution features from the 3D point cloud data, and constructs a depth criterion based on the statistical parameters of the depth distribution features. Based on the preliminary judgment result and the depth criterion, it determines the final leakage state judgment result of the capsule. Specifically, if the preliminary judgment result is leakage, the final leakage state judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is greater than a second threshold, the final leakage state judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is less than or equal to the second threshold, the final leakage state judgment result is determined to be qualified. This application achieves a balance between high precision and high efficiency by employing a tandem detection strategy combining rapid screening with structured light 3D precise verification, and by designing a capsule guiding channel to strictly constrain the posture of the capsule to be inspected to a preset direction. Attached Figure Description
[0055] Figure 1 This is a schematic diagram of the leakage detection process for the transparent capsule in this application;
[0056] Figure 2 This is a schematic diagram of reflectance spectroscopy detection in this application;
[0057] Figure 3 This is a flowchart of the structured light measurement process in this application;
[0058] Figure 4 This is a schematic diagram of the principle of spectral and structured light fusion detection in this application;
[0059] Figure 5 This is the overall system block diagram in this application;
[0060] Figure 6 This is a top view of the overall design of the capsule leakage detection system in this application;
[0061] Figure 7This is a schematic diagram showing the fitting curve of 484nm reflected light intensity and leakage amount, as well as the coefficient of determination and correlation coefficient;
[0062] Figure 8 This is a schematic diagram showing the fitting curve of reflectivity attenuation and leakage, along with the coefficient of determination and correlation coefficient. Detailed Implementation
[0063] Exemplary embodiments of the present disclosure will now be provided in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it is to be understood that various forms of implementation of the present disclosure are intended and should not be limited to the embodiments set forth herein. Rather, the embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0064] Please refer to Figure 1 and Figure 6 As shown, this application provides a method for detecting leakage in transparent capsules, applied in the field of pharmaceutical and health product production quality testing. It addresses the problems of existing capsule leakage detection methods being insensitive to early micro-leakage in transparent capsules, inefficient, easily affected by environmental interference, and prone to false or false detections in complex environments. The method includes:
[0065] S101, The transmission control unit adjusts the posture of the capsule to be inspected to a preset direction.
[0066] The conveying control unit specifically includes a conveyor belt and a specially designed capsule guide channel mounted on the conveyor belt. Its core is a progressive limiting system composed of the conveyor belt and the specially designed capsule guide channel. The guide channel adopts a Y-shaped design, with its entrance width gradually converging to ultimately form a straight channel that allows only a single capsule to pass through. The purpose of this action is to force the major axis direction of each capsule to be inspected to a specific direction perpendicular to the direction of the coded light stripes projected by the subsequent structured light 3D measurement unit, i.e., the preset direction, through physical geometric constraints.
[0067] like Figure 3As shown, adjusting the capsule to this preset orientation is crucial because if the capsule's pose is random and it rolls freely during transport, the transparent curved shell can easily cause the structured light to be lost in the image information captured by the camera through specular reflection or complex refraction, resulting in large areas of highlight flares or dark areas with missing signals in the acquired image. These areas, lacking effective texture or modulation information, will directly lead to phase extraction failure. By adding the capsule guide channel mentioned above, through physical constraints, each capsule to be inspected can enter the detection area with a consistent and stable posture. This not only ensures that the capsule is located at the optimal observation angle for the spectrum and structured light, minimizing optical signal loss caused by the transparent curved surface, but also ensures the consistency of measurement conditions for each measurement, laying the physical foundation for subsequent high-precision, repeatable 3D reconstruction and spectral acquisition. The transport control unit also includes a cylinder actuator, used in subsequent steps to push capsules suspected of leakage by spectral detection from the main transport channel to another capsule guide channel dedicated to structured light detection, ensuring that they enter the structured light detection position in the same preset orientation.
[0068] S102. When the capsule is in the preset direction, the reflectance spectrum detection unit acquires the reflectance spectrum of the top of the capsule, determines the reflectance attenuation value based on the reflectance spectrum, compares the reflectance attenuation value with a first threshold, and generates a preliminary judgment result of the capsule. The preliminary judgment result includes qualified, suspected leakage, or leakage.
[0069] like Figure 2 As shown, the reflectance spectroscopy detection unit is a rapid screening module based on reflectance spectroscopy. Its hardware mainly includes an optical light source, a quartz fiber, a fiber optic probe, and a spectrometer. The optical light source is a D-2000 deuterium lamp, capable of outputting a stable continuous spectrum from 190-2500 nm. The spectrometer is a USB4000 fiber optic spectrometer, whose core performance of the dispersive system is determined by the grating equation:
[0070] mλ=d(sinα±sinβ)
[0071] Where m is the diffraction order, λ is the wavelength, d is the grating constant, and α and β are the incident angle and diffraction angle, respectively.
[0072] The spectrometer uses a 600 lines / mm grating and a 10μm entrance slit, with an actual optical resolution of approximately 0.3nm. When the capsule passes through the spectral detection area in a preset direction, the light emitted by the deuterium lamp source is transmitted through the incident optical fiber and incident at a fixed angle onto a line on the top surface of the capsule; the reflected light from the capsule surface is collected by the receiving optical fiber and guided into the spectrometer, thereby obtaining the reflectance spectral data of the top of the capsule.
[0073] The specific process of generating the preliminary judgment result includes two parallel judgment logics.
[0074] The first judgment logic is to perform direct leakage judgment based on dual characteristic wavelengths, specifically including:
[0075] Obtain the first absolute light intensity value of the reflected spectrum at the first characteristic wavelength of 391 nm;
[0076] Obtain the second absolute light intensity value of the reflection spectrum at the second characteristic wavelength of 484 nm;
[0077] The first absolute light intensity value is compared with the third threshold of 2000, and the second absolute light intensity value is compared with the fourth threshold of 6000.
[0078] When the first absolute light intensity value is lower than the third threshold and the second absolute light intensity value is higher than the fourth threshold, the preliminary determination result of generating the capsule is leakage.
[0079] The physical scenario corresponding to this logic is that the capsule leakage point happens to be located in the spectral detection area or its top is contaminated by the contents. The fish oil in the contents strongly absorbs light in the ultraviolet band, resulting in a significant decrease in light intensity at 391nm, while the light intensity at 484nm is relatively high. Based on these two conditions, leakage can be directly determined without proceeding to the subsequent structured light fine inspection process.
[0080] The second determination logic involves a determination based on a reflectivity attenuation model. The core of this process is selecting a specific wavelength of 484nm as the characteristic wavelength and calculating the reflectivity attenuation value of the capsule at that characteristic wavelength. The formula for calculating the reflectivity attenuation value is:
[0081]
[0082] in, This is the reflectivity attenuation value. This represents the measured reflected light intensity of the capsule under test at 484 nm. The average value of the baseline reflected light intensity of the intact capsule at 484 nm.
[0083] Then, based on the correlation model between reflectance and the internal cavity of the capsule, a quantitative relationship model between the reflectance attenuation value and the amount of liquid leakage was established. This model was established through experiments and analysis on samples with different leakage gradients. The experimental samples were commercially available oval transparent fish oil soft capsules, with a single sample containing approximately 1.2 ml of contents. Intact samples were taken directly from the sealed packaging.
[0084] Leaking capsule samples were simulated by puncturing the bottom of the capsule with a microsyringe needle and precisely extracting a specific volume of contents. All samples were placed in a constant temperature and humidity environment of 24°C and 50%RH for 24 hours to ensure stability. The samples were divided into four groups: A (intact), B (minor leakage 10-100μL), C (significant leakage 100-200μL), and D (severe leakage).
[0085] like Figure 7 As shown, by fitting experimental data of samples with different leakage gradients, a quadratic polynomial quantitative relationship model between reflectivity attenuation and leakage amount was established, and its expression is:
[0086]
[0087] Where L represents the leakage amount, and the unit is μL.
[0088] The model has a determination coefficient of 0.9286 and a correlation coefficient of -0.9636.
[0089] like Figure 8 As shown, the calculated reflectance attenuation value of the capsule under test is compared with a first threshold determined based on statistics of intact samples. When At that time, the preliminary judgment result of generating the capsule was suspected leakage; when At that time, the preliminary judgment result of the generated capsule is qualified. Among them, The first threshold, This represents the maximum value of the reflectance attenuation of the capsule under test.
[0090] This step enables rapid screening of capsules on the production line, effectively identifying suspected leaking capsules with abnormal reflectance spectra, narrowing down the target range for subsequent accurate verification, and significantly improving the overall detection speed.
[0091] S103. If the preliminary judgment result is suspected leakage, the delivery control unit will deliver the capsule to the detection position of the structured light three-dimensional measurement unit.
[0092] like Figure 6 As shown, 1 is the qualified capsule storage basket, 2 is cylinder 1, 3 is cylinder 2, 4 is the light source, 5 is the transmitting optical fiber, 6 is the capsule under test, 7 is the conveyor belt, 8 is the receiving optical fiber, 9 is the spectrometer, 10 is the PC terminal, 11 is the optical support, 12 is the leaking capsule storage basket, 13 is the camera, and 14 is the DKP. When the spectral detection unit determines that the preliminary judgment result of a capsule is "suspected leakage", the system will trigger a control signal to drive the cylinder actuator in the conveying control unit to move, pushing the capsule from the main conveying channel to another capsule guide channel dedicated to structured light detection.
[0093] This channel also has the aforementioned geometric constraint capability, ensuring that the capsule enters in the same preset direction as in step S101 and precisely stops at the detection position of the structured light three-dimensional measurement unit.
[0094] like Figure 4 As shown, this action is a key link in realizing the two-stage cascaded detection strategy of rapid spectral screening and precise structured light verification. It automatically guides the suspicious capsules screened by the initial spectral screening to the fine inspection station, while ensuring the consistency of the capsule's posture during fine inspection. For capsules whose preliminary judgment result is directly "leaking" or "qualified", they do not need to enter this transfer process and are directly rejected or released, thereby optimizing the efficiency of the detection process.
[0095] S104. The structured light 3D measurement unit projects structured light onto the surface of the capsule located at the detection position and acquires an image. Based on the image, the 3D point cloud data of the capsule surface is reconstructed. The depth distribution features are extracted from the 3D point cloud data, and a depth criterion is constructed based on the statistical parameters of the depth distribution features.
[0096] The structured light 3D measurement unit is a high-precision 3D vision measurement system, mainly consisting of a DLP projector and an industrial camera. Its core principle is active triangulation.
[0097] First, perform 3D point cloud data reconstruction, which includes:
[0098] The structured light 3D measurement unit projects structured light onto the capsule surface located at the detection position and acquires images. Specifically, a three-frequency four-phase phase-shifting method is used to project phase-shifted structured light patterns with multiple spatial frequencies onto the capsule surface; the multiple spatial frequencies are 59, 64, and 70. A DLP projector (this system uses the DLP LightCrafter 4500 evaluation module) sequentially projects four sinusoidal fringe images with phase shifts of 0, π / 2, π, and 2π / 3 at each frequency group.
[0099] The camera and projector work together via a hardware synchronization interface (Trigger In / Out) to achieve strict synchronization between pattern projection and image acquisition, capturing multiple phase images modulated by the capsule surface. For each spatial frequency f, the light intensity sequence captured by the camera is represented as:
[0100]
[0101] Among them, I n (x, y) represents the light intensity value at pixel (x, y) in the nth image. Background light intensity, To modulate light intensity, The principal phase value to be calculated is... Let be the phase shift of the nth image.
[0102] The enclosed phase can be calculated using a four-step phase shift method:
[0103]
[0104] in, and These represent the light intensity values at point (x, y) for four phase shift images of the same frequency.
[0105] Then, phase expansion is performed using the multi-frequency heterodyne principle. By subtracting the wrapped phases of two or more frequencies point by point, an equivalent phase difference signal with a period much larger than the original pattern is constructed. The specific calculation formula is as follows:
[0106]
[0107] in, These are the wrap-around phases corresponding to frequencies of 59, 64, and 70, respectively. , For intermediate differential phase, This is the synthesized equivalent low-frequency phase.
[0108] This synthesized phase is continuous and unambiguous across the entire field of view, thus it can be directly used as a reference. By unpacking the high-frequency wrapper phase, an absolute phase distribution that covers the entire field of view and has global consistency can be recovered.
[0109]
[0110] in, To wrap the phase, This indicates the number of times the package phase is folded.
[0111] Finally, based on the calibrated system parameters and the absolute phase, the three-dimensional point cloud data of the capsule surface is reconstructed using the triangulation principle. The system parameters are obtained using the Zhang Zhengyou calibration method and include the camera intrinsic parameter matrix, distortion coefficients, projector intrinsic parameter matrix, system rotation matrix, and translation vector. The calibration uses an 8x11 black and white checkerboard, with each square measuring 5mm. An example of the calibrated parameters is shown below:
[0112] Camera intrinsic parameter matrix:
[0113]
[0114] Distortion coefficient:
[0115]
[0116] Projector intrinsic parameter matrix:
[0117]
[0118] System parameters:
[0119]
[0120]
[0121] Among them, K C D, K P R S T S , respectively, are the camera intrinsic parameter matrix, distortion coefficient, projector intrinsic parameter matrix, rotation matrix, and translation vector.
[0122] After obtaining the 3D point cloud data, depth distribution features are extracted based on the 3D point cloud data.
[0123] Because the depth information is distorted at both ends of the transparent capsule due to localized highlights or shadows, to eliminate this interference, the point cloud data corresponding to the regions at both ends of the capsule is first removed from the 3D point cloud data, and the 3D point cloud data of the effective region in the middle of the top of the capsule is obtained. Based on the 3D point cloud data of the middle region, four statistical parameters are calculated;
[0124] The first statistical parameter F is the area ratio of the deep anomaly region, that is, the ratio of the number of abnormal pixels A to the total number of pixels B in the detection area;
[0125] The second statistical parameter E is the average depth deviation of the depth anomaly region, which is the mean of the absolute values of the Z scores of all abnormal pixels. The Z score is calculated as Z=(X−μ0) / σ0, where X is the pixel depth value, μ0 is the median depth value of the intact capsule, and σ0 is the scaled median absolute deviation (robust standard deviation). ,in Represents the depth value in the sample;
[0126] The third statistical parameter P is the peak depth deviation of the depth anomaly region, i.e., the maximum absolute value of the Z-score of the anomaly pixel; the fourth statistical parameter D is the dispersion of the depth anomaly region. ,in, and These are the standard deviations of the horizontal and vertical coordinates of the abnormal pixels, respectively.
[0127] Then, a depth criterion is constructed based on the statistical parameters of the depth distribution characteristics, specifically by constructing a comprehensive leakage coefficient T as the depth criterion:
[0128] The first statistical parameter F is weighted using a first weighting coefficient ω1=0.35;
[0129] The second statistical parameter E, after the first normalization process, is weighted using a second weighting coefficient ω2=0.25, and the normalization function is min(E / 4,1).
[0130] The third statistical parameter P, after the second normalization process, is weighted using a third weighting coefficient ω3=0.25, and the normalization function is min(P / 6,1).
[0131] The fourth statistical parameter, after the third normalization process, is weighted using a fourth weighting coefficient ω4=0.15, and the normalization function is min(|D| / 2,1).
[0132] The weighted first statistical parameter, the weighted second statistical parameter, the weighted third statistical parameter, and the weighted fourth statistical parameter are summed to construct the comprehensive leakage coefficient T, which is calculated using the following formula:
[0133]
[0134] This algorithm can sensitively identify minute leaks by comprehensively analyzing the local depth distribution anomalies caused by internal microbubbles, providing geometric verification for suspected leak samples.
[0135] S105. Based on the preliminary judgment result and the depth criterion, determine the final leakage status judgment result of the capsule; wherein, if the preliminary judgment result is leakage, then the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is greater than the second threshold, then the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is less than or equal to the second threshold, then the final leakage status judgment result is determined to be qualified.
[0136] The system integrates the preliminary judgment result generated in step S102 and the depth criterion (i.e., the comprehensive leakage coefficient T) calculated in step S104 to generate the final judgment result.
[0137] The decision-making logic is as follows:
[0138] If the initial determination result of the capsule in step S102 is "leakage" (that is, the conditions of the first characteristic wavelength light intensity being lower than the third threshold and the second characteristic wavelength light intensity being higher than the fourth threshold are met), then regardless of the structured light detection result, the system directly determines the final leakage state of the capsule as leakage.
[0139] If the initial assessment of the capsule is "suspected leakage," a final decision needs to be made based on the results of structured light fine inspection. At this point, the calculated comprehensive leakage coefficient T is compared with a second threshold determined in advance through statistical analysis of intact samples.
[0140] like Then the final leakage status determination result is determined to be leakage; if If so, the final leakage status determination result is determined to be qualified.
[0141] This fusion strategy combines the rapid screening advantages of spectroscopy with the high-precision spatial resolution of structured light 3D measurement. While maintaining a high detection rate, it corrects potential misjudgments by spectroscopy (i.e., misclassifying qualified capsules as suspected leaks) through a structured light fine-tuning step, thus achieving a balance between high precision and high efficiency. To verify the effectiveness of this method, a test was conducted with 200 capsules in an experimental group containing 50 fish oil capsules with varying degrees of leakage and 150 intact fish oil capsules. The initial spectral detection accuracy was 83.5%, and the structured light fine-tuning accuracy was 98%. This application employs a tandem fusion strategy of "rapid spectral screening - precise structured light verification," achieving a comprehensive detection accuracy of 98.5%. The initial spectral screening stage quickly eliminates a large number of intact capsule samples, significantly reducing the burden of the time-consuming structured light detection without lowering the detection rate. Simultaneously, the structured light detection stage, with its high spatial resolution, sensitively captures air bubbles at the top, providing supplementary verification for capsules misidentified by spectroscopy.
[0142] This application also provides a transparent capsule leakage detection device, which can be used in applications such as... Figure 5 The transparent capsule leakage detection system shown includes a reflectance spectroscopy detection unit, a structured light three-dimensional measurement unit, and a transmission control unit. The device includes:
[0143] The attitude module, through the transmission control unit, adjusts the attitude of the capsule to be inspected to a preset direction;
[0144] The comparison module, when the capsule is in the preset direction, obtains the reflection spectrum of the top of the capsule by the reflection spectrum detection unit, determines the reflectance attenuation value based on the reflection spectrum, compares the reflectance attenuation value with a first threshold, and generates a preliminary judgment result of the capsule. The preliminary judgment result includes qualified, suspected leakage, or leakage.
[0145] If the preliminary judgment result is suspected leakage, the delivery module will deliver the capsule to the detection position of the structured light three-dimensional measurement unit.
[0146] The analysis module projects structured light onto the surface of the capsule located at the detection position using the structured light 3D measurement unit and acquires images. Based on the images, it reconstructs 3D point cloud data of the capsule surface, extracts depth distribution features from the 3D point cloud data, and constructs depth criteria based on the statistical parameters of the depth distribution features.
[0147] The judgment module determines the final leakage status judgment result of the capsule based on the preliminary judgment result and the depth criterion; wherein, if the preliminary judgment result is leakage, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is greater than the second threshold, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is less than or equal to the second threshold, the final leakage status judgment result is determined to be qualified.
[0148] This application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0149] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the above-described method.
[0150] The above embodiments are provided to enable those skilled in the art to understand and apply this application. Those skilled in the art will readily make various modifications to the above embodiments and apply the general principles described herein to other embodiments without inventive effort. Therefore, this application is not limited to the above embodiments, and any improvements and modifications made to this application based on the disclosure thereof should be within the scope of protection of this application.
Claims
1. A method for detecting leakage from a transparent capsule, characterized in that, An application is made in a transparent capsule leakage detection system, the transparent capsule leakage detection system comprising a reflectance spectroscopy detection unit, a structured light three-dimensional measurement unit, and a transmission control unit, the method comprising: The transmission control unit adjusts the orientation of the capsule to be inspected to a preset direction; When the capsule is in the preset direction, the reflectance spectrum detection unit acquires the reflectance spectrum of the top of the capsule, determines the reflectance attenuation value based on the reflectance spectrum, compares the reflectance attenuation value with a first threshold, and generates a preliminary judgment result of the capsule. The preliminary judgment result includes qualified, suspected leakage, or leakage. If the preliminary judgment result is suspected leakage, the delivery control unit will deliver the capsule to the detection position of the structured light three-dimensional measurement unit; The structured light 3D measurement unit projects structured light onto the surface of the capsule located at the detection position and acquires images. Based on the images, it reconstructs 3D point cloud data of the capsule surface, extracts depth distribution features from the 3D point cloud data, and constructs depth criteria based on the statistical parameters of the depth distribution features. Based on the preliminary judgment result and the depth criterion, the final leakage status judgment result of the capsule is determined; wherein, if the preliminary judgment result is leakage, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is greater than the second threshold, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is less than or equal to the second threshold, the final leakage status judgment result is determined to be qualified.
2. The method according to claim 1, characterized in that, The reflectance spectrum of the top of the capsule is acquired by the reflectance spectroscopy detection unit. A reflectance attenuation value is determined based on the reflectance spectrum. The reflectance attenuation value is compared with a first threshold to generate a preliminary judgment result for the capsule, including: Obtain the first absolute light intensity value of the reflected spectrum at the first characteristic wavelength; Obtain the second absolute light intensity value of the reflected spectrum at the second characteristic wavelength; The first absolute light intensity value is compared with the third threshold, and the second absolute light intensity value is compared with the fourth threshold; When the first absolute light intensity value is lower than the third threshold and the second absolute light intensity value is higher than the fourth threshold, the preliminary determination result of generating the capsule is leakage.
3. The method according to claim 1, characterized in that, The structured light 3D measurement unit projects structured light onto the surface of the capsule located at the detection position and acquires an image. Based on the image, it reconstructs 3D point cloud data of the capsule surface and extracts depth distribution features from the 3D point cloud data, including: Remove the point cloud data corresponding to the two ends of the capsule from the three-dimensional point cloud data to obtain the three-dimensional point cloud data of the middle region; Based on the three-dimensional point cloud data of the central region, calculate the first statistical parameter, the second statistical parameter, the third statistical parameter, and the fourth statistical parameter; The first statistical parameter is the area percentage of the deep anomaly region; The second statistical parameter is the average depth deviation of the depth anomaly region; The third statistical parameter is the peak depth deviation of the depth anomaly region; The fourth statistical parameter is the dispersion of the depth anomaly region.
4. The method according to claim 3, characterized in that, And a depth criterion is constructed based on the statistical parameters of the depth distribution characteristics, including: The first statistical parameter is weighted using the first weighting coefficient; The second statistical parameter, after the first normalization process, is weighted using a second weighting coefficient. The third statistical parameter, after the second normalization process, is weighted using a third weighting coefficient. The fourth statistical parameter, after the third normalization process, is weighted using a fourth weighting coefficient. The weighted first statistical parameter, the weighted second statistical parameter, the weighted third statistical parameter, and the weighted fourth statistical parameter are summed to construct a comprehensive leakage coefficient, which is used as the depth criterion.
5. The method according to claim 1, characterized in that, The reflectance spectrum of the top of the capsule is obtained by the reflectance spectrum detection unit, and the reflectance attenuation value is determined based on the reflectance spectrum, including: Select a specific wavelength as the characteristic wavelength; Calculate the reflectance attenuation value of the capsule at the characteristic wavelength; Based on the correlation model between reflectivity and the internal cavity of the capsule, a quantitative relationship model between the reflectivity attenuation value and the amount of liquid leakage is established.
6. The method according to claim 1, characterized in that, The structured light 3D measurement unit projects structured light onto the surface of the capsule located at the detection position and acquires an image. Based on the image, it reconstructs the 3D point cloud data of the capsule surface, including: A phase-shifted structured light pattern with multiple spatial frequencies is projected onto the surface of the capsule; Multiple phase images modulated by the surface of the capsule were acquired; Calculate the absolute phase based on the multiple phase images; Reconstruct the three-dimensional point cloud data of the capsule surface based on the absolute phase.
7. The method according to claim 1, characterized in that, The transmission control unit adjusts the orientation of the capsule to be inspected to a preset direction, including: The capsule is delivered via a guide channel with a specific geometry; By utilizing the geometric constraints of the guide channel, the long axis direction of the capsule is adjusted to a preset direction that is perpendicular to the direction of the structured light stripes projected by the structured light three-dimensional measurement unit.
8. A transparent capsule leakage detection device, characterized in that, An application is provided in a transparent capsule leakage detection system, the system comprising a reflectance spectroscopy detection unit, a structured light three-dimensional measurement unit, and a transmission control unit. The device includes: The attitude module, through the transmission control unit, adjusts the attitude of the capsule to be inspected to a preset direction; The comparison module, when the capsule is in the preset direction, obtains the reflection spectrum of the top of the capsule by the reflection spectrum detection unit, determines the reflectance attenuation value based on the reflection spectrum, compares the reflectance attenuation value with a first threshold, and generates a preliminary judgment result of the capsule. The preliminary judgment result includes qualified, suspected leakage, or leakage. If the preliminary judgment result is suspected leakage, the delivery module will deliver the capsule to the detection position of the structured light three-dimensional measurement unit. The analysis module projects structured light onto the surface of the capsule located at the detection position using the structured light 3D measurement unit and acquires images. Based on the images, it reconstructs 3D point cloud data of the capsule surface, extracts depth distribution features from the 3D point cloud data, and constructs depth criteria based on the statistical parameters of the depth distribution features. The judgment module determines the final leakage status judgment result of the capsule based on the preliminary judgment result and the depth criterion; wherein, if the preliminary judgment result is leakage, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is greater than the second threshold, the final leakage status judgment result is determined to be leakage; if the preliminary judgment result is suspected leakage and the depth criterion is less than or equal to the second threshold, the final leakage status judgment result is determined to be qualified.
9. An electronic device, characterized in that, The method includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed in a computer, causes the computer to perform the method described in any one of claims 1 to 7.