A pill bottle filling control method and device based on visual integrity detection
By combining visual integrity detection and video data acquisition technologies with edge detection and Bayesian decision models, rapid identification and removal of defective drug particles were achieved, solving the problem of incomplete detection during the drug bottling process and improving the accuracy and efficiency of bottling.
Patent Information
- Application Number
- CN202210490226.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-05-06
AI Technical Summary
The incomplete defect detection during the bottling process of traditional Chinese medicine granules in the existing technology leads to low detection efficiency, affecting the accuracy and efficiency of bottling.
A visual integrity detection method is adopted, which collects video data of the drug particles through multiple video data acquisition devices, uses edge detection algorithm and Bayesian decision model to identify defects, and generates rejection instructions to control the defective drug particle rejection device to reject them. At the same time, a counting sensor is used to ensure the accuracy of the drug particle count.
It enables rapid and accurate identification and rejection of drug particles, reduces the identification error rate, and ensures the accuracy of the number of drug particles bottled.
Smart Images

Figure CN114820538B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of automatic bottling, in particular to a medicine particle bottling control method and device based on visual integrity detection. BACKGROUND
[0002] When medicine particles are packaged or bottled, the appearance of the medicine particles needs to be detected and identified for defects to ensure that the appearance structure of the medicine particles is intact. In the prior art, when the appearance integrity of the medicine particles is detected, a conveying belt is generally used, which may result in incomplete detection of defects and low detection efficiency, thereby affecting the accuracy of bottling and the efficiency of bottling. SUMMARY
[0003] The present application aims to overcome the shortcomings of the prior art, and provides a medicine particle bottling control method and device based on visual integrity detection, which realizes accurate bottling of medicine particles and rapid and accurate rejection of defective medicine particles.
[0004] To solve the above technical problems, the present application provides a medicine particle bottling control method based on visual integrity detection, which comprises the following steps:
[0005] When the medicine particles fall from the falling port to the preset area, a plurality of preset video data acquisition devices are started to acquire and process video data of the medicine particles passing through the preset area, and a plurality of medicine particle video data are obtained;
[0006] The appearance of the medicine particles is detected and identified for defects based on the plurality of medicine particle video data, and a defect detection result is obtained;
[0007] When the defect detection result indicates that the medicine particles have defects, a rejection instruction for controlling a defective medicine particle rejection device is generated;
[0008] The defective medicine particle rejection device is controlled to reject the medicine particles with defects based on the rejection instruction; and
[0009] A counting sensor arranged at the bottle opening counts the medicine particles falling into the bottle opening, and the falling port of the medicine particles is stopped when the counting sensor counts the number of medicine particles reaching the number of medicine particles to be bottled.
[0010] Optionally, when the medicine particles fall from the falling port to the preset area, the plurality of preset video data acquisition devices are started to acquire and process video data of the medicine particles passing through the preset area, which comprises the following steps:
[0011] When the medicine particles fall from the falling port, the falling time of the medicine particles from the falling port is recorded;
[0012] acquire, based on the disengagement time, a time of arrival of the medicine pellet at the preset area by using a free fall algorithm;
[0013] start a preset video data acquisition device to acquire video data of the medicine pellet when passing through the preset area based on the time of arrival;
[0014] The plurality of video data acquisition devices at least include two video data acquisition devices, wherein the two video data acquisition devices are arranged at the same height and oppositely, and the connection lines of the two video data acquisition devices pass through the falling path of the medicine pellet.
[0015] Optionally, the medicine pellet is also subjected to a rotating force when disengaging from the dropping port, so that the medicine pellet continuously rotates and changes the falling posture during falling.
[0016] Optionally, the appearance of the medicine pellet is subjected to defect detection and identification processing based on the plurality of medicine pellet video data, and a defect detection result is obtained, including:
[0017] The plurality of medicine pellet video data is subjected to frame processing according to the frame frequency of the plurality of video data acquisition devices during video data acquisition, and video frame data of the plurality of medicine pellet video data is obtained.
[0018] Each frame of the video frame data of the plurality of medicine pellet video data is subjected to medicine pellet image extraction processing, and medicine pellet image data of each frame is obtained.
[0019] The posture of each frame of the medicine pellet image data is identified, and posture data of each frame of the medicine pellet image data is obtained.
[0020] Each frame of the medicine pellet image data is subjected to defect detection and identification processing according to the corresponding posture data, and a defect detection and identification result is obtained.
[0021] Optionally, the medicine pellet image extraction processing of each frame of the video frame data of the plurality of medicine pellet video data includes:
[0022] Each frame of the video frame data of the plurality of medicine pellet video data is subjected to pixel contour extraction processing by using Sobel edge detection algorithm, Laplace edge detection algorithm and Canny edge detection algorithm in sequence, and first medicine pellet contour information, second medicine pellet contour information and third medicine pellet contour information are obtained in sequence.
[0023] The first medicine pellet contour information, the second medicine pellet contour information and the third medicine pellet contour information are subjected to fusion processing based on a preset weighted fusion ratio, and fused medicine pellet contour information is obtained.
[0024] Based on the fusion medicine particle wheel contour information, medicine particle image extraction processing is performed on each frame of video frame data of the plurality of medicine particle video data, and medicine particle image data of each frame is obtained.
[0025] Optionally, the posture recognition processing on the medicine particle image data of each frame obtains posture data of the medicine particle image data of each frame, and includes:
[0026] Similarity calculation is performed on the current posture information of the medicine particle image data of each frame and the posture data in the posture database, and the posture with the highest similarity is selected as the posture data of the medicine particle image data of each frame based on the similarity calculation result.
[0027] Optionally, the defect detection and recognition processing on the medicine particle image data of each frame according to the corresponding posture data obtains a defect detection and recognition result, and includes:
[0028] Medicine particle pixel matrix construction processing is performed on the medicine particle image data of each frame according to pixel values, and a medicine particle pixel matrix is obtained.
[0029] Based on the medicine particle pixel matrix and the retained medicine particle pixel matrix of the medicine particle image data of each frame according to the corresponding posture data, matrix element matching is performed to form a decision matching score matrix.
[0030] Based on the decision matching score matrix, a defect detection decision processing is performed using a Bayesian decision model to form a defect detection decision result.
[0031] Based on the defect detection decision result, defect detection and recognition processing is performed.
[0032] Optionally, the control of the defect medicine particle rejection device based on the rejection instruction to reject the medicine particles with defects includes:
[0033] The defect medicine particle rejection device analyzes the rejection instruction and obtains the arrival time of the defect medicine particle packaged in the rejection instruction to the defect medicine particle rejection device;
[0034] The defect medicine particle rejection device makes a control response before the arrival time based on the rejection instruction, and sets the rejection baffle of the defect medicine particle rejection device to be inclined on the defect medicine particle falling path in a preset manner;
[0035] And based on the rejection baffle, the falling direction of the defect medicine particle is changed for rejection processing;
[0036] At the same time, the defect medicine particle rejection device controls the rejection baffle to retract based on impact data, and the rejection baffle is provided with an impact sensor for collecting impact data of the defect medicine particle impacting the rejection baffle.
[0037] Optionally, after the control of the medicine particle dropping port stops the medicine particle dropping, the method further comprises:
[0038] The medicine bottle is moved out of the bottle filling position when the bottle filling quantity of the medicine particles reaches a preset quantity, and a new empty medicine bottle is moved in, and the counting quantity of the counting sensor is cleared, and the medicine particle dropping port is controlled to perform the medicine particle dropping operation again.
[0039] In addition, the embodiment of the present application further provides a medicine particle bottle filling control device based on visual integrity detection, which comprises:
[0040] a video acquisition module: when the medicine particles drop from the dropping port to a preset area, a plurality of preset video data acquisition devices are started to perform video data acquisition processing on the medicine particles passing through the preset area, and a plurality of medicine particle video data are obtained;
[0041] a defect detection module: based on the plurality of medicine particle video data, appearance defect detection and identification processing is performed on the medicine particles, and a defect detection result is obtained;
[0042] an instruction generation module: when the defect detection result indicates that the medicine particles have defects, a rejection instruction for controlling a defective medicine particle rejection device is generated;
[0043] a defect rejection module: based on the rejection instruction, the defective medicine particle rejection device is controlled to perform rejection processing on the medicine particles with defects; and
[0044] a bottle filling control module: based on a counting sensor arranged at the bottle mouth, counting processing is performed on the medicine particles falling into the bottle mouth, and when the counting quantity of the counting sensor reaches a bottle filling quantity, the medicine particle dropping port is controlled to stop the medicine particle dropping.
[0045] In the embodiment of the present application, video data acquisition is performed on the falling medicine particles, defect identification is performed based on the acquired video data, and a rejection device is controlled to reject the medicine particles with defects according to whether the medicine particles have defects, so that the falling medicine particles can be quickly identified for defects, the error rate of the identification can be controlled within an acceptable range, and fast rejection can be achieved; and the counting sensor arranged at the bottle mouth can achieve the accuracy of the bottle filling quantity of the medicine particles; thus, the accurate bottle filling quantity of the medicine particles can be achieved, and the defective medicine particles can be quickly and accurately rejected. BRIEF DESCRIPTION OF DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0047] Figure 1 is a flowchart of a pill bottle filling control method based on visual integrity detection in an embodiment of the present application.
[0048] Figure 2 is a structural composition diagram of a pill bottle filling control device based on visual integrity detection in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments only constitute some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0050] Embodiment one
[0051] Please refer to Figure 1 , Figure 1 is a flowchart of a pill bottle filling control method based on visual integrity detection in an embodiment of the present application.
[0052] As Figure 1 shown, a pill bottle filling control method based on visual integrity detection comprises:
[0053] S11: when the pills fall into the preset area from the pill separation and falling port, a plurality of preset video data acquisition devices are started to perform video data acquisition and processing on the pills passing through the preset area, and a plurality of pill video data are obtained;
[0054] In the implementation of the present application, when the drug particles fall into the preset area, the preset video data acquisition devices are started to collect video data of the drug particles passing through the preset area, which includes: recording the disengagement time of the drug particle disengagement drop port when the drug particles disengage and fall; based on the disengagement time, the arrival time of the drug particles reaching the preset area is obtained by using the free fall algorithm; based on the arrival time, the preset multiple video data acquisition devices are started to collect video data when the drug particles pass through the preset area; the multiple video data acquisition devices include at least two video data acquisition devices, wherein the two video data acquisition devices are arranged at the same height and are oppositely arranged, and the connection lines of the two video data acquisition devices pass through the drug particle drop path.
[0055] Further, when the drug particles disengage and fall, a rotating force is applied to the drug particles to continuously rotate and change the falling posture of the drug particles.
[0056] Specifically, in order to realize 360-degree video data acquisition of the free-falling drug particles, multiple video data acquisition devices are needed, that is, at least two video data acquisition devices are needed, and the two video data acquisition devices are arranged at the same height and oppositely arranged, and the connection lines of the two video data acquisition devices pass through the drug particle drop path; and the video acquisition angle width of the two video data acquisition devices can cover the drug particle drop to the preset area.
[0057] Meanwhile, a sensor is arranged on the drug particle drop port to identify whether the drug particle disengages from the drop port, and records the disengagement time of the drug particle disengaging from the drop port when disengaging. Since the drug particles fall downward in the form of free fall after disengaging from the drop port, the arrival time of the drug particles reaching the preset area can be calculated and processed. In the embodiment of the present application, the free fall algorithm is used for calculation, and the leaving time of the drug particles from the preset area can also be calculated. Through the built-in controller, the preset multiple video data acquisition devices are started to collect video data of the drug particles passing through the preset area according to the arrival time; and when the drug particles leave the preset area, the video acquisition is stopped, so that multiple drug particle video data can be obtained.
[0058] Meanwhile, when the drug particles disengage and fall, a rotating force needs to be applied to the drug particles to continuously rotate and change the falling posture of the drug particles, so that the angles of the video data collected by the multiple video data acquisition devices during video data collection are more comprehensive, and the detection results of the subsequent appearance defect detection of the drug particles are more comprehensive and accurate.
[0059] S12: performing defect detection and identification processing on the appearance of the drug pellets based on the plurality of drug pellet video data, and obtaining a defect detection result;
[0060] In the implementation of the present application, the defect detection and identification processing on the appearance of the drug pellets based on the plurality of drug pellet video data, and obtaining a defect detection result, comprises: performing frame processing on the plurality of drug pellet video data according to the frame frequency of the plurality of video data acquisition devices during video data acquisition, to obtain video frame data of the plurality of drug pellet video data; performing drug pellet image extraction processing on each frame of the video frame data of the plurality of drug pellet video data, to obtain drug pellet image data of each frame; performing posture identification processing on the drug pellet image data of each frame, to obtain posture data of the drug pellet image data of each frame; and performing defect detection and identification processing on the drug pellet image data of each frame according to the corresponding posture data, to obtain a defect detection and identification result.
[0061] Further, the drug pellet image extraction processing on each frame of the video frame data of the plurality of drug pellet video data, to obtain drug pellet image data of each frame, comprises: sequentially performing pixel contour extraction processing on each frame of the video frame data of the plurality of drug pellet video data using Sobel edge detection algorithm, Laplacian edge detection algorithm and Canny edge detection algorithm, to sequentially obtain first drug pellet contour information, second drug pellet contour information and third drug pellet contour information; performing fusion processing on the first drug pellet contour information, the second drug pellet contour information and the third drug pellet contour information based on a preset weighted fusion ratio, to obtain fused drug pellet contour information; and performing drug pellet image extraction processing on each frame of the video frame data of the plurality of drug pellet video data based on the fused drug pellet contour information, to obtain drug pellet image data of each frame.
[0062] Further, the posture identification processing on the drug pellet image data of each frame, to obtain posture data of the drug pellet image data of each frame, comprises: performing similarity calculation on the current posture information of the drug pellet image data of each frame and the posture data in the posture database, and selecting the posture with the highest similarity as the posture data of the drug pellet image data of each frame based on the similarity calculation result.
[0063] Further, the defect detection and recognition processing of each frame of the drug particle image data according to the corresponding attitude data obtains a defect detection and recognition result, including: performing drug particle pixel matrix construction processing on each frame of the drug particle image data according to the pixel value, to obtain a drug particle pixel matrix; performing matrix element matching based on the drug particle pixel matrix and the retained drug particle pixel matrix of each frame of the drug particle image data according to the corresponding attitude data, to form a decision matching score matrix; performing defect detection decision processing based on the decision matching score matrix using a Bayesian decision model, to form a defect detection decision result; and performing defect detection and recognition processing based on the defect detection decision result.
[0064] Specifically, first, the collected multiple drug particle video data needs to be frame-processed, that is, the frame frequency of the video data collection by the multiple video data collection devices is used to frame-process the multiple drug particle video data, so that the video frame data of the multiple drug particle video data can be obtained.
[0065] Each frame of the video frame data of the multiple drug particle video data needs to be subjected to drug particle image extraction processing. In this application, the contour information of the drug particle image in each frame is obtained by contour extraction, and the drug particle image data of each frame is extracted by the contour information of the drug particle image of each frame. Since each edge detection algorithm for contour extraction has certain advantages and disadvantages, that is, a single contour extraction algorithm has some noise and cannot accurately extract accurate contour information, so multiple edge detection algorithms are used to determine the final contour information. Therefore, the Sobel edge detection algorithm, the Laplace edge detection algorithm and the Canny edge detection algorithm are sequentially used to perform pixel contour extraction processing on each frame of the video frame data of the multiple drug particle video data, to sequentially obtain first drug particle contour information, second drug particle contour information and third drug particle contour information. Then, the first drug particle contour information, the second drug particle contour information and the third drug particle contour information are fused according to a preset weighted fusion ratio to obtain fused drug particle contour information. Finally, the drug particle image extraction processing is performed on each frame of the video frame data of the multiple drug particle video data by the fused drug particle contour information, so that the drug particle image data of each frame can be obtained. Since the Sobel edge detection algorithm and the Canny edge detection algorithm have high detection and recognition degree in edge detection, but the Laplace edge detection algorithm is an auxiliary edge detection algorithm, therefore, the preset weighted fusion ratio is set as 0.4 for the first drug particle contour information, 0.2 for the second drug particle contour information and 0.4 for the third drug particle contour information, and the setting ratio can be adjusted according to the subsequent user's demand.
[0066] In the present application, a posture database is constructed, and the posture database stores the images of the medicine particles in various postures; in this case, the similarity of the current posture information of each frame of medicine particle image data and the posture data in the posture database is calculated, and the highest similarity is selected as the posture data of each frame of medicine particle image data according to the similarity calculation result; in the present application, a three-dimensional coordinate system is constructed, the medicine particle image data is placed in the coordinate system, the center pixel of the medicine particle in the medicine particle image data is determined, the angle data formed between the center pixel and the surrounding key points (including the surrounding corner points, straight line center points, etc.) in the coordinate system is calculated, then the similarity calculation matching is performed by using the angle data and the corresponding angle data of the posture data in the posture database, and then the highest similarity is selected as the posture data of each frame of medicine particle image data according to the similarity calculation result.
[0067] First, the Bayesian decision model is used to perform defect detection and identification processing on each frame of medicine particle image data according to the corresponding posture data, and the defect detection and identification result is obtained.
[0068] That is, first, the medicine particle image data of each frame is processed according to the pixel value to form a medicine particle pixel matrix; then the corresponding posture data of the medicine particle image data is matched in the retention database to obtain the corresponding retention medicine particle pixel matrix; the matrix element matching is performed by using the medicine particle pixel matrix and the retention medicine particle pixel matrix to form a decision matching score matrix; then the Bayesian decision model is used to perform defect detection decision processing according to the decision matching score matrix, and the defect detection decision result is obtained; finally, the defect detection and identification processing is performed according to the defect detection decision result.
[0069] S13: when the defect detection result is that the medicine particle has a defect, a rejection instruction for controlling the defective medicine particle rejection device is generated;
[0070] In the specific implementation process of the present application, when the defect detection result is that the medicine particle has a defect, the distance between the defective medicine particle rejection device and the medicine particle drop opening is obtained, the distance is a pre-set distance, then the time for the medicine particle to fall from the drop opening to the defective medicine particle rejection device is calculated by using the free fall algorithm according to the distance, and a rejection instruction for controlling the defective medicine particle rejection device is generated, and the time for the medicine particle to fall from the drop opening to the defective medicine particle rejection device is encapsulated in the rejection instruction.
[0071] S14: based on the rejection instruction, the defective medicine particle rejection device is controlled to perform rejection processing on the medicine particle with a defect;
[0072] In the implementation of the present application, the rejection instruction controls the defective medicine particle rejection device to reject the defective medicine particles, comprising: the defective medicine particle rejection device analyzes the rejection instruction and obtains the arrival time of the defective medicine particles reaching the defective medicine particle rejection device encapsulated in the rejection instruction; the defective medicine particle rejection device makes a control response before the arrival time based on the rejection instruction, and sets the rejection baffle of the defective medicine particle rejection device to be inclined on the falling path of the defective medicine particles in a preset manner; and based on the rejection baffle, the falling direction of the defective medicine particles is changed for rejection processing; at the same time, the defective medicine particle rejection device controls the rejection baffle to retract based on the impact data, and the rejection baffle is provided with an impact sensor for collecting impact data of the defective medicine particles impacting the rejection baffle.
[0073] Specifically, after the defective medicine particle rejection device receives the rejection instruction, the rejection instruction is analyzed, and the arrival time of the defective medicine particles reaching the defective medicine particle rejection device encapsulated in the rejection instruction is obtained; then the defective medicine particle rejection device makes a control response before the arrival time according to the rejection instruction, and controls the rejection baffle built in the defective medicine particle rejection device to be inclined on the falling path of the defective medicine particles in a preset manner; the falling direction of the defective medicine particles is changed through the rejection baffle, so that it cannot fall into the medicine bottle according to the original route; the rejection of the defective medicine bottle is realized; at the same time, the defective medicine particle rejection device controls the rejection baffle to retract through impact data control, and the rejection baffle is provided with an impact sensor; when the impact sensor collects impact data, the rejection baffle is controlled to retract, so that it will not block the falling channel of the next falling medicine particle; the impact sensor is used to collect impact data of the defective medicine particles impacting the rejection baffle.
[0074] S15: Counting the medicine particles falling into the bottle mouth based on the counting sensor arranged at the bottle mouth, and stopping the medicine particle falling port when the counting number of the counting sensor reaches the bottle filling number.
[0075] In the implementation of the present application, after the control of the medicine particle falling port stopping the medicine particle falling, it further comprises: moving the medicine bottle filled with the medicine particles to the bottle filling position, and moving the new empty medicine bottle into the bottle filling position, at the same time, the counting number of the counting sensor is cleared, and the medicine particle falling port is controlled to perform the medicine particle falling operation again.
[0076] Specifically, a counting sensor is arranged above the bottle mouth of the medicine bottle, the medicine particles falling from the bottle mouth are counted by the counting sensor, and the medicine particle falling port is controlled to stop the medicine particle falling when the counting number of the counting sensor reaches the bottle filling number; at the same time, after that, the medicine bottle filled with the medicine particles reaching the bottle filling number is moved out of the bottle filling position, and a new empty medicine bottle is moved in, and the counting number of the counting sensor is cleared, and then the medicine particle falling port is controlled to perform the medicine particle falling operation again.
[0077] In the embodiment of the present application, the video data of the falling medicine particles is collected, the defects of the medicine particles are identified through the collected video data, and the defective medicine particles are removed by the removing device according to whether the medicine particles have defects, so that whether the falling medicine particles have defects can be quickly identified, the error rate of identification can be controlled within an acceptable range, and fast removal is realized; at the same time, the counting sensor arranged at the bottle mouth can realize the accuracy of the bottle filling number of the medicine particles; in this way, the accurate number of the medicine particles can be filled in the bottle, and the defective medicine particles can be quickly and accurately removed.
[0078] Embodiment two
[0079] Please refer to Figure 2 , Figure 2 is a structure composition schematic diagram of the medicine particle bottle filling control device based on visual integrity detection in the embodiment of the present application.
[0080] As Figure 2 shown, a medicine particle bottle filling control device based on visual integrity detection, the device comprises:
[0081] The video collection module 21 is used for starting a plurality of preset video data collection devices to collect video data of the medicine particles passing through the preset area when the medicine particles fall from the falling port to the preset area, and obtaining a plurality of medicine particle video data.
[0082] In the specific implementation process of the present application, when the medicine particles fall from the falling port to the preset area, starting a plurality of preset video data collection devices to collect video data of the medicine particles passing through the preset area, including: recording the falling time of the medicine particles falling from the falling port; based on the falling time, using a free fall algorithm to obtain the arrival time of the medicine particles to the preset area; based on the arrival time, starting a plurality of preset video data collection devices to collect video data of the medicine particles passing through the preset area; the plurality of video data collection devices at least include two video data collection devices, wherein the two video data collection devices are arranged at the same height and are oppositely arranged, and the connecting lines of the two video data collection devices pass through the falling path of the medicine particles.
[0083] Further, the drug particle is also applied with a rotating force when it is separated from the falling port, so that the drug particle rotates continuously to change the falling posture when it falls.
[0084] Specifically, in order to realize 360-degree video data collection of the free-falling drug particle, a plurality of video data collection devices are arranged, that is, at least two video data collection devices are arranged, and the two video data collection devices are arranged at the same height and are oppositely arranged, and the connection lines of the two video data collection devices pass through the falling path of the drug particle, and the video collection angle width of the two video data collection devices can cover the falling of the drug particle to the preset area.
[0085] Meanwhile, a sensor is arranged on the drug particle falling port, which is used to identify whether the drug particle is separated from the falling port, and record the separation time of the drug particle from the falling port when it is separated. Since the drug particle falls in a free-falling manner after it is separated from the falling port, the arrival time of the drug particle when it falls to the preset area can be calculated and processed. In the embodiment of the present application, the free-falling algorithm is used for calculation, and the leaving time of the drug particle from the preset area can also be calculated. The preset video data collection devices are started by the built-in controller according to the arrival time to collect video data of the drug particle when it passes through the preset area. When the drug particle leaves the preset area, the video collection is stopped, and thus the video data of the plurality of drug particles can be obtained.
[0086] Meanwhile, a rotating force is applied to the drug particle when it is separated from the falling port, so that the drug particle rotates continuously to change the falling posture when it falls. In this way, when the plurality of video data collection devices collect video data, the angle of the collected video data is more comprehensive, so that the detection result of the appearance defect of the drug particle is more comprehensive and accurate.
[0087] The defect detection module 22 is used for defect detection and identification processing of the appearance of the drug particle based on the plurality of drug particle video data, and obtains a defect detection result.
[0088] In the specific implementation process of the present application, the defect detection and identification processing of the appearance of the drug particle based on the plurality of drug particle video data, and the defect detection result, includes: frame processing of the plurality of drug particle video data according to the frame frequency of the plurality of video data collection devices when video data is collected, to obtain video frame data of the plurality of drug particle video data; drug particle image extraction processing of each frame of the video frame data of the plurality of drug particle video data, to obtain drug particle image data of each frame; posture recognition processing of the drug particle image data of each frame, to obtain posture data of the drug particle image data of each frame; and defect detection and identification processing of the drug particle image data of each frame according to the corresponding posture data, to obtain a defect detection and identification result.
[0089] Further, the pill image extraction processing on each frame of the video frame data of the plurality of pill video data to obtain pill image data of each frame comprises: sequentially performing pixel contour extraction processing on each frame of the video frame data of the plurality of pill video data by using a Sobel edge detection algorithm, a Laplace edge detection algorithm and a Canny edge detection algorithm to sequentially obtain first pill contour information, second pill contour information and third pill contour information; performing fusion processing on the first pill contour information, the second pill contour information and the third pill contour information based on a preset weighted fusion ratio to obtain fused pill contour information; performing pill image extraction processing on each frame of the video frame data of the plurality of pill video data based on the fused pill contour information to obtain pill image data of each frame.
[0090] Further, the posture recognition processing on the pill image data of each frame to obtain posture data of the pill image data of each frame comprises: performing similarity calculation on current posture information of the pill image data of each frame and posture data in a posture database, and selecting the posture with the highest similarity as the posture data of the pill image data of each frame based on the similarity calculation result.
[0091] Further, the defect detection and recognition processing on the pill image data of each frame according to the corresponding posture data to obtain a defect detection and recognition result comprises: performing pill pixel matrix construction processing on the pill image data of each frame according to pixel values to obtain a pill pixel matrix; performing matrix element matching based on the pill pixel matrix and a retained pill pixel matrix of the pill image data of each frame according to the corresponding posture data to form a decision matching score matrix; performing defect detection decision processing based on the decision matching score matrix by using a Bayesian decision model to form a defect detection decision result; and performing defect detection and recognition processing based on the defect detection decision result.
[0092] Specifically, first, the plurality of pill video data collected needs to be frame-processed, that is, the frame frequency of the video data collection by using a plurality of video data collection devices is used to frame-process the plurality of pill video data, so that the video frame data of the plurality of pill video data can be obtained.
[0093] The video frame data of the plurality of drug particle video data needs to be subjected to drug particle image extraction processing. In the present application, the contour information of the drug particle image in each frame is obtained by contour extraction, and the drug particle image data of each frame is extracted by the contour information of the drug particle image of each frame. Since each edge detection algorithm for contour extraction has certain advantages and disadvantages, i.e. some noise exists in a single contour extraction algorithm, and the accurate contour information cannot be accurately extracted, the final contour information is determined by a plurality of edge detection algorithms. Therefore, the Sobel edge detection algorithm, the Laplace edge detection algorithm and the Canny edge detection algorithm are sequentially used for pixel contour extraction processing of each frame of the video frame data of the plurality of drug particle video data, and the first drug particle contour information, the second drug particle contour information and the third drug particle contour information are sequentially obtained. Then, the first drug particle contour information, the second drug particle contour information and the third drug particle contour information are fused according to a preset weighted fusion ratio to obtain fused drug particle contour information. Finally, the drug particle image extraction processing is performed on each frame of the video frame data of the plurality of drug particle video data by using the fused drug particle contour information, i.e. the drug particle image data of each frame is obtained. Since the Sobel edge detection algorithm and the Canny edge detection algorithm have high detection recognition degree in edge detection, but the Laplace edge detection algorithm is an auxiliary edge detection algorithm, therefore, the preset weighted fusion ratio is set as 0.4 for the first drug particle contour information, 0.2 for the second drug particle contour information and 0.4 for the third drug particle contour information, and the setting ratio can be adjusted according to the subsequent user's demand.
[0094] In the present application, a posture database is constructed, and the drug particle images of the drug particles in various postures are stored in the posture database. In this case, the similarity of the current posture information of each frame of drug particle image data and the posture data in the posture database is calculated, and the posture data with the highest similarity is selected as the posture data of each frame of drug particle image data according to the similarity calculation result. In the present application, a three-dimensional coordinate system is constructed, the drug particle image data is placed in the coordinate system, the center pixel of the drug particle in the drug particle image data is determined, the angle data formed between the center pixel and the surrounding key points (including the surrounding corner points, straight line center points, etc.) in the coordinate system is calculated, and then the similarity calculation matching is performed by using the angle data and the corresponding angle data of the posture data in the posture database. Then, the posture data with the highest similarity is selected as the posture data of each frame of drug particle image data according to the similarity calculation result.
[0095] Firstly, the Bayesian decision model is used to perform defect detection and recognition processing on each frame of drug particle image data according to the corresponding posture data, and the defect detection and recognition result is obtained.
[0096] That is, first, the number of drug particle images of each frame is processed according to the pixel value to form a drug particle pixel matrix; then, the corresponding drug particle pixel matrix in the retention database is matched according to the corresponding attitude data of the drug particle image data of each frame; thus, the matrix element matching of the drug particle pixel matrix and the retention drug particle pixel matrix is performed to form a decision matching score matrix; then, the defect detection decision processing is performed according to the decision matching score matrix using the Bayesian decision model, and a defect detection decision result is formed; finally, the defect detection recognition processing can be performed according to the defect detection decision result.
[0097] The instruction generation module 23 is configured to generate a rejection instruction for controlling the defective drug particle rejection device when the defect detection result indicates that the drug particle has defects.
[0098] In the specific implementation of the present application, when the defect detection result indicates that the drug particle has defects, the distance between the defective drug particle rejection device and the drug particle drop opening is obtained, which is a pre-set distance, and then the time for the drug particle to fall from the drop opening to the defective drug particle rejection device is calculated using the free fall algorithm, and a rejection instruction for controlling the defective drug particle rejection device is generated, and the time for the drug particle to fall from the drop opening to the defective drug particle rejection device is encapsulated in the rejection instruction.
[0099] The defect rejection module 24 is configured to control the defective drug particle rejection device to perform rejection processing on the defective drug particle based on the rejection instruction.
[0100] In the specific implementation of the present application, the rejection instruction controls the defective drug particle rejection device to perform rejection processing on the defective drug particle, which includes: the defective drug particle rejection device analyzes the rejection instruction and obtains the arrival time of the defective drug particle to the defective drug particle rejection device encapsulated in the rejection instruction; the defective drug particle rejection device makes a control response before the arrival time based on the rejection instruction, and sets the rejection baffle of the defective drug particle rejection device to be inclined on the defective drug particle drop path in a pre-set manner; and based on the rejection baffle, the drop direction of the defective drug particle is changed to perform rejection processing; at the same time, the defective drug particle rejection device controls the rejection baffle to retract based on the impact data, and the rejection baffle is provided with an impact sensor for collecting impact data of the defective drug particle impacting the rejection baffle.
[0101] Specifically, after the defective pill removing device receives the removing instruction, the removing instruction is parsed, and the arrival time of the defective pill encapsulated in the removing instruction to the defective pill removing device is obtained; then the defective pill removing device makes a control response before the arrival time according to the removing instruction, and controls the removing baffle built in the defective pill removing device to be tilted and arranged on the dropping path of the defective pill in a preset manner; the dropping direction of the defective pill is changed through the removing baffle, so that the defective pill cannot drop into the pill bottle according to the original route; the defective pill bottle is removed; meanwhile, the defective pill removing device controls the removing baffle to retract through impact data control, and the impact sensor is arranged on the removing baffle; when the impact data is collected by the impact sensor, the removing baffle is controlled to retract, so that it will not block the dropping channel of the next dropping pill; the impact sensor is used to collect the impact data of the defective pill impacting the removing baffle.
[0102] The bottle filling control module 25 is used for counting the pills dropping into the bottle mouth based on the counting sensor arranged on the bottle mouth, and stopping the pills from dropping into the pill dropping mouth when the counting number of the counting sensor reaches the bottle filling number.
[0103] In the specific implementation process of the present application, after the pill dropping mouth is controlled to stop the pills from dropping, the pill bottle filled with the pills is removed from the bottle filling position, a new empty pill bottle is moved into the bottle filling position, the counting number of the counting sensor is cleared, and the pill dropping mouth is controlled to drop the pills again.
[0104] Specifically, a counting sensor is arranged above the bottle mouth of the pill bottle, the pills dropping into the bottle mouth are counted by the counting sensor, and the pill dropping mouth is controlled to stop the pills from dropping when the counting number of the counting sensor reaches the bottle filling number; meanwhile, the pill bottle filled with the pills is removed from the bottle filling position, a new empty pill bottle is moved into the bottle filling position, the counting number of the counting sensor is cleared, and the pill dropping mouth is controlled to drop the pills again.
[0105] In the embodiment of the present application, the dropped pills are collected through video data, the video data is used for defect identification, and the defective pills are removed by the removing device according to whether the pills have defects, so that the defects of the dropped pills can be quickly identified, the error rate of the identification can be controlled within an acceptable range, and the defective pills can be quickly removed; meanwhile, the counting sensor arranged on the bottle mouth can ensure the accuracy of the bottle filling number of the pills, so that the pills can be accurately filled in the bottle, and the defective pills can be quickly and accurately removed.
[0106] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiments of the various methods can be completed by instructing the relevant hardware with a program, and the program can be stored in a computer readable storage medium, which can include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0107] In addition, the above detailed description is provided for the method and device for controlling the pill bottle based on the visual integrity detection, and the principle and implementation of the present application are described by using specific examples. The above description of the embodiments is only used to help understand the method and the core idea of the present application. Meanwhile, for those skilled in the art, the specific implementation and application range can be changed according to the idea of the present application. In summary, the content of the description should not be understood as a limitation of the present application.
Claims
1. A method for controlling the bottling of pharmaceutical granules based on visual integrity detection, characterized in that, The method includes: When the drug pellet falls from the drop point into the preset area, multiple preset video data acquisition devices are activated to collect and process video data of the drug pellet as it passes through the preset area, thereby obtaining multiple video data of the drug pellet. Based on the video data of the multiple drug particles, defect detection and identification processing is performed on the appearance of the drug particles, and defect detection results are obtained; And when the defect detection result indicates that the drug particle has a defect, a rejection command is generated to control the defective drug particle rejection device; Based on the rejection command, the defective drug particle rejection device is controlled to reject defective drug particles; simultaneously... The counting sensor installed at the bottle opening counts the number of pills falling into the bottle, and when the count reaches the bottle filling quantity, the system controls the pill dropping point to stop the pills from falling. The step of performing defect detection and identification processing on the appearance of the drug particles based on the multiple drug particle video data, and obtaining defect detection results, includes: The multiple drug particle video data are processed by dividing the video data into frames according to the frame frequency of the multiple video data acquisition devices during video data acquisition, to obtain video frame data of the multiple drug particle video data. Each frame of the video frame data of the multiple drug particle video data is processed to extract drug particle images to obtain drug particle image data for each frame. The pose recognition process is performed on each frame of the drug image data to obtain the pose data of each frame of the drug image data. The Bayesian decision model is used to perform defect detection and recognition processing on each frame of the drug particle image data according to the corresponding pose data, and the defect detection and recognition results are obtained. The step of extracting drug image data from each frame of the video frame data of the plurality of drug particle video data to obtain drug particle image data for each frame includes: The Sobel edge detection algorithm, the Laplacian edge detection algorithm, and the Canny edge detection algorithm are used sequentially to extract pixel contours from each frame of the video frame data of the multiple drug particle video data, thereby obtaining the first drug particle contour information, the second drug particle contour information, and the third drug particle contour information. Based on a preset weighted fusion ratio, the first particle outline information, the second particle outline information, and the third particle outline information are fused to obtain fused particle outline information. Based on the fused particle contour information, particle image extraction processing is performed on each frame of the video frame data of the multiple particle video data to obtain particle image data for each frame.
2. The method for controlling the bottling of pharmaceutical granules according to claim 1, characterized in that, When the drug pellet falls from the drop point into the preset area, multiple preset video data acquisition devices are activated to collect and process video data of the drug pellet passing through the preset area, including: When the drug droplet detaches from the drop outlet, the detachment time of the drug droplet is recorded; The arrival time of the drug particle to the preset area is obtained based on the detachment time using a free fall algorithm. Based on the arrival time, multiple preset video data acquisition devices are activated to collect and process video data as the drug granules pass through the preset area; The plurality of video data acquisition devices includes at least two video data acquisition devices, wherein the two video data acquisition devices are set at the same height and are positioned opposite each other, and the line connecting the two video data acquisition devices passes through the path of the falling drug pellets.
3. The method for controlling the bottling of pharmaceutical granules according to claim 2, characterized in that, The process further includes applying a rotational force to the drug pellet as it detaches from the drop point, causing the pellet to rotate continuously and change its dropping posture as it falls.
4. The method for controlling the bottling of pharmaceutical granules according to claim 1, characterized in that, The process of performing pose recognition processing on each frame of the drug image data to obtain pose data for each frame of the drug image data includes: The current pose information of each frame of the drug image data is compared with the pose data in the pose database. Based on the similarity calculation results, the pose data with the highest pose similarity is selected as the pose data of each frame of the drug image data.
5. The method for controlling the bottling of pharmaceutical granules according to claim 1, characterized in that, The process of using a Bayesian decision model to perform defect detection and identification on each frame of the drug particle image data according to the corresponding pose data, and obtaining the defect detection and identification results, includes: For each frame of the drug image, the number of drug particles is processed according to the pixel value to construct a drug particle pixel matrix, thus obtaining the drug particle pixel matrix; Based on the aforementioned drug pixel matrix and the drug image data of each frame, the retained drug pixel matrix according to the corresponding posture data is matched with matrix elements to form a decision matching score matrix. Based on the decision matching score matrix, a Bayesian decision model is used to perform defect detection decision processing to form defect detection decision results. Defect detection and identification processing is performed based on the defect detection decision results.
6. The method for controlling the bottling of pharmaceutical granules according to claim 1, characterized in that, The defective drug particle rejection device controlled by the rejection command performs rejection processing on defective drug particles, including: The defective drug particle rejection device parses the rejection instruction and obtains the arrival time of the defective drug particle encapsulated in the rejection instruction to the defective drug particle rejection device; The defective drug particle rejection device makes a control response before the arrival time based on the rejection command, and tilts the rejection baffle of the defective drug particle rejection device in a preset manner on the falling path of the defective drug particle. The defective particles are removed by changing their falling direction based on the removal baffle. Meanwhile, the defective drug particle rejection device controls the rejection baffle to retract based on impact data. The rejection baffle is equipped with an impact sensor, which is used to collect impact data of the defective drug particle hitting the rejection baffle.
7. The method for controlling the bottling of pharmaceutical granules according to claim 1, characterized in that, After controlling the droplet to stop the droplet from falling, the method further includes: The bottle containing the full amount of medicine is moved out of the bottling position and replaced with a new empty bottle. At the same time, the count of the counting sensor is reset to zero, and the medicine drop outlet is controlled to start the medicine drop operation again.
8. A granule bottling control device based on visual integrity detection, characterized in that, The device includes: Video acquisition module: used to activate multiple preset video data acquisition devices to collect and process video data of the drug as it falls into the preset area after detaching from the drop outlet, thereby obtaining video data of multiple drug particles; Defect detection module: used to perform defect detection and identification processing on the appearance of the drug particles based on the multiple drug particle video data, and to obtain defect detection results; Instruction generation module: used to generate a rejection instruction for controlling the defective drug particle rejection device when the defect detection result indicates that the drug particle has a defect; Defect rejection module: used to control the defective drug particle rejection device to reject defective drug particles based on the rejection command; simultaneously, Bottling control module: used to count the number of pills falling into the bottle mouth based on a counting sensor installed at the bottle mouth, and to control the pill dropping outlet to stop the pills from falling when the count of the counting sensor reaches the bottling quantity. The step of performing defect detection and identification processing on the appearance of the drug particles based on the multiple drug particle video data, and obtaining defect detection results, includes: The multiple drug particle video data are processed by dividing the video data into frames according to the frame frequency of the multiple video data acquisition devices during video data acquisition, to obtain video frame data of the multiple drug particle video data. Each frame of the video frame data of the multiple drug particle video data is processed to extract drug particle images to obtain drug particle image data for each frame. The pose recognition process is performed on each frame of the drug image data to obtain the pose data of each frame of the drug image data. The Bayesian decision model is used to perform defect detection and recognition processing on each frame of the drug particle image data according to the corresponding pose data, and the defect detection and recognition results are obtained. The step of extracting drug image data from each frame of the video frame data of the plurality of drug particle video data to obtain drug particle image data for each frame includes: The Sobel edge detection algorithm, the Laplacian edge detection algorithm, and the Canny edge detection algorithm are used sequentially to extract pixel contours from each frame of the video frame data of the multiple drug particle video data, thereby obtaining the first drug particle contour information, the second drug particle contour information, and the third drug particle contour information. Based on a preset weighted fusion ratio, the first particle outline information, the second particle outline information, and the third particle outline information are fused to obtain fused particle outline information. Based on the fused particle contour information, particle image extraction processing is performed on each frame of the video frame data of the multiple particle video data to obtain particle image data for each frame.
Citation Information
Patent Citations
Equipment and method for detecting drugs
CN109675835A