Method for sorting empty capsules by color and related device
By using a silicon-based imaging unit with visible and near-infrared channels in capsule visual inspection, images are acquired simultaneously and a moisture index is constructed. The moisture content is then inverted to compensate for color parameters, solving the problem of high false rejection and missed rejection rates in capsule visual inspection and achieving more accurate color sorting.
Patent Information
- Application Number
- CN202611257557.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-27
AI Technical Summary
Existing visual inspection solutions for capsules fail to effectively eliminate the disturbance of moisture content on the apparent color of empty capsules, resulting in high rates of false rejection and missed rejection, and failing to accurately reflect the true color differences in capsule formulations.
A silicon-based imaging unit with visible light and near-infrared channels is used to simultaneously acquire capsule images. A moisture index is constructed using the near-infrared images to invert the capsule water content. The visible light color parameters are compensated based on the water content difference to obtain the true color parameters. Finally, sorting is performed based on the true color parameters.
Without adding a dedicated moisture sensor, the disturbance of moisture content to color measurement is eliminated, improving the accuracy and consistency of sorting and significantly reducing the rate of incorrect and missed rejections.
Smart Images

Figure CN123168100A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of pharmaceutical quality testing technology, and in particular to a method and related apparatus for sorting empty capsules by color difference. Background Technology
[0002] Empty capsules are widely used in pharmaceutical packaging, and their color consistency is one of the core indicators for measuring product quality. On capsule production lines, machine vision technology is typically used for color detection and sorting. This involves using industrial cameras to capture images of capsules during transport, extracting color features, comparing them to standard colors, and determining whether a capsule is acceptable based on the color difference, thus driving a sorting mechanism to reject it. Existing capsule vision inspection solutions are relatively mature and can achieve high-speed online sorting. However, empty capsules (especially gelatin capsules) absorb moisture from the environment during storage, transportation, and filling, and their shell moisture content typically fluctuates within a certain range. Changes in moisture content alter the shell's light transmittance, surface gloss, and other optical properties, causing capsules with the same formula to appear with different colors in machine vision measurements. This apparent color drift caused by moisture content is reversible and does not represent a genuine difference in capsule formulation or manufacturing process.
[0003] The current problem is that existing capsule visual inspection solutions directly use the color measured by the camera as the true color of the capsule for color difference judgment, without considering the impact of moisture content on the apparent color. This leads to two types of misjudgments: firstly, qualified capsules whose apparent color shifts after absorbing moisture are mistakenly judged as having excessive color difference and are rejected, resulting in false rejection; secondly, because moisture content masks some of the true color deviation, unqualified capsules that should be rejected are mistakenly judged as qualified, resulting in missed rejection. Although there are existing technologies that compensate colorimeters using environmental temperature and humidity detection modules, the compensation target is environmental temperature and humidity, not the moisture content of the capsule itself. Furthermore, this is applied to the calibration of general colorimeters, which differs significantly from the online sorting scenario of capsule production lines in terms of compensation target, technical means, and application scenario. Therefore, how to eliminate the disturbance of moisture content on the apparent color measurement of capsules and obtain color difference that reflects the true differences in the formula without adding a dedicated moisture sensor or significantly changing the production line cycle time has become an urgent technical problem to be solved in the field of capsule color sorting. Summary of the Invention
[0004] This application provides a method and related apparatus for sorting empty capsules by color difference, aiming to solve the technical problems of high error rejection rate and missed rejection rate in existing capsule color sorting methods.
[0005] To solve the above-mentioned technical problems, the technical solution adopted in this application is: to provide a color difference sorting method for hollow capsules. This color difference sorting method for hollow capsules is applied to a capsule sorting system, which includes a silicon-based imaging unit, a controllable light source, a processing unit, and a sorting execution unit. The silicon-based imaging unit has a visible light channel and at least one near-infrared channel. The method includes: under the illumination of the controllable light source, simultaneously acquiring visible light and near-infrared images of the hollow capsules being transported using the silicon-based imaging unit; calculating the apparent color parameters of the hollow capsules from the visible light images; extracting moisture-related optical features from the near-infrared images to construct a moisture index, and obtaining the moisture content of the hollow capsules based on the moisture index; determining a color offset based on the difference between the moisture content and a reference moisture content; obtaining true color parameters that eliminate the influence of moisture content based on the apparent color parameters and the color offset; calculating the true color difference based on the true color parameters; and controlling the sorting execution unit to perform sorting on the hollow capsules based on the comparison result of the true color difference and a preset threshold.
[0006] In some embodiments, the step of extracting moisture-related optical features from the near-infrared band image, constructing a moisture index, and inverting the moisture content of the hollow capsule based on the moisture index includes: obtaining the near-infrared channel reflectance in the near-infrared band image and the visible light channel reflectance in the visible light band image; and constructing the moisture index based on the ratio or difference between the near-infrared channel reflectance and the visible light channel reflectance.
[0007] In some embodiments, determining the color offset based on the difference between the moisture content and the reference moisture content, and obtaining the true color parameter to eliminate the influence of moisture content based on the apparent color parameter and the color offset, includes: determining the color offset by using a preset polynomial function or a lookup table function based on the difference between the moisture content and the reference moisture content; and subtracting the color offset from the apparent color parameter to obtain the true color parameter.
[0008] In some embodiments, before subtracting the color offset from the apparent color parameter to obtain the true color parameter, the method further includes: periodically performing calibration using a standard color chart and a standard capsule with a known moisture content; updating the coefficients of the preset polynomial function or lookup table function and the inversion relationship between the moisture index and the moisture content.
[0009] In some embodiments, the method of simultaneously acquiring visible light and near-infrared images of the hollow capsule during transport using the silicon-based imaging unit includes: using a single sensor to output the visible light and near-infrared images under the same exposure or simultaneous multiple exposures, so that the calculation of the apparent color parameters and the inversion of the water content share the same optical path and the same capsule orientation.
[0010] In some embodiments, the silicon-based imaging unit has at least two near-infrared channels. The step of extracting moisture-related optical features from the near-infrared band image, constructing a moisture index, and inverting the moisture content of the hollow capsule based on the moisture index includes: fusing the reflectance of the at least two near-infrared channels with the reflectance of the visible light channel to construct the moisture index.
[0011] In some embodiments, the step of calculating the true color difference based on the true color parameters and controlling the sorting execution unit to sort the hollow capsules based on the comparison result of the true color difference and a preset threshold includes: calculating the true color difference using the International Commission on Illumination (ICI) color difference formula; determining that the hollow capsule is qualified and retaining it when the true color difference is less than or equal to a first preset threshold; determining that the hollow capsule is to be reworked when the true color difference is greater than the first preset threshold and less than or equal to a second preset threshold; and determining that the hollow capsule is unqualified and discarding it when the true color difference is greater than the second preset threshold.
[0012] To address the aforementioned technical problems, another technical solution adopted in this application is to provide a capsule sorting system. This capsule sorting system includes a silicon-based imaging unit, a controllable light source, a processing unit, and a sorting execution unit. The silicon-based imaging unit has a visible light channel and at least one near-infrared channel. The processing unit is used to execute the steps of the above-described hollow capsule color difference sorting method.
[0013] To address the aforementioned technical problems, another technical solution adopted in this application is to provide a storage medium. This storage medium stores program data, which, when executed by a processor, implements the steps of the hollow capsule color difference sorting method described above.
[0014] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer device. This computer device includes a processor and a memory, wherein a computer program is stored in the memory, and when executed by the processor, the computer program implements the steps of the above-described hollow capsule color difference sorting method.
[0015] The beneficial effects of this application are as follows: Unlike existing technologies, this application discloses a method and related apparatus for sorting hollow capsules by color difference. This application utilizes a silicon-based imaging unit with a visible light channel and at least one near-infrared channel to simultaneously acquire visible light and near-infrared images of the hollow capsules at the same acquisition time. Apparent color parameters are calculated from the visible light images, and a moisture index is constructed from the near-infrared images to obtain the capsule's own moisture content. The color shift is then determined based on the difference between the moisture content and a reference moisture content, and the apparent color parameters are compensated to obtain true color parameters that eliminate the influence of moisture content. Finally, the true color difference is calculated based on the true color parameters, and the sorting execution unit is controlled to perform sorting. This application utilizes the same silicon-based imaging unit to simultaneously perform colorimetry and moisture estimation, eliminating the need for a dedicated moisture sensor and maintaining the production line cycle time. By compensating for moisture content, it eliminates apparent color drift caused by moisture absorption, ensuring that color difference determination reflects the true differences in capsule formulations and significantly reducing false rejection and missed rejection rates. Simultaneously, the calculation of apparent color parameters and the inversion of moisture content share the same optical path and the same capsule orientation, avoiding spatial registration errors from multiple sensors and improving the consistency and accuracy of colorimetry and moisture estimation. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein: Figure 1 This is a schematic flowchart of an embodiment of the color difference sorting method for hollow capsules provided in this application; Figure 2 This is a schematic diagram of the structure of an embodiment of the capsule sorting system provided in this application; Figure 3 This is a schematic diagram of the structure of an embodiment of the storage medium provided in this application; Figure 4 This is a schematic diagram of the structure of an embodiment of the computer device provided in this application. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0018] The terms "first," "second," and "third" used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0019] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0020] This application provides a method for sorting empty capsules by color difference. (See reference) Figure 1 , Figure 1 This is a schematic flowchart of an embodiment of the hollow capsule color difference sorting method provided in this application. The hollow capsule color difference sorting method is applied to a capsule sorting system, which includes a silicon-based imaging unit, a controllable light source, a processing unit, and a sorting execution unit. The silicon-based imaging unit has a visible light channel and at least one near-infrared channel. The method includes the following steps: Step 10: Under controllable light source illumination, use a silicon-based imaging unit to simultaneously acquire visible light and near-infrared images of the hollow capsule during transport.
[0021] In this embodiment, the empty capsule refers to gelatin capsules or plant-based capsules widely used in the pharmaceutical packaging field, whose shells are made of gelatin, hydroxypropyl methyl cellulose (HPMC), or other polymeric materials. During the production process, the empty capsules need to be dyed to distinguish different specifications and uses; color consistency is a core indicator for evaluating capsule product quality. On the capsule production line, the empty capsules are conveyed through the imaging field of view in a controllable manner via a transmission and positioning mechanism. This transmission and positioning mechanism can include conveying devices such as vibrating feeders, conveyor belts, or rotary tables, allowing the capsules to pass through the imaging area of the silicon-based imaging unit in a fixed or predictable posture.
[0022] In this embodiment, the silicon-based imaging unit is an image acquisition device with a visible light channel and at least one near-infrared channel. The silicon-based imaging unit is implemented based on a silicon-based complementary metal-oxide-semiconductor (CMOS) sensor or a charge-coupled device (CCD) sensor, whose photosensitive chip can simultaneously respond to light signals in both the visible and near-infrared bands. Silicon-based sensors still exhibit good quantum efficiency (i.e., the efficiency with which the sensor converts incident photons into electrical signals) in the near-infrared band, enabling the acquisition of near-infrared information without adding a separate near-infrared detector. The visible light channel covers a wavelength range, for example, from 450 nm to 700 nm, corresponding to the red, green, and blue channels, used to acquire the apparent color information of the capsule. The near-infrared channel covers a wavelength range, for example, from 700 nm to 1100 nm, specifically selecting moisture-sensitive bands such as 850 nm or 940 nm as the center wavelength, used to acquire optical characteristics related to the water content of the capsule shell. Silicon-based imaging units achieve simultaneous acquisition of visible and near-infrared images by setting different filter channels on the sensor chip or using a beam splitter (an optical device that separates incident light into multiple beams according to wavelength or polarization direction). Specifically, visible light filter units and near-infrared filter units can be alternately arranged on the pixel array of the sensor chip, so that each pixel position corresponds to a channel of a specific wavelength band, and data of both wavelength bands can be acquired simultaneously in a single exposure; or a beam splitter can be used to split the incident light into visible light and near-infrared paths, which are then projected onto different areas of the same sensor chip to achieve simultaneous acquisition.
[0023] In this embodiment, the controllable light source is a light source device capable of providing illumination for both the visible light and near-infrared bands. The controllable light source may include a white light-emitting diode (LED) for visible light illumination and a near-infrared LED or laser for near-infrared band illumination. The luminous intensity, spectral composition, and illumination timing of the controllable light source can all be controlled and adjusted by the processing unit to ensure that both the visible light and near-infrared band images have sufficient signal-to-noise ratio (SNR). In one embodiment, the controllable light source employs a time-division illumination method, i.e., the visible light source and the near-infrared light source are illuminated at different times, and the silicon-based imaging unit acquires images of both bands accordingly. In another embodiment, the controllable light source employs a synchronous illumination method, i.e., the visible light source and the near-infrared light source are illuminated simultaneously, and the silicon-based imaging unit outputs image data of both bands simultaneously through single exposure or synchronous multi-exposure.
[0024] In this embodiment, synchronous acquisition refers to the silicon-based imaging unit simultaneously acquiring visible light and near-infrared images at the same acquisition moment or under the same capsule posture. Synchronous acquisition ensures that the images of the two bands correspond to the same capsule posture and the same optical path, avoiding spatial registration errors between the two band images caused by capsule movement or posture changes. Specific implementation methods for synchronous acquisition may include: simultaneously reading visible light and near-infrared image data through different channels on the sensor chip within the same exposure cycle, or sequentially acquiring images of the two bands at microsecond-level time intervals in a synchronous multi-exposure mode. Due to the extremely short time intervals, the capsule posture can be considered unchanged during this period. The two implementation methods of synchronous acquisition can be selected according to the hardware capabilities of the silicon-based imaging unit and the production line speed requirements. For high-speed production line scenarios, the same exposure method can be used to eliminate time differences, while for scenarios with limited hardware capabilities, a synchronous multi-exposure method can be used.
[0025] This embodiment utilizes a silicon-based imaging unit with a visible light channel and at least one near-infrared channel to simultaneously acquire visible light and near-infrared images. At the same acquisition time, it obtains both the visible light information required for colorimetry and the near-infrared information required for moisture estimation, laying a data foundation for subsequent simultaneous colorimetry and moisture estimation along the same optical path. This eliminates the need for a dedicated moisture sensor and does not alter the production line cycle time. Furthermore, simultaneous acquisition ensures that the two images correspond to the same capsule with the same orientation and optical path, eliminating errors caused by parallax and spatial registration in multi-sensor solutions from the outset, thus guaranteeing data consistency for subsequent colorimetry and moisture estimation.
[0026] Optionally, in some embodiments, a silicon-based imaging unit is used to simultaneously acquire visible light and near-infrared images of the hollow capsule during transport, including: using a single sensor to output visible light and near-infrared images under the same exposure or simultaneous multiple exposures, so that the calculation of apparent color parameters and the inversion of water content share the same optical path and the same capsule posture.
[0027] In this optional embodiment, a single sensor refers to the silicon-based imaging unit using a single CMOS sensor chip to achieve simultaneous acquisition of visible and near-infrared wavelengths. Compared with a scheme using two independent cameras (one visible light camera and one near-infrared camera), the single-sensor scheme has the following advantages: First, colorimetry and humidity estimation share the same optical path, meaning that visible and near-infrared light are imaged through the same set of lenses and the same sensor chip, eliminating parallax and spatial registration issues between the two cameras; Second, colorimetry and humidity estimation share the same capsule posture, meaning that the visible light image and the near-infrared image correspond to the same capsule at the same time and posture, eliminating temporal and spatial differences between the two image bands caused by capsule movement or posture changes.
[0028] In this optional embodiment, the same exposure mode refers to the sensor chip simultaneously acquiring visible light band image data and near-infrared band image data through different channels within a single exposure cycle. Specific implementation methods may include, for example, alternating visible light filter units and near-infrared filter units on the pixel array of the sensor chip, so that each pixel position corresponds to a channel of a specific band, allowing data from both bands to be acquired simultaneously in a single exposure. The synchronous multi-exposure mode refers to performing two exposures sequentially within an extremely short time interval (e.g., microseconds). The first exposure acquires a visible light band image, and the second exposure acquires a near-infrared band image. Due to the extremely short time interval, the displacement of the capsule during this period is negligible, and the two images can be considered to correspond to the same capsule posture.
[0029] This optional embodiment utilizes a single sensor to output visible light and near-infrared images under the same exposure or simultaneous multiple exposures. This allows the calculation of apparent color parameters and the inversion of moisture content to share the same optical path and the same capsule orientation, eliminating parallax and spatial registration errors in multi-camera schemes and improving the consistency and accuracy of color measurement and moisture estimation.
[0030] Optionally, in some embodiments, the center wavelength of the near-infrared channel is selected from at least one of 850 nm and 940 nm.
[0031] In this optional embodiment, the center wavelength of the near-infrared channel is the center wavelength of the bandpass filter (a filter device that allows light of a specific wavelength range to pass through and blocks light of other wavelengths) of the near-infrared channel in the silicon-based imaging unit. 850 nm and 940 nm correspond to the vicinity of the two absorption peaks of water molecules in the near-infrared band. Specifically, water molecules exhibit strong absorption characteristics near 940 nm and relatively weak but still detectable absorption characteristics near 850 nm. Choosing at least one of 850 nm and 940 nm as the center wavelength of the near-infrared channel allows the near-infrared channel reflectivity to be sufficiently sensitive to changes in water content.
[0032] In one embodiment of this optional embodiment, the silicon-based imaging unit has one near-infrared channel with a center wavelength of 940 nm, corresponding to the vicinity of the strongest absorption peak of water molecules, making it most sensitive to changes in moisture content. In another embodiment, the silicon-based imaging unit has two near-infrared channels with center wavelengths of 850 nm and 940 nm, respectively. By fusing the reflectivity information of the two bands, the optical response to changes in moisture content can be captured more comprehensively, improving the accuracy of moisture estimation. The specific center wavelength and number of near-infrared channels can be determined experimentally based on the type of capsule shell material (gelatin capsules or plant capsules) and the moisture content range.
[0033] This optional embodiment selects the center wavelength of the near-infrared channel from at least one of 850 nm and 940 nm, so that the near-infrared channel corresponds to the absorption peak of water molecules in the near-infrared band. This ensures the sensitivity of the near-infrared channel reflectivity to changes in water content and provides an optical basis for accurately constructing the moisture index and retrieving the water content.
[0034] Step 20: Calculate the apparent color parameters of the hollow capsule from the visible light band image; extract moisture-related optical features from the near-infrared band image, construct a moisture index, and obtain the water content of the hollow capsule based on the moisture index.
[0035] In this embodiment, the apparent color parameter refers to the capsule color parameter directly calculated from the visible light band image, which reflects the capsule color value measured by the camera under the current moisture content conditions. The apparent color parameter can be represented by three components in the CIELAB color space defined by the International Commission on Illumination (CIE): luminance component, etc. Red-green difference component Yellow-blue difference component .in, It represents the brightness or darkness of a color, with a value ranging from 0 to 100. A value of 0 indicates pure black. A value of 100 indicates pure white, the capsule's A higher value indicates a brighter appearance; This characterizes the degree of color shift in the red-green direction, with values ranging from, for example, -128 to +128. A positive value indicates a reddish tint. A negative value indicates a greenish tint. The larger the absolute value, the stronger the red-green offset; This characterizes the degree of color shift in the yellow-blue direction, with values ranging from, for example, -128 to +128. A positive value indicates a yellowish tint. A negative value indicates that the color is bluish. The larger the absolute value, the stronger the yellow-blue shift. The calculation process of apparent color parameters includes: extracting pixel values of the capsule region from the visible light band image; converting the camera's original red-green-blue (RGB) response values to CIE standard chromaticity values (i.e., tristimulus values X, Y, Z, where X represents the red primary stimulus value, Y represents the green primary stimulus value, and Z represents the blue primary stimulus value) using a color calibration matrix (a transformation matrix used to map the camera's RGB response values to the standard chromaticity space); and then calculating the values in the CIELAB color space based on the CIE standard chromaticity values. , , Components. The apparent color parameter is denoted as... It contains three components: ,in , , These represent the brightness component, red-green difference component, and yellow-blue difference component measured under the current moisture content conditions, respectively.
[0036] In this embodiment, moisture-related optical features refer to optical features extracted from near-infrared images that are correlated with the water content of the capsule shell. Since water molecules have specific absorption characteristics in the near-infrared band, especially with significant absorption peaks near 850 nm and 940 nm, changes in the water content of the capsule shell are directly reflected in changes in the reflectivity of the near-infrared channel. Specifically, when the water content of the capsule shell increases, the absorption of near-infrared light by water molecules is enhanced, leading to a decrease in the reflectivity of the near-infrared channel; conversely, when the water content decreases, the reflectivity of the near-infrared channel increases. Therefore, the reflectivity of the near-infrared channel can be used as an optical feature characterizing the water content of the capsule.
[0037] In this embodiment, the Moisture Index (MI) is an indicator used to characterize water content, constructed through mathematical operations on the reflectance of the near-infrared channel and the visible light channel. The basic idea behind constructing the Moisture Index is to utilize the difference in reflectance between the near-infrared channel (a water-sensitive band) and the visible light channel (a water-insensitive band) to eliminate interference from non-water content factors such as light source fluctuations, capsule surface curvature, and attitude changes, thereby improving the robustness of water content estimation.
[0038] In this embodiment, the moisture content of the empty capsules is obtained by inverting the moisture index, which is achieved through a pre-defined inversion relationship between the moisture index and the moisture content. This inversion relationship is denoted as... ,in Indicates moisture content, This represents the inversion function. The inversion function can be determined through calibration experiments. The specific calibration process includes: preparing a set of standard capsule samples with known moisture content gradients (e.g., moisture contents of 11%, 13%, 15%, and 17%), acquiring near-infrared and visible light images of each standard capsule under the same conditions, calculating the moisture index (MI) value of each standard capsule, establishing the correspondence between the MI value and the known moisture content, and obtaining the inversion function through polynomial fitting or table interpolation. The inversion function can be, for example, in the form of a quadratic polynomial: in, Indicates moisture content, This indicates the moisture index. , , The coefficients of the inversion function are determined by calibration experiments. The physical meaning of is the moisture content intercept when the moisture index is zero. The physical meaning of is the first-order sensitivity of the moisture index to water content. The physical meaning of is the second-order nonlinear correction of the moisture index to the water content. In another implementation, the inversion function can also be in the form of a lookup table. That is, in the calibration experiment, the water content corresponding to several discrete MI values is pre-determined to form a lookup table. During online operation, the calculated MI values are linearly interpolated in the lookup table to obtain the water content.
[0039] In this embodiment, the reference moisture content is a preset moisture content value used as a basis for color offset, denoted as . The reference moisture content corresponds to the nominal moisture content of the capsule under standard production conditions or specified in the manufacturer's standards. For example, the nominal moisture content of gelatin capsules is usually between 13% and 14%. The reference moisture content is chosen so that when the actual moisture content of the capsule equals the reference moisture content, the color deviation is zero, meaning the apparent color parameter is the true color parameter.
[0040] This embodiment calculates the apparent color parameters from visible light images and constructs a moisture index from near-infrared images to obtain the capsule's own moisture content. At the same acquisition time, the color information and moisture content information of the capsule are acquired simultaneously, providing the necessary data foundation for subsequent compensation of apparent color parameters based on moisture content. Moreover, the entire process does not require the addition of a dedicated moisture sensor.
[0041] Optionally, in some embodiments, moisture-related optical features are extracted from near-infrared images to construct a moisture index, and the water content of the hollow capsule is obtained by inversion based on the moisture index, including: obtaining the near-infrared channel reflectance in the near-infrared image and the visible light channel reflectance in the visible light image; constructing the moisture index based on the ratio or difference between the near-infrared channel reflectance and the visible light channel reflectance.
[0042] In this optional embodiment, the near-infrared channel reflectance This refers to the reflectance value of the capsule region extracted from near-infrared images. The specific extraction process includes: identifying the capsule region in the near-infrared image, which can be achieved through image processing methods such as edge detection, threshold segmentation, or deep learning object detection; statistically analyzing the pixel grayscale values within the identified capsule region and taking the average or median value as the original response value; and converting the original response value into reflectance through reflectance calibration. Reflectance calibration can be performed using a standard reflector, i.e., photographing a standard reflector with known reflectance (such as a PTFE standard white board) under the same lighting and exposure conditions, establishing a mapping relationship between pixel grayscale values and reflectance. Near-infrared channel reflectance. The value range is, for example, from 0 to 1.
[0043] In this optional embodiment, the reflectance of the visible light channel This is the reflectance value of the corresponding capsule region extracted from the visible light band image. The green channel (G channel) can be selected as the reference channel for the visible light channel because the green band is in a moisture-insensitive region, and its reflectance is less affected by water content. Visible light channel reflectance. The extraction method is similar to that of near-infrared channel reflectance, including three steps: region identification, pixel statistics, and reflectance calibration.
[0044] In this optional embodiment, the moisture index is constructed using either a ratio method or a difference method. The ratio method divides the near-infrared channel reflectance by the visible light channel reflectance to obtain the moisture index, i.e.: The moisture index is obtained by subtracting the visible light channel reflectance from the near-infrared channel reflectance using the difference method, i.e.: in, Indicates the reflectivity of the near-infrared channel. This represents the reflectance of the visible light channel. The ratio method eliminates the overall impact of light source intensity fluctuations, exposure time variations, and capsule surface curvature on reflectance through division, allowing the moisture index to primarily reflect the relative changes in reflectance between the two bands, thus more sensitively capturing moisture content information. The difference method eliminates the background reflection component shared by both channels through subtraction, is simple to calculate, and is suitable for scenarios where the reflectance baselines of the two channels are similar. The specific construction method used can be determined based on the correlation between the moisture index and moisture content in calibration experiments.
[0045] This optional embodiment constructs a moisture index by the ratio or difference between the reflectance of the near-infrared channel and the reflectance of the visible light channel. It utilizes the difference between the moisture-sensitive band and the moisture-insensitive band to eliminate the interference of non-moisture content factors, thereby improving the sensitivity and robustness of the moisture index to moisture content.
[0046] Optionally, in some embodiments, the silicon-based imaging unit has at least two near-infrared channels, extracts moisture-related optical features from near-infrared images, constructs a moisture index, and inverts the moisture content of the hollow capsule based on the moisture index, including: fusing the reflectance of at least two near-infrared channels with the reflectance of the visible light channel to construct the moisture index.
[0047] In this optional embodiment, when the silicon-based imaging unit has at least two near-infrared channels, the moisture index can be constructed by fusing the reflectance information of multiple near-infrared channels, enabling a more comprehensive capture of the optical response to changes in water content. Taking two near-infrared channels as an example, the center wavelength of the first near-infrared channel is 850 nm, and the center wavelength of the second near-infrared channel is 940 nm. The two channels correspond to the different absorption characteristics of water molecules in different wavelength bands. The fusion methods include, but are not limited to, the following three: The first fusion method is a weighted ratio method, which uses the weighted sum of the reflectance of the two near-infrared channels as the ratio of the reflectance of the visible light channel as the moisture index: The second fusion method is the weighted difference method, which uses the weighted sum of the reflectance of the two near-infrared channels and the difference between the reflectance of the visible light channel as the moisture index: The third fusion method is the normalized difference method, which uses the normalized difference between the near-infrared channel reflectance combination and the visible light channel reflectance as the moisture index: in, Indicates the reflectivity of the first near-infrared channel. Indicates the reflectivity of the second near-infrared channel. Indicates the reflectivity of the visible light channel. This indicates the fusion weight of the first near-infrared channel. This represents the fusion weight of the second near-infrared channel. The fusion weight reflects the proportion of each near-infrared channel's contribution to the moisture content sensitivity, and its value ranges, for example, from 0 to 1. The normalized difference method eliminates the influence of light source intensity fluctuations by dividing by the sum of the reflectivities of the two channels, normalizing the range of the moisture index to between -1 and 1, which facilitates comparison under different conditions.
[0048] This optional embodiment constructs a moisture index by fusing the reflectance of at least two near-infrared channels with the reflectance of a visible light channel. It fully utilizes the different absorption characteristics of water molecules in multiple near-infrared bands, improving the sensitivity of the moisture index to water content and the accuracy of moisture estimation. It is suitable for application scenarios with high requirements for moisture estimation accuracy.
[0049] Step 30: Determine the color offset based on the difference between the moisture content and the reference moisture content, and obtain the true color parameters to eliminate the influence of moisture content based on the apparent color parameters and the color offset.
[0050] In this embodiment, the color offset refers to the offset value of the apparent color parameter relative to the true color parameter caused by the difference in moisture content, denoted as The color shift is related to the moisture content. The color shift is a function of the reference moisture content. When the moisture content equals the reference moisture content, the color shift is zero. As the moisture content deviates from the reference moisture content, the color shift increases with the increase in the difference in moisture content. The color shift consists of three components, corresponding to the luminance component, red-green difference component, and yellow-blue difference component of the CIELAB color space, respectively. .
[0051] In this embodiment, the true color parameter refers to the capsule color parameter after eliminating the influence of moisture content, denoted as... The true color parameter reflects the color value of the capsule under reference moisture content conditions, that is, the color value after eliminating the disturbance of moisture content on the apparent color. The relationship between the true color parameter and the apparent color parameter is as follows: in, Represents the actual color parameters. Indicates the apparent color parameter, This represents the color offset. The physical meaning of this formula is: subtracting the color offset caused by moisture content from the apparent color parameter yields the true color parameter after eliminating the influence of moisture content.
[0052] In this embodiment, the color offset is determined using two methods: a preset polynomial function and a lookup table function. The preset polynomial function represents the color offset as a polynomial function of the difference between the moisture content and the reference moisture content. The lookup table function describes the correspondence between moisture content and color offset using a pre-established discrete data table. The specific method used can be determined based on the compensation accuracy requirements and the characteristics of the calibration data.
[0053] This embodiment determines the color offset based on the difference between the moisture content and the reference moisture content, and obtains the true color parameter by subtracting the color offset from the apparent color parameter. This eliminates the disturbance of moisture content on the apparent color, so that the obtained true color parameter reflects the true color difference of the capsule formula, providing reliable color data for subsequent accurate sorting based on the true color difference.
[0054] Optionally, in some embodiments, the color offset is determined based on the difference between the moisture content and the reference moisture content, and the true color parameter that eliminates the influence of moisture content is obtained based on the apparent color parameter and the color offset, including: determining the color offset by using a preset polynomial function or a lookup table function based on the difference between the moisture content and the reference moisture content; and subtracting the color offset from the apparent color parameter to obtain the true color parameter.
[0055] In this optional embodiment, the preset polynomial function is a mathematical model describing the mapping relationship between moisture content differences and color offset. Color offset It contains three components, corresponding to the luminance component, red-green difference component, and yellow-blue difference component of the CIELAB color space. The color offset of each component can be expressed as: in, This represents the color shift of the luminance component, caused by differences in moisture content. The offset value in the direction indicates that the capsule becomes brighter due to increased moisture content, and the offset value indicates that the capsule becomes darker due to increased moisture content. This represents the color shift of the red-green difference component, caused by differences in moisture content. The offset value in the direction indicates that the capsule is reddish due to increased moisture content, and negative values indicate that it is greenish. This represents the color shift of the yellow-blue difference component, caused by differences in moisture content. The offset value in the direction indicates that the capsule is yellowish due to increased moisture content, and negative values indicate a bluish tint. , , These represent the first-order compensation coefficients for the luminance component, the red-green difference component, and the yellow-blue difference component, respectively. , , These represent the second-order compensation coefficients for the three components, respectively. Indicates moisture content, This represents the reference moisture content. The compensation coefficients for the three components can be different, reflecting the varying degrees of influence of moisture content on brightness, red-green difference, and yellow-blue difference. The physical meaning of the compensation coefficients is as follows: the first-order compensation coefficient reflects the linear rate of influence of moisture content differences on color shift, while the second-order compensation coefficient reflects the non-linear correction of moisture content differences on color shift. A typical value for the compensation coefficient is, for example, the first-order compensation coefficient. The value ranges from -5 to 5. The value ranges from -3 to 3. The value ranges from -4 to 4, and the second-order compensation coefficient is... , , The value ranges from -2 to 2, and the specific value is determined by calibration experiments.
[0056] In this optional embodiment, a lookup table function is another way to determine the color offset. The lookup table function describes the correspondence between moisture content and color offset using a pre-established discrete data table. The specific form of the lookup table function is: using moisture content... As an index, the color offset corresponding to several discrete moisture content points is pre-measured in the calibration experiment to form a lookup table; during online operation, the color offset is determined based on the inverted moisture content. Linear interpolation or nearest neighbor lookup is performed in the lookup table to obtain the corresponding color offset. The advantage of lookup table functions is that they do not depend on a specific function form and can adapt to any non-linear relationship between moisture content and color offset.
[0057] In this optional embodiment, the specific calculation method for obtaining the true color parameter by subtracting the color offset from the apparent color parameter is as follows: , , By compensating for each of the three components separately, the differential effect of moisture content on different color channels can be eliminated more accurately.
[0058] This optional embodiment determines the color offset by using a preset polynomial function or a lookup table function, and obtains the true color parameter by subtracting the color offset from the apparent color parameter. It provides two interchangeable compensation model implementation methods, enabling the compensation model to adapt to application scenarios with different accuracy requirements and different degrees of nonlinearity, thereby improving the flexibility and applicability of the solution.
[0059] Optionally, in some embodiments, both the apparent color parameter and the true color parameter include a luminance component, a red-green difference component, and a yellow-blue difference component; subtracting the color offset from the apparent color parameter to obtain the true color parameter includes: determining the color offset based on the independent influence weights of the moisture content on the luminance component, the red-green difference component, and the yellow-blue difference component; and subtracting the corresponding color offset from each component in the apparent color parameter to obtain the true color parameter.
[0060] In this optional embodiment, both the apparent color parameter and the true color parameter are represented using the three components of the CIELAB color space: luminance component. Red-green difference component Yellow-blue difference component The influence of moisture content on the three components varies; that is, changes in moisture content generally have a greater impact on brightness than on the red-green and yellow-blue differences, and the influence of moisture content also differs among different capsule materials (gelatin capsules and plant capsules). Therefore, independent influence weights are assigned to each of the three components, and the color shift of each component is determined separately.
[0061] In this optional embodiment, the independent influence weight reflects the contribution ratio of moisture content differences to the offset of each color component. Specifically, each component of the color offset can be represented as: in, , , These represent the independent influence weights of the luminance component, the red-green difference component, and the yellow-blue difference component, respectively. Indicates the first-order compensation coefficient. Indicates the second-order compensation coefficient. Indicates moisture content, This represents the reference moisture content. The independent influence weight ranges from 0 to 2, for example. A weight greater than 1 indicates that the component is more sensitive to changes in moisture content, while a weight less than 1 indicates that the component is less sensitive to changes in moisture content. The independent influence weight is determined through calibration experiments. The specific process includes: measuring the offset of each color component under a known moisture content gradient, and calculating the ratio of each component's offset to the reference offset as the independent influence weight.
[0062] This optional embodiment determines the color shift based on the independent influence weights of moisture content on the luminance component, red-green difference component, and yellow-blue difference component, and compensates for each component separately, thereby more accurately eliminating the differential influence of moisture content on different color channels and improving the accuracy of color compensation.
[0063] Optionally, in some embodiments, before obtaining the true color parameter by subtracting the color offset from the apparent color parameter, the method further includes: periodically performing calibration using a standard color swatch and a standard capsule with a known moisture content; updating the coefficients of a preset polynomial function or lookup table function and the inverse relationship between the moisture index and the moisture content.
[0064] In this optional embodiment, calibration is a periodically performed calibration process used to suppress the drift of compensation model parameters caused by factors such as light source attenuation and sensor aging in silicon-based imaging units. Calibration includes two parts: color compensation model calibration and moisture index inversion relationship calibration.
[0065] In this optional embodiment, the color compensation model calibration is performed using a standard color swatch and standard capsules with known moisture content. The standard color swatch is a standard reflective plate (i.e., a color standard plate) with known CIELAB color parameters, such as a ceramic or enamel standard color swatch, whose color parameters have been metrologically certified. During calibration, firstly, an image of the standard color swatch is acquired using a silicon-based imaging unit to calibrate the camera's color response and eliminate the influence of light source color temperature drift and sensor response changes on color measurement; then, an image of a standard capsule with known moisture content is acquired. The moisture content of the standard capsule is pre-determined using standard methods such as Karl Fischer titration or drying and weighing. The apparent color parameters and true color parameters of the standard capsule (the true color parameters are the color values of the standard capsule at a reference moisture content) are calculated to obtain the color offset, and the coefficients of the preset polynomial function are updated accordingly. , , , , , Or update the data table for the lookup function.
[0066] In this optional embodiment, the moisture index inversion relationship calibration is performed using standard capsules with known moisture content. During calibration, near-infrared and visible light images of standard capsules with different known moisture contents are acquired, the moisture index (MI) value of each standard capsule is calculated, the correspondence between the MI value and the known moisture content is established, and the inversion function is updated through polynomial fitting or table lookup interpolation. coefficient , , Or update the inversion lookup table.
[0067] In this optional embodiment, the calibration execution frequency can be determined based on the production line runtime and stability requirements, such as once every 8 hours or once every 24 hours. The calibration process can be executed automatically, that is, the processing unit automatically controls the silicon-based imaging unit and the controllable light source to complete the calibration process when the production line is stopped or batches are changed, without the need for manual intervention.
[0068] This optional embodiment periodically uses standard color charts and standard capsules with known moisture content to perform calibration, update the compensation model coefficients and inversion relationships, suppress parameter drift caused by light source attenuation and sensor aging, ensure the long-term stability of the compensation model and inversion relationships, and enable the system to maintain accurate moisture content compensation effect even after long-term operation.
[0069] Optionally, in some embodiments, after determining the color offset based on the difference between the moisture content and the reference moisture content, and obtaining the true color parameters to eliminate the influence of moisture content based on the apparent color parameters and the color offset, the method further includes: performing defect segmentation on the visible light band image and / or the near-infrared band image to determine surface defects.
[0070] In this optional embodiment, defect segmentation refers to image segmentation processing of the visible light band image and / or near-infrared band image after obtaining the true color parameters, in order to detect whether there are defects on the capsule surface. Surface defects include, but are not limited to, cracks, bubbles, black spots, burrs, and deformations. Defect segmentation can be achieved using image processing methods such as threshold segmentation, edge detection, region growing, or deep learning semantic segmentation.
[0071] In this optional embodiment, the specific method for defect segmentation on visible light images is as follows: First, the visible light images are preprocessed (including noise reduction, contrast enhancement, etc.). Then, threshold segmentation or a deep learning model is used to identify abnormal areas on the capsule surface, extract defect features (such as defect area, shape, location, etc.), and determine the type and severity of surface defects based on the defect features. The specific method for defect segmentation on near-infrared images is as follows: Utilizing the higher sensitivity of near-infrared images to internal structural defects (such as internal bubbles, uneven wall thickness, etc.), internal defects that are difficult to detect in visible light images are detected on near-infrared images. Specifically, defect segmentation can employ threshold-based segmentation methods, edge detection-based segmentation methods, or deep learning-based semantic segmentation methods. Threshold-based segmentation methods separate defect areas from normal areas by setting a grayscale threshold, suitable for scenarios where the grayscale difference between defects and the background is significant. Deep learning-based semantic segmentation methods classify each pixel in the image by training a convolutional neural network (CNN) model, suitable for scenarios with diverse defect shapes and insignificant grayscale differences.
[0072] This optional embodiment determines surface defects by performing defect segmentation on visible light and / or near-infrared images. Based on color sorting after moisture content compensation, it further adds a defect detection function, enabling the capsule sorting system to simultaneously possess color sorting and defect detection capabilities, thereby improving the comprehensiveness of sorting.
[0073] Step 40: Calculate the true color difference based on the true color parameters, and control the sorting execution unit to sort the empty capsules based on the comparison result between the true color difference and the preset threshold.
[0074] In this embodiment, true color difference refers to the color difference between the true color parameters and the standard color parameters, denoted as . The standard color parameter is the pre-stored standard color value of capsules of this specification under reference moisture content conditions, denoted as... ,in The luminance component represents the standard color parameter. The red-green difference component representing the standard color parameters This represents the yellow-blue difference component of the standard color parameter. The true color parameter is denoted as... ,in The luminance component represents the true color parameter. The red-green difference component represents the true color parameters. This represents the yellow-blue difference component of the true color parameter. The calculation of true color difference uses color difference formulas developed by the International Commission on Illumination (CIE), including but not limited to the CIELAB color difference formula or the CIEDE2000 color difference formula. CIEDE2000 is an improved color difference formula developed by the CIE in 2000. The CIELAB color difference formula is simple and intuitive, suitable for sorting scenarios with large color differences; the CIEDE2000 color difference formula introduces weighted corrections for luminance, chromaticity, and hue, better aligning with the human eye's perception of color differences, and is suitable for scenarios requiring high accuracy in color difference determination. Taking the CIELAB color difference formula as an example, the formula for calculating true color difference is: in, Indicates true color difference. The luminance component represents the true color parameter. The red-green difference component represents the true color parameter. The yellow-blue difference component represents the true color parameter. The luminance component represents the standard color parameter. The red-green difference component represents the standard color parameter. This represents the yellow-blue difference component of the standard color parameter. The physical meaning of this formula is: the true color difference is the Euclidean distance between the true color parameter and the standard color parameter in the three dimensions of the CIELAB color space; the smaller the distance, the closer the capsule color is to the standard color.
[0075] In this embodiment, the preset threshold is a pre-set threshold value used to determine whether the color difference of the capsule is acceptable. The preset threshold includes a first preset threshold and a second preset threshold, wherein the first preset threshold is less than the second preset threshold. The first preset threshold corresponds to the acceptance threshold and is denoted as... When the actual color difference is less than or equal to the first preset threshold, the capsule is deemed qualified; the second preset threshold corresponds to the rejection threshold, denoted as... When the actual color difference exceeds the second preset threshold, the capsule is deemed unqualified. The specific values of the first and second preset thresholds are set according to the quality standards and production line requirements of the capsule products. For example, the first preset threshold can be set to a value between 1.5 and 3.0, and the second preset threshold can be set to a value between 3.0 and 5.0. The specific values can be adjusted according to the color difference tolerance range of different capsule specifications.
[0076] In this embodiment, the sorting execution unit is a device used to perform physical sorting actions on capsules based on the judgment result. The sorting execution unit may include an air-blowing rejection mechanism, a diversion and guiding mechanism, or a robotic arm sorting mechanism, etc. When the judgment result is qualified, the sorting execution unit retains the capsule and allows it to enter the qualified product channel; when the judgment result is rework, the sorting execution unit guides the capsule into the rework channel for reprocessing; when the judgment result is unqualified, the sorting execution unit rejects the capsule into the unqualified product channel. The air-blowing rejection mechanism uses high-pressure airflow to blow unqualified capsules away from the conveyor flow, offering advantages such as fast response speed and non-contact, non-destructive rejection, making it suitable for high-speed production line scenarios. The diversion and guiding mechanism uses movable baffles or guide rails to guide capsules with different judgment results into their corresponding channels, making it suitable for medium-speed production line scenarios.
[0077] This embodiment controls the sorting unit to perform sorting based on the comparison result between the actual color difference and a preset threshold. This ensures that the sorting judgment is based on the actual color difference after eliminating the influence of moisture content, avoiding false rejections and missed rejections caused by moisture content drift, and improving the accuracy and reliability of capsule color sorting. Simultaneously, the three-level sorting judgment rule provides a flexible graded processing strategy, reducing unnecessary rejection waste while ensuring product quality.
[0078] Optionally, in some embodiments, the true color difference is calculated based on the true color parameters, and the sorting execution unit is controlled to sort the hollow capsules based on the comparison result of the true color difference and a preset threshold. This includes: calculating the true color difference using the International Commission on Illumination (ICI) color difference formula; determining that the hollow capsule is qualified and retaining it when the true color difference is less than or equal to a first preset threshold; determining that the hollow capsule is to be reworked when the true color difference is greater than the first preset threshold and less than or equal to a second preset threshold; and determining that the hollow capsule is unqualified and discarded when the true color difference is greater than the second preset threshold.
[0079] In this optional embodiment, the International Commission on Illumination (ICI) color difference formulas include the CIELAB color difference formula and the CIEDE2000 color difference formula. The CIELAB color difference formula is as described in step 40 above. The CIEDE2000 color difference formula, based on the CIELAB color difference formula, introduces weighted corrections for luminance, chromaticity, and hue, as well as a rotation term, making it more consistent with the human eye's perception of color differences. The specific form of the CIEDE2000 color difference formula is as follows: in, Indicates brightness difference. Indicates color difference, Indicates hue difference, , , These represent the weighting functions for brightness, chromaticity, and hue, respectively. , , They represent parameter factors, This represents the rotation term. The specific calculation method for each parameter is determined according to the CIEDE2000 standard. Parameter factors. , , The value is usually set to 1, which is suitable for general industrial color measurement scenarios.
[0080] In this optional embodiment, the sorting judgment adopts a three-level judgment rule: qualified, reworked, and unqualified. When the actual color difference... Less than or equal to the first preset threshold When the empty capsule is deemed qualified, it is retained and allowed to enter the qualified product channel; when the actual color difference... Greater than the first preset threshold And less than or equal to the second preset threshold When an empty capsule is deemed unsuitable for rework, it is directed to the rework channel for re-inspection or processing; when the actual color difference... Greater than the second preset threshold When empty capsules are deemed unqualified, they are rejected and moved to the unqualified product channel. The three-level judgment rule adds a rework level compared to the traditional two-level judgment (qualified / unqualified), allowing capsules with color differences within the critical range to be reworked, thus avoiding waste caused by direct rejection, while ensuring that unqualified capsules do not flow into the qualified product channel.
[0081] This optional embodiment calculates the true color difference using the International Commission on Illumination's color difference formula and uses a three-level judgment rule to control the sorting execution unit to perform sorting. This makes the sorting judgment based on the true color difference after eliminating the influence of moisture content and provides a flexible graded sorting strategy, reducing unnecessary rejection waste while ensuring product quality.
[0082] Optionally, in some embodiments, after controlling the sorting execution unit to sort the empty capsules based on the comparison result of the actual color difference and the preset threshold, the method further includes: performing batch sliding statistics on the actual color difference in the sorting result; and issuing a warning signal when the average value of the actual color difference drifts beyond the preset warning threshold.
[0083] In this optional embodiment, batch sliding statistics refer to performing sliding window statistics on the actual color difference in the sorting results over a period of time, calculating the average actual color difference, and monitoring its changing trend. The length of the sliding window can be set to, for example, 50 or 100 capsules, and the sliding step size can be set to 10 capsules. Specific parameters can be adjusted according to the production line speed and monitoring sensitivity requirements. The average actual color difference reflects the overall color quality level of the batch of capsules and should normally fluctuate around the color difference value corresponding to the standard color parameters. When the average actual color difference undergoes a systematic drift (i.e., continuously deviates from the normal level) and the drift exceeds the preset warning threshold, it indicates that there may be a systematic color deviation problem in the production line (such as raw material batch differences, dyeing process parameter deviations, etc.). At this time, the processing unit sends a warning signal to the production line management system, prompting the production line management personnel to check whether there is a systematic deviation in the capsule formula or production process. The warning signal can include audible and visual alarms, production line management interface pop-ups, or SMS notifications.
[0084] This optional embodiment achieves real-time monitoring and trend warning of the color quality of the production line by performing batch sliding statistics on the actual color difference in the sorting results and issuing a warning signal when the average value drifts beyond the warning threshold. This enables production line managers to promptly detect systemic color shift problems and take corrective measures.
[0085] Optionally, in some embodiments, after controlling the sorting execution unit to sort the hollow capsules based on the comparison result of the actual color difference and the preset threshold, the method further includes: recording each sorting result and the source mold cavity number of the hollow capsule; statistically analyzing the actual color difference distribution of each mold cavity source based on the source mold cavity number; and feeding back the source information of the mold cavity with the actual color difference exceeding the tolerance to the production line system.
[0086] In this optional embodiment, the source mold cavity number refers to the mold cavity position number where the hollow capsule is formed in the production mold. Capsule production molds typically have dozens to hundreds of mold cavities, and each mold cavity produces capsules with a corresponding mold cavity number. By using a mold position reading unit to read the source mold cavity number of the capsule during the capsule conveying process and associating the mold cavity number with the actual color difference in the sorting results, a correspondence between the mold cavity number and the actual color difference can be established.
[0087] In this optional embodiment, the mold position reading unit can be implemented using a photoelectric sensor, a radio frequency identification (RFID) reader, or a visual coding recognition device. During capsule transport, the mold position reading unit reads the mold cavity number information carried by the capsule and transmits the mold cavity number to the processing unit for association with the sorting results.
[0088] In this optional embodiment, the true color difference distribution of each mold cavity source is statistically analyzed based on the source mold cavity number, which can identify the mold cavity sources with concentrated color difference deviations. The specific statistical method includes: grouping and calculating the average value, standard deviation, and deviation ratio of the true color difference by mold cavity number; marking mold cavities with deviation ratios exceeding a preset threshold as abnormal mold cavities. The source information of abnormal mold cavities is fed back to the production line system, enabling production line managers to locate the specific mold cavity for repair or replacement, thus achieving mold cavity-level root cause analysis.
[0089] This optional embodiment records the sorting results and the source mold cavity number of each empty capsule, statistically analyzes the actual color difference distribution of each mold cavity, and feeds back the source information of the mold cavities with the largest color difference to the production line system. This enables mold cavity-level color quality traceability, allowing production line managers to accurately locate the root mold cavity of the color difference and take targeted measures.
[0090] Optionally, in some embodiments, after controlling the sorting execution unit to sort the empty capsules based on the comparison result of the actual color difference and the preset threshold, the method further includes: performing a graded blowing or backing operation on the empty capsules based on the actual color difference; recording the sorting results and feeding them back into the inversion relationship between moisture index and moisture content for closed-loop updating.
[0091] In this optional embodiment, graded rejection refers to sorting capsules using different rejection forces or methods based on the magnitude of the actual color difference. For example, defective capsules are rejected quickly by strong rejection and sent to the defective product channel, reworkable capsules are rejected by light rejection and sent to the rework channel, and qualified capsules are not rejected and are allowed to fall naturally into the qualified product channel. The return operation refers to returning capsules with color differences within the critical range to the previous workstation for re-inspection or reprocessing, avoiding waste caused by direct rejection.
[0092] In this optional embodiment, recording the sorting results and feeding them back into the inversion relationship between moisture index and moisture content for closed-loop updates refers to associating the actual color difference data accumulated during the online sorting process with the corresponding moisture content data and periodically updating the inversion function. The coefficients or lookup table enable the inversion relationship to adaptively adjust to changes in moisture content characteristics between capsule batches. The specific methods of closed-loop updates include: statistically analyzing the distribution of MI values and corresponding moisture content inversion values over a period of time (e.g., a batch), comparing it with the baseline distribution during calibration, and triggering an inversion relationship update if the deviation exceeds a preset threshold, then refitting the inversion function coefficients using the accumulated data.
[0093] This optional embodiment performs graded blowing or back operations on hollow capsules based on the actual color difference, records the sorting results and feeds them back into the inversion relationship for closed-loop updates, realizing adaptive coordination between sorting execution and the inversion model, enabling the system to continuously optimize moisture estimation accuracy during operation, and improving the stability and adaptability of long-term operation.
[0094] See Figure 2 , Figure 2 This is a schematic diagram of an embodiment of the capsule sorting system provided in this application. The capsule sorting system 50 provided in this application includes a silicon-based imaging unit 51, a controllable light source 52, a processing unit 53, and a sorting execution unit 54. The silicon-based imaging unit 51 has a visible light channel and at least one near-infrared channel.
[0095] In this embodiment, the silicon-based imaging unit 51, the controllable light source 52, the processing unit 53, and the sorting execution unit 54 work collaboratively through signal and optical connections. Specifically, the processing unit 53 is communicatively connected to the silicon-based imaging unit 51, the controllable light source 52, and the sorting execution unit 54, respectively, and is used to send acquisition timing control signals to the silicon-based imaging unit 51, illumination control signals to the controllable light source 52, and sorting control signals to the sorting execution unit 54, and to receive visible light and near-infrared images output by the silicon-based imaging unit 51. The controllable light source 52 is optically connected to the silicon-based imaging unit 51. The visible and near-infrared light emitted by the controllable light source 52 illuminates the surface of the hollow capsule being transported, and the reflected light enters the photosensitive chip of the silicon-based imaging unit 51 through the lens to achieve image acquisition. The silicon-based imaging unit 51 and the sorting execution unit 54 are arranged sequentially along the capsule conveying direction in physical layout. The silicon-based imaging unit 51 is located upstream of the sorting execution unit 54, so that the capsule first passes through the imaging field of view to complete image acquisition, and then the sorting execution unit 54 performs sorting action according to the judgment result of the processing unit 53.
[0096] In this embodiment, the silicon-based imaging unit 51 is used to simultaneously acquire visible light and near-infrared images of the hollow capsule during transport under the illumination of the controllable light source 52. The specific implementation of the silicon-based imaging unit 51 is consistent with the description of step 10 in the aforementioned method embodiment, and will not be repeated here.
[0097] In this embodiment, the controllable light source 52 is used to provide illumination for the visible light and near-infrared light bands. The specific implementation of the controllable light source 52 is consistent with the description of step 10 in the aforementioned method embodiment, and will not be repeated here.
[0098] In this embodiment, the processing unit 53 is the core computing unit of the capsule sorting system, and can be implemented by a microcontroller unit (MCU), a field-programmable gate array (FPGA), a digital signal processor (DSP), or an industrial control computer, etc. Figure 1 The described method for sorting hollow capsules by color difference includes the following steps: controlling the silicon-based imaging unit 51 to simultaneously acquire visible light and near-infrared images under controllable light source 52 illumination; calculating the apparent color parameters of the hollow capsules from the visible light images; extracting moisture-related optical features from the near-infrared images, constructing a moisture index, and obtaining the moisture content of the hollow capsules based on the moisture index; determining the color offset based on the difference between the moisture content and the reference moisture content, and obtaining the true color parameters to eliminate the influence of moisture content based on the apparent color parameters and the color offset; calculating the true color difference based on the true color parameters, and controlling the sorting execution unit 54 to sort the hollow capsules based on the comparison result of the true color difference and a preset threshold.
[0099] In this embodiment, the sorting execution unit 54 is used to perform physical sorting actions on the capsules according to the determination result of the processing unit 53. The sorting execution unit 54 may include an air-blowing rejection mechanism, a diversion and guiding mechanism, or a robotic arm sorting mechanism, etc. The sorting execution unit 54 supports three levels of sorting determination: qualified retention, rework, and unqualified rejection. The air-blowing rejection mechanism blows unqualified capsules away from the conveyor flow using high-pressure airflow, which has the advantages of fast response speed and non-contact, non-destructive rejection.
[0100] In this embodiment, the capsule sorting system 50 may further include a transmission and positioning mechanism for conveying capsules and allowing them to pass through the field of view of the silicon-based imaging unit 51 in a controllable posture. The transmission and positioning mechanism may include a vibrating feeder, conveyor belt, or rotary table, etc., to ensure that the capsules pass through the imaging area of the silicon-based imaging unit 51 in a fixed or predictable posture. The conveying speed of the transmission and positioning mechanism is synchronized with the acquisition frame rate of the silicon-based imaging unit 51 to ensure that each capsule is completely captured when passing through the imaging field of view. The transmission and positioning mechanism may also include positioning clamps or guide rails to fix the posture of the capsules as they pass through the imaging field of view, preventing the capsules from flipping or shifting during transport and ensuring stable image quality acquired by the silicon-based imaging unit 51.
[0101] In this embodiment, the capsule sorting system 50 may further include a mold cavity reading unit for reading the source mold cavity number of the capsule, enabling mold cavity-level traceability. The mold cavity reading unit may employ a photoelectric sensor, a radio frequency identification (RFID) reader, or a visual coding recognition device, etc., to read the mold cavity number information carried by the capsule during capsule transport and transmit the mold cavity number to the processing unit 53 for association with the sorting results. The reading timing of the mold cavity reading unit is synchronized with the acquisition timing of the silicon-based imaging unit 51 to ensure a one-to-one correspondence between the mold cavity number and the capsule image.
[0102] In this embodiment, the processing unit 53 is also used to perform online self-calibration. When the production line is shut down or a batch is changed, the processing unit 53 automatically controls the silicon-based imaging unit 51 and the controllable light source 52 to perform the calibration process, calibrates the color response of the camera using a standard color chart, and updates the compensation model coefficients and inversion relationships using standard capsules with known moisture content, ensuring the stability of the system after long-term operation.
[0103] In this embodiment, the processing unit 53 is also used to perform batch quality monitoring. The processing unit 53 performs batch sliding statistics on the actual color difference in the sorting results. When the average actual color difference drifts beyond a preset warning threshold, a warning signal is issued, realizing real-time monitoring and trend warning of the production line's color quality. The processing unit 53 is also used to record each sorting result and the source mold cavity number of the hollow capsules, statistically analyze the actual color difference distribution of each mold cavity, and feed back the source information of mold cavities with excessive actual color differences to the production line system, realizing mold cavity-level root cause analysis. The processing unit 53 is also used to perform graded blowing or backing operations on the hollow capsules based on the actual color difference, and record the sorting results and feed them back to the inversion relationship between moisture index and water content for closed-loop updating, enabling the inversion relationship to adaptively adjust to adapt to changes in water content characteristics between capsule batches. The processing unit 53 is also used to perform defect segmentation on visible light and / or near-infrared images to determine surface defects, enabling the capsule sorting system to simultaneously possess color sorting and defect detection capabilities.
[0104] The capsule sorting system 50 of this embodiment performs the same steps as the aforementioned method embodiment through the processing unit 53, realizing capsule color difference sorting under moisture content compensation. This system utilizes the same silicon-based imaging unit 51 to simultaneously complete color measurement and moisture estimation, eliminating the need for a dedicated moisture sensor and maintaining the production line cycle time. Moisture content compensation eliminates apparent color drift caused by moisture absorption, ensuring that color difference determination reflects the true differences in capsule formulations, significantly reducing false rejection and missed rejection rates. Simultaneously, the calculation of apparent color parameters and the inversion of moisture content share the same optical path and the same capsule orientation, avoiding spatial registration errors from multiple sensors and improving the consistency and accuracy of color measurement and moisture estimation.
[0105] Optionally, in some embodiments, the capsule sorting system 50 is applied in scenarios including but not limited to the following: online color sorting in gelatin hollow capsule production lines, online color sorting in plant-based hollow capsule (such as hydroxypropyl methylcellulose capsule) production lines, color re-inspection of finished products after capsule filling, and batch color consistency sampling inspection after capsule storage and transportation. In the gelatin hollow capsule scenario, due to the significant hygroscopic properties of gelatin material, the moisture content fluctuates greatly, making the moisture content compensation effect of this application particularly prominent. In the plant-based hollow capsule scenario, although the hygroscopic properties of plant capsules differ from those of gelatin capsules, the technical solution of this application is still applicable by adjusting the compensation model coefficients and inversion relationship parameters. In the finished product color re-inspection scenario after capsule filling, changes in environmental humidity during the filling process may cause secondary fluctuations in the moisture content of the capsule shell. The moisture content compensation of this application can eliminate the impact of this fluctuation on color determination, ensuring the accuracy of the re-inspection results. In the scenario of batch color consistency inspection after capsule storage and transportation, the moisture content of capsules under different storage conditions may vary. This application uses moisture content compensation to make the inspection results reflect the true color difference of the capsule formula, avoiding misjudgment caused by differences in storage environment.
[0106] Since the system embodiments correspond to the method embodiments described above, please refer to the method embodiments described above for the description of the capsule sorting system 50 provided in this application. This application embodiment will not be described again here, but it has the same beneficial effects as the above-described empty capsule color difference sorting method.
[0107] See Figure 3 , Figure 3 This is a schematic diagram of a storage medium according to an embodiment of the present application. The storage medium 60 provided in this application stores program data 61, which, when executed by a processor, implements... Figure 1 The steps of the described method for sorting empty capsules by color difference.
[0108] In this embodiment, the storage medium 60 can be any medium capable of storing program data, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk. The program data 61 includes instruction codes for executing each step of the above-described hollow capsule color difference sorting method, including instructions for synchronously acquiring visible light and near-infrared images, calculating apparent color parameters, constructing a moisture index and inverting the water content, determining the color offset and obtaining the true color parameters, calculating the true color difference, and controlling sorting. The program data 61 also includes instructions for periodically performing calibration using a standard color chart and standard capsules with known water content, instructions for batch sliding statistics of sorting results, instructions for recording the source cavity number and statistically analyzing the true color difference distribution of each source cavity, and instructions for defect segmentation of visible light and / or near-infrared images.
[0109] The storage medium 60 in this embodiment stores program data 61, enabling the processor to implement a capsule color difference sorting method under moisture content compensation when executing. Its specific implementation and beneficial effects are the same as those in the aforementioned method embodiments, and will not be repeated here.
[0110] See Figure 4 , Figure 4 This is a schematic diagram of the structure of an embodiment of the computer device provided in this application. The computer device 70 provided in this application includes a processor 71 and a memory 72 interconnected. The memory 72 stores a computer program, which, when executed by the processor 71, implements... Figure 1 The steps of the described method for sorting empty capsules by color difference.
[0111] In this embodiment, the processor 71 may be a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a field-programmable gate array (FPGA), or other chips with data processing capabilities. The memory 72 may include volatile memory (such as RAM) and non-volatile memory (such as ROM, flash memory) for storing computer programs and data generated during operation. The processor 71 and the memory 72 are connected and communicate via a bus or other means.
[0112] In this embodiment, the computer device 70 can be an industrial control computer, an embedded computing platform, or a dedicated testing equipment host. The computer device 70 connects to the silicon-based imaging unit 51, the controllable light source 52, and the sorting execution unit 54 via its peripheral interface to achieve overall control of the capsule sorting system 50. The computer device 70 executes a computer program through the processor 71 to simultaneously acquire visible light and near-infrared images, calculate apparent color parameters, construct a moisture index and invert the moisture content, determine the color offset and obtain the true color parameters, calculate the true color difference, and control sorting. The computer device 70 can also execute a computer program through the processor 71 to achieve functions such as online self-calibration, batch quality monitoring, mold cavity traceability, and defect detection, the specific implementation of which is consistent with the aforementioned method embodiment.
[0113] The computer device 70 in this embodiment executes a computer program through the processor 71 to implement a method for sorting capsule color difference under moisture content compensation. Its specific implementation and beneficial effects are the same as those in the aforementioned method embodiment, and will not be repeated here.
[0114] Unlike existing technologies, this application discloses a method and related apparatus for sorting hollow capsules by color difference. This application utilizes a silicon-based imaging unit with a visible light channel and at least one near-infrared channel to simultaneously acquire visible light and near-infrared images of the hollow capsules at the same acquisition time. Apparent color parameters are calculated from the visible light images, and a moisture index is constructed from the near-infrared images to obtain the capsule's moisture content. The color shift is then determined based on the difference between the moisture content and a reference moisture content, and the apparent color parameters are compensated to obtain true color parameters that eliminate the influence of moisture content. Finally, the true color difference is calculated based on the true color parameters, and the sorting execution unit is controlled to perform sorting. This application utilizes the same silicon-based imaging unit to simultaneously perform colorimetry and moisture estimation, eliminating the need for a dedicated moisture sensor and maintaining the production line cycle time. By compensating for moisture content, it eliminates apparent color drift caused by moisture absorption, ensuring that color difference determination reflects the true differences in capsule formulations and significantly reducing false rejection and missed rejection rates. Simultaneously, the calculation of apparent color parameters and the inversion of moisture content share the same optical path and the same capsule orientation, avoiding spatial registration errors from multiple sensors and improving the consistency and accuracy of colorimetry and moisture estimation.
[0115] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments, storage medium embodiments, and computer device embodiments are basically similar to the method embodiments, and therefore are described more simply; relevant parts can be referred to the descriptions in the method embodiments.
[0116] It should be noted that the division of modules and steps in the above embodiments is only a logical functional division, and other division methods may be used in actual implementation. The optional implementation methods in the above embodiments can be arbitrarily combined. Without contradiction, those skilled in the art can choose appropriate combinations according to actual needs, and these combinations are all within the protection scope of this application. The numerical parameters involved in the embodiments of this application are illustrative and do not constitute a specific limitation on the protection scope of this application.
[0117] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for sorting empty capsules by color difference, characterized in that, The hollow capsule color difference sorting method is applied to a capsule sorting system, which includes a silicon-based imaging unit, a controllable light source, a processing unit, and a sorting execution unit. The silicon-based imaging unit has a visible light channel and at least one near-infrared channel. The method includes: Under the controllable light source illumination, the silicon-based imaging unit simultaneously acquires visible light and near-infrared images of the hollow capsule during transport. The apparent color parameters of the hollow capsule are calculated from the visible light band image; Moisture-related optical features are extracted from the near-infrared band image to construct a moisture index, and the moisture content of the hollow capsule is obtained by inversion based on the moisture index. The color shift is determined based on the difference between the moisture content and the reference moisture content, and the true color parameters that eliminate the influence of moisture content are obtained based on the apparent color parameters and the color shift. The true color difference is calculated based on the true color parameters, and the sorting execution unit is controlled to sort the empty capsules based on the comparison result of the true color difference and the preset threshold.
2. The method for sorting empty capsules by color difference according to claim 1, characterized in that, The step of extracting moisture-related optical features from the near-infrared image, constructing a moisture index, and retrieving the water content of the empty capsule based on the moisture index includes: Obtain the near-infrared channel reflectance in the near-infrared band image and the visible light channel reflectance in the visible light band image; The moisture index is constructed based on the ratio or difference between the near-infrared channel reflectance and the visible light channel reflectance.
3. The method for sorting empty capsules by color difference according to claim 1, characterized in that, The process of determining the color shift based on the difference between the moisture content and the reference moisture content, and obtaining the true color parameters to eliminate the influence of moisture content based on the apparent color parameters and the color shift, includes: The color offset is determined by using a preset polynomial function or a lookup table function based on the difference between the moisture content and the reference moisture content. The apparent color parameter is obtained by subtracting the color offset from the apparent color parameter.
4. The method for sorting empty capsules by color difference according to claim 3, characterized in that, Before subtracting the color offset from the apparent color parameter to obtain the true color parameter, the method further includes: Regularly perform calibration using standard color charts and standard capsules with known moisture content; Update the coefficients of the preset polynomial function or lookup table function and the inversion relationship between the moisture index and the water content.
5. The method for sorting empty capsules by color difference according to claim 1, characterized in that, The method of simultaneously acquiring visible light and near-infrared images of the hollow capsule during transport using the silicon-based imaging unit includes: By using a single sensor to output the visible light band image and the near-infrared band image under the same exposure or simultaneous multiple exposure, the calculation of the apparent color parameter and the inversion of the water content share the same optical path and the same capsule posture.
6. The method for sorting empty capsules by color difference according to claim 1, characterized in that, The silicon-based imaging unit has at least two near-infrared channels. The process of extracting moisture-related optical features from the near-infrared image, constructing a moisture index, and retrieving the water content of the hollow capsule based on the moisture index includes: The moisture index is constructed by fusing the reflectance of at least two near-infrared channels with the reflectance of the visible light channel.
7. The method for sorting empty capsules by color difference according to claim 1, characterized in that, The step of calculating the true color difference based on the true color parameters and controlling the sorting execution unit to sort the empty capsules based on the comparison result of the true color difference and a preset threshold includes: The true color difference was calculated using the International Commission on Illumination (ICI) color difference formula. When the actual color difference is less than or equal to the first preset threshold, the hollow capsule is determined to be qualified and retained; When the actual color difference is greater than the first preset threshold and less than or equal to the second preset threshold, the hollow capsule is determined to be reworked. When the actual color difference is greater than the second preset threshold, the hollow capsule is determined to be unqualified and discarded.
8. A capsule sorting system, characterized in that, The device includes a silicon-based imaging unit, a controllable light source, a processing unit, and a sorting execution unit. The silicon-based imaging unit has a visible light channel and at least one near-infrared channel. The processing unit is used to perform the steps of the hollow capsule color difference sorting method as described in any one of claims 1-7.
9. A storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, it implements the steps of the hollow capsule color difference sorting method as described in any one of claims 1 to 7.
10. A computer device, characterized in that, include: A processor and a memory, wherein the memory stores a computer program that, when executed by the processor, implements the steps of the hollow capsule color difference sorting method as described in any one of claims 1 to 7.
