CN108545265A - A kind of tablet capsule counting device and its method based on machine vision - Google Patents
A kind of tablet capsule counting device and its method based on machine vision Download PDFInfo
- Publication number
- CN108545265A CN108545265A CN201810636247.0A CN201810636247A CN108545265A CN 108545265 A CN108545265 A CN 108545265A CN 201810636247 A CN201810636247 A CN 201810636247A CN 108545265 A CN108545265 A CN 108545265A
- Authority
- CN
- China
- Prior art keywords
- image
- tablet
- ccd camera
- capsules
- bulk material
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 239000002775 capsule Substances 0.000 title claims abstract description 147
- 238000000034 method Methods 0.000 title claims abstract description 24
- 239000013590 bulk material Substances 0.000 claims abstract description 53
- 238000012545 processing Methods 0.000 claims abstract description 43
- 238000003672 processing method Methods 0.000 claims abstract description 17
- 230000000694 effects Effects 0.000 claims abstract description 6
- 239000000463 material Substances 0.000 claims description 12
- 238000003708 edge detection Methods 0.000 claims description 11
- 238000001914 filtration Methods 0.000 claims description 10
- 238000003709 image segmentation Methods 0.000 claims description 6
- 238000000605 extraction Methods 0.000 claims description 5
- 238000004806 packaging method and process Methods 0.000 claims description 4
- 238000007781 pre-processing Methods 0.000 claims description 3
- 238000012216 screening Methods 0.000 claims description 3
- 230000011218 segmentation Effects 0.000 claims description 3
- 239000000843 powder Substances 0.000 claims 2
- 238000013461 design Methods 0.000 abstract description 3
- 230000009711 regulatory function Effects 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 2
- 239000003814 drug Substances 0.000 description 2
- 229940079593 drug Drugs 0.000 description 2
- 239000000853 adhesive Substances 0.000 description 1
- 230000001070 adhesive effect Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Classifications
-
- B—PERFORMING OPERATIONS; TRANSPORTING
- B65—CONVEYING; PACKING; STORING; HANDLING THIN OR FILAMENTARY MATERIAL
- B65B—MACHINES, APPARATUS OR DEVICES FOR, OR METHODS OF, PACKAGING ARTICLES OR MATERIALS; UNPACKING
- B65B57/00—Automatic control, checking, warning, or safety devices
- B65B57/20—Applications of counting devices for controlling the feed of articles
Landscapes
- Engineering & Computer Science (AREA)
- Mechanical Engineering (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a kind of tablet capsule counting device and its method based on machine vision, including CCD camera mechanism;The present invention is using can height up and down position and can the front and back CCD camera mechanism for adjusting horizontal position, by tilt adjustment mechanism to the regulatory function at the angle of inclination of bulk material plate, further through vibrating mechanism to the effect of vibration of bulk material plate, so that the arrangement of several tablet capsules is contained in the slot bottom of W type grooves and is formed the tablet capsule queue of several rows of queue shape, the quality for the true color image for collecting tablet capsule is substantially increased;Using MATLAB tools, image procossing is carried out to the true color image of tablet capsule by image processing method, and exact number counting is carried out to tablet capsule according to processing result image, substantially increase the accuracy and working efficiency of tablet capsule count;And the device global design is reasonable, compact-sized, takes full advantage of limited plane and spatial position, and cost is relatively low, is suitble to promote and apply.
Description
Technical Field
The invention relates to a counting device, in particular to a tablet and capsule counting device and method based on machine vision.
Background
Aiming at the problem that pharmaceutical manufacturers need to manually shovel the capsule to take the tablet capsule and manually count the number of the shoveled tablet capsule in the process of packaging the tablet capsule, and then complete the boxing and packaging of the tablet capsule, the counting is not accurate, the labor intensity of workers is greatly increased, and the working efficiency is greatly reduced.
In hospitals, pharmacies and other places applied to the pharmaceutical industry, medical staff need to classify and repackage tablet capsules of various medicines into small packages according to a certain quantity according to requirements, and due to the fact that the types of medicines are more and the medical staff are extremely limited, if the tablet capsules are poured out by one tablet and one tablet, the tablet capsules are classified again, the workload of the medical staff is huge, the working efficiency is extremely low, and the mode of counting the tablet capsules manually is extremely easy to count wrong quantities, so that unnecessary loss is brought to the hospitals, pharmacies or users who purchase the tablet capsules.
Disclosure of Invention
The invention solves the technical problem of overcoming the defects of the prior art and provides a tablet capsule counting device based on machine vision, which adopts a CCD camera mechanism capable of adjusting the height position up and down and the horizontal position back and forth to acquire true color images of tablet capsules.
In order to solve the technical problem, the invention is solved by the following technical scheme:
a tablet capsule counting device based on machine vision comprises a case, a bulk cargo mechanism which is fixedly arranged in the case and used for containing tablet capsules, a CCD camera mechanism which is fixedly arranged above the case, an upper computer module which is connected with the CCD camera mechanism, and a display screen which is connected with the upper computer module, wherein the top of the case is provided with a window which is right opposite to the CCD camera mechanism above, the bulk cargo mechanism comprises a bulk cargo plate which is obliquely and fixedly arranged below the window through an inclination adjusting mechanism, the bulk cargo plate is provided with a plurality of W-shaped grooves, and a plurality of tablet capsules are arranged and contained in the bottoms of the W-shaped grooves to form a row of regularly arranged tablet capsule queues; the CCD camera mechanism comprises an industrial CCD camera which can adjust the height position up and down or adjust the horizontal position back and forth, and the industrial CCD camera is fixedly arranged above the case and is opposite to a window below the case; the method comprises the steps that an industrial CCD camera is used for shooting a row of tablet capsule queues which are regularly arranged in a queue form and formed in the groove bottom of a W-shaped groove to obtain original true color images, the industrial CCD camera transmits the collected original true color images to an upper computer module, the upper computer module adopts an MATLAB tool and carries out image processing on the original true color images through an image processing method, a plurality of tablet capsules in the original true color images are counted according to an image processing result to obtain the number of the tablet capsules in the groove bottom of the W-shaped groove, and the number of the tablet capsules is displayed on a display screen. The front side of the bulk material plate is fixedly arranged in the chassis, and the rear side of the bulk material plate is driven to ascend or descend by an inclination adjusting mechanism; the upper computer module is arranged in the upper computer, and the display screen can be arranged on the case and also on the upper computer; the combined structure of the CCD camera mechanism capable of adjusting the height position up and down and the horizontal position back and forth is adopted, a plurality of tablet capsules are arranged and accommodated in the bottom of the W-shaped groove through the position adjusting function of the CCD camera mechanism and the inclination angle adjusting function of the inclination adjusting mechanism to the material scattering plate, and a row of tablet capsule queue is formed through the material scattering mechanism, so that the quality of the acquired true color image of the tablet capsules is greatly improved; an MATLAB tool is adopted to perform image processing on the true color images of the tablet capsules by an image processing method, and the accurate number counting of the tablet capsules is performed according to the image processing result, so that the accuracy and the working efficiency of the tablet capsule counting are greatly improved; the device has reasonable integral design and compact structure, fully utilizes the limited plane and space position and has lower cost.
Preferably, the inclination adjusting mechanism adjusts the inclination angle between the bulk cargo plate and the horizontal plane within 15-30 degrees. When a plurality of tablet capsules are put into the bulk material plate, the bulk material plate in an inclined state of 15-30 degrees enables the tablet capsules to automatically slide into the bottom of the W-shaped groove along the inclined wall surface of the bulk material plate under the combined action of self-weight action and inertia action, so that the stacking of the tablet capsules is avoided, the number of adhesion nodes among the tablet capsules is reduced, the difficulty in counting the tablet capsules by a subsequent image processing method is reduced, the working efficiency is improved, the accuracy of the number of the tablet capsules in an original true color image obtained by subsequent industrial CCD camera shooting is ensured, and the accuracy of the number of the tablet capsules is ensured by processing the original true color image and counting by the image processing method; if the inclined included angle degree is lower than 15-30 degrees, the slope of the inclined wall surface of the bulk material plate is not high enough, so that the tablet capsules are difficult to automatically slide into the bottom of the W-shaped groove along the inclined wall surface of the bulk material plate under the combined action of the self-weight action and the inertia action, and a plurality of tablet capsules to be counted are difficult to accurately and effectively fed into the bottom of the W-shaped groove of the bulk material plate, so that the working efficiency is reduced, and the accuracy of the number of the tablet capsules in an original true-color image acquired by the camera of an industrial CCD camera is influenced; if the inclined included angle degree is higher than 15-30 degrees, the tablet capsules sliding into the bottom of the W-shaped groove may fall out of the bottom of the W-shaped groove again, so that it is difficult to accurately and effectively feed a plurality of tablet capsules to be counted into the bottom of the W-shaped groove of the material scattering plate, thereby reducing the working efficiency and influencing the accuracy of the number of the tablet capsules in the original true-color image obtained by the subsequent industrial CCD camera.
Preferably, the inclination adjusting mechanism comprises an ejector rod and a screw rod which is rotatably and fixedly arranged at the bottom end of the ejector rod and drives the ejector rod to move up and down, and the top end of the ejector rod is fixedly arranged at the bottom of the rear side of the material scattering plate. The lead screw is rotated by external force, the lead screw simultaneously drives the ejector rod to move upwards or downwards, the ejector rod moving upwards or downwards simultaneously drives the rear side of the bulk material plate to ascend or descend, so that the bulk material plate is in a front-low and back-high state, and the inclined included angle between the bulk material plate and the horizontal plane is 15-30 degrees, namely, when the included angle between the bulk material plate and the horizontal plane is lower than 15-30 degrees, the lead screw is rotated by external force simultaneously drives the ejector rod to move upwards, and the rear side of the bulk material plate is ascended relative to the front side until the included angle reaches 15-30 degrees; when the included angle between the material scattering plate and the horizontal plane is higher than 15-30 degrees, the screw rod is rotated by external force, and the ejector rod is driven to move downwards at the same time, so that the rear side of the material scattering plate descends relative to the front side until the included angle reaches 15-30 degrees.
Preferably, the tablet packaging machine further comprises a strip-shaped light source fixedly arranged on two sides of the bulk material plate respectively, the two strip-shaped light sources oppositely arranged emit light to the bulk material plate simultaneously and illuminate a row of regularly arranged tablet capsule arrays formed in the groove bottom of the W-shaped groove, and the image quality and the shooting efficiency of an original true color image obtained by shooting and collecting tablet capsules by an industrial CCD camera are improved.
Preferably, the vibrating mechanism is used for vibrating the bulk material plate and comprises a vibrating shaft and a motor for driving the vibrating shaft to generate vibration, the top end of the vibrating shaft is fixedly arranged at the center of the bottom of the bulk material plate, and the motor is fixedly arranged at the bottom end of the vibrating shaft. Wherein the motor is supported in the chassis; the vibrating mechanism formed by combining the motor and the vibrating shaft vibrates the inclined bulk cargo plate, so that the tablet capsules can automatically slide into the bottom of the W-shaped groove along the inclined wall surface of the bulk cargo plate under the combined action of self-weight action and inertia action, the possibility of stacking among the tablet capsules is further reduced, the possibility of increasing the number of adhesion nodes among the tablet capsules is further reduced, and the difficulty in counting the tablet capsules by a subsequent image processing method is further reduced; if the vibration effect of the vibration mechanism on the bulk cargo plate is lacked, some tablet capsules are easily attached to the wall of the W-shaped groove and are adhered to the tablet capsules in the groove bottom of the W-shaped groove, so that at least two of the three tablet capsules are adhered to form three adhesive nodes of the three tablet capsules, more nodes are required to be processed in image segmentation in the subsequent image processing process, the difficulty in counting the tablet capsules through an image processing method in the subsequent process is greatly increased, and large deviation or errors occur in counting the number of the tablet capsules after the image segmentation, so that the counting is not accurate, and the processing efficiency is also reduced; or stacking of additional tablet capsules on top of a tablet capsule in the bottom of the W-shaped groove, also greatly increases the difficulty and deviation or error of subsequent counting of the tablet capsules by image processing methods.
Preferably, the CCD camera mechanism further comprises a support rod fixedly arranged at the rear side of the case, a connecting block fixedly arranged on the support rod and capable of adjusting the height position up and down or adjusting the horizontal position back and forth, a camera clamp fixedly connected to the connecting block and extending towards the window direction, an upper fine adjustment knob and a lower fine adjustment knob and a front fine adjustment knob which are rotatably arranged between the connecting block and the support rod through threaded holes, and the industrial CCD camera is fixedly arranged in the camera clamp through a fastening knob; the upper fine adjustment knob and the lower fine adjustment knob are rotated through the threaded holes, so that the camera clamp and the industrial CCD camera are driven to move up and down while the connecting block moves up and down along the supporting rod; the front and back fine adjustment knob is rotated through the threaded hole, so that the camera clamp and the industrial CCD camera are driven to move back and forth while the connecting block moves back and forth along the supporting rod. The combination setting of fine setting knob and front and back fine setting knob from top to bottom has realized the high position of industry CCD camera and the regulation of position around for can adjust the position of making a video recording of industry CCD camera according to the tablet capsule queue of the form regular spread of arranging of a row of formation in the tank bottom of W type slot and the distance of industry CCD camera respectively in vertical direction and horizontal direction, thereby make industry CCD camera can make a video recording gather and obtain the original true colour image of highest definition. The combined structure of the supporting rod, the connecting block and the camera clamp improves the firmness and the stability of the industrial CCD camera in the vertical height position adjustment, the front-back horizontal position adjustment and the camera shooting working process.
Preferably, the front side and the rear side of the bulk material plate are fixedly provided with a baffle respectively, so that the tablet capsules are prevented from sliding down or falling out of the bulk material plate.
Preferably, the inclination adjusting mechanism further comprises a hand-operated handle or an electric handle which is rotatably and fixedly arranged on the screw rod and drives the screw rod to rotate. The hand-cranking handle is convenient for manual operation; the electric handle realizes automatic operation, and saves labor.
A tablet capsule counting method based on machine vision, comprising the steps of:
step I: firstly, a screw rod is rotated by a hand-operated handle, the screw rod simultaneously drives a mandril to move upwards or downwards, the mandril moving upwards or downwards simultaneously drives the rear side of a bulk material plate to ascend or descend, so that the bulk material plate is in a front-low and back-high state, and the inclined included angle between the bulk material plate and the horizontal plane is 15-30 degrees; putting a plurality of tablet capsules to be counted into the bulk material plate, starting a motor, driving a vibration shaft by the motor to vibrate the bulk material plate, and sliding the tablet capsules into the W-shaped grooves under the vibration action until a row of tablet capsule queues in a queue form are formed in the bottom of each W-shaped groove;
step II: then two oppositely arranged strip-shaped light sources are turned on simultaneously, the two oppositely arranged strip-shaped light sources emit light to the bulk material plate simultaneously and illuminate a row of tablet capsule queues in a line form formed in the bottom of the W-shaped groove;
step III: and then starting the industrial CCD camera, shooting a row of illuminated tablet capsule queues in a queue form by the industrial CCD camera to obtain original true color images, transmitting the acquired original true color images to the upper computer module by the industrial CCD camera, carrying out image processing on the original true color images by the upper computer module by adopting an MATLAB tool and an image processing method, carrying out statistical counting on a plurality of tablet capsules in the original true color images according to image processing results to obtain the number of the tablet capsules in the groove bottom of the W-shaped groove, and displaying the number of the tablet capsules on a display screen.
Preferably, the image processing method in step iii includes the steps of:
the method comprises the following steps: reading an original true color image by adopting an MATLAB tool;
step two: image preprocessing: the method comprises the following specific steps:
A. image graying treatment: calculating a Gray level of each pixel point by using a Gray (i, j) function with R, G, B as a weight according to a component of each pixel point R, G, B in the original true color image, so as to convert the original true color image into a Gray level image, wherein Gray (i, j) is 0.299 × R (i, j) +0.587 × G (i, j) +0.114 × B (i, j), Gray (i, j) is a Gray level of the Gray level image at i, j, R (i, j) is a red brightness value of the original true color image at i, j, G (i, j) is a green brightness value of the original true color image at i, j, and B (i, j) is a blue brightness value of the original true color image at i, j;
B. and (3) image filtering processing: d, performing median filtering processing on the gray level image obtained through the processing in the step A by adopting a median filtering algorithm to obtain a gray level image with noise information removed;
C. image binarization processing: b, performing image segmentation processing on the gray image with the noise information removed obtained in the step B by adopting a binarization threshold segmentation method and an f (x) function, comparing the gray value of each pixel point in the gray image with an optimal threshold T one by one, and if the gray value of the pixel point is less than the optimal threshold T, then performing image segmentation processing on the pixel pointThe gray value of (2) is set to be black, and the area formed by each pixel point with black gray value is marked as a background; if the gray value of the pixel point is not less than the optimal threshold value T, setting the gray value of the pixel point to be white, and marking a white communicating block formed by the pixel points with the white gray values as an image of the tablet capsule; wherein,t is an optimal threshold; the image binarization processing in the step C is to substantially corrode the image at the image adhesion part between every two tablet capsules in the gray level image, and the corroded image adhesion part is integrated with the black background, so that the images of every two adhered tablet capsules are divided, and the divided image of each tablet capsule forms a white communicating block, thereby ensuring the image processing efficiency and the counting accuracy of the image edge detection, the contour feature extraction and the statistical counting of the image processed in the step C;
step three: image edge detection and contour feature extraction: c, performing image edge detection on the image of each tablet capsule in the gray level image obtained in the step C by adopting a Rober edge detection algorithm, and extracting the edge of the image of each tablet capsule to obtain a gray level image containing the contour feature of the image of each tablet capsule;
step four: counting: screening white communicating blocks under a black background through an MATLAB tool and counting the number of regions outputting the white communicating blocks, so that the number of the white communicating blocks is obtained through statistics, and the number of tablet capsules is obtained through statistics.
Due to the adoption of the technical scheme, the invention has the remarkable technical effects that: the CCD camera mechanism capable of adjusting the height position up and down and the horizontal position back and forth is adopted, the inclination angle of the bulk material plate is adjusted by the inclination adjusting mechanism, and the bulk material plate is vibrated by the vibrating mechanism, so that a plurality of tablet capsules are arranged and accommodated in the groove bottom of the W-shaped groove to form a row of tablet capsule queues in a queue shape, and the quality of the acquired true color images of the tablet capsules is greatly improved; an MATLAB tool is adopted to perform image processing on the true color images of the tablet capsules by an image processing method, and the accurate number counting of the tablet capsules is performed according to the image processing result, so that the accuracy and the working efficiency of the tablet capsule counting are greatly improved; the device has reasonable integral design and compact structure, fully utilizes limited planes and space positions, has lower cost and is suitable for popularization and application.
Drawings
Fig. 1 is a schematic structural diagram of an embodiment of a tablet capsule counting device based on machine vision according to the present invention.
Fig. 2 is a partial structural schematic view of an embodiment of the tablet capsule queue of the invention in which a plurality of tablet capsules to be counted are accommodated in the bottom of the W-shaped groove of the bulk material plate and are regularly arranged in a row.
FIG. 3 is a schematic structural diagram of an assembly embodiment among the vibration mechanism, the material scattering plate and the inclination adjusting mechanism of the present invention.
Fig. 4 is an original true color image obtained by shooting and collecting a regular tablet capsule array which is accommodated in the groove bottom of the W-shaped groove and forms an array by an industrial CCD camera.
Fig. 5 is a grayscale image obtained by performing image graying processing on the original true color image of fig. 4 through step a of step two.
Fig. 6 is a grayscale image obtained after the grayscale image of fig. 5 is subjected to image filtering processing by step B of step two.
Fig. 7 is a monochrome image obtained after the image binarization processing is performed on the grayscale image of fig. 6 through step C of step two.
Fig. 8 is a monochrome image obtained after the image edge detection and contour feature extraction processing is performed on the monochrome image of fig. 7 through step three.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
A tablet capsule counting device based on machine vision is disclosed, as shown in figures 1-3, and comprises a case 15, a bulk cargo mechanism fixedly arranged in the case 15 and used for containing tablet capsules 16, a CCD camera mechanism fixedly arranged above the case 15, an upper computer module 1 connected with the CCD camera mechanism, and a display screen 2 connected with the upper computer module 1, wherein the top of the case 15 is provided with a window 150 opposite to the CCD camera mechanism above, the bulk cargo mechanism comprises a bulk cargo plate 11 obliquely and fixedly arranged below the window 150 through an inclination adjusting mechanism, the bulk cargo plate 11 is provided with a plurality of W-shaped grooves 110, and a plurality of tablet capsules 16 are arranged and contained in the bottoms of the W-shaped grooves 110 to form a row of regularly arranged tablet capsules 16 in a queue; the CCD camera mechanism comprises an industrial CCD camera 9 which can adjust the height position up and down or adjust the horizontal position back and forth, the industrial CCD camera 9 is fixedly arranged above the case 15 and is opposite to the window 150 below; the industrial CCD camera 9 is used for shooting a row of regularly arranged tablet capsules 16 in a line form formed in the bottom of the W-shaped groove 110 to obtain an original true color image, the industrial CCD camera 9 is used for transmitting the collected original true color image to the upper computer module 1, the upper computer module 1 adopts an MATLAB tool and carries out image processing on the original true color image through an image processing method, a plurality of tablet capsules 16 in the original true color image are counted according to an image processing result to obtain the number of the tablet capsules 16 in the bottom of the W-shaped groove 110, and the number of the tablet capsules 16 is displayed on the display screen 2.
In this embodiment, the inclination adjusting mechanism adjusts the inclination angle between the bulk material plate 11 and the horizontal plane within 15-30 degrees.
In this embodiment, the inclination adjusting mechanism includes a top rod 19 and a screw 13 rotatably fixed at the bottom end of the top rod 19 and driving the top rod 19 to move up and down, and the top end of the top rod 19 is fixed at the bottom of the rear side of the material scattering plate 11.
In this embodiment, the tablet dispenser further includes a bar-shaped light source 12 fixedly disposed on both sides of the bulk material plate 11, and the two bar-shaped light sources 12 disposed opposite to each other simultaneously emit light toward the bulk material plate 11 and illuminate a row of regularly arranged tablet capsules 16 formed in the bottom of the W-shaped groove 110.
In this embodiment, the vibration mechanism for vibrating the bulk material plate 11 is further included, the vibration mechanism includes a vibration shaft 17 and a motor 18 for driving the vibration shaft 17 to generate a vibration effect, the top end of the vibration shaft 17 is fixedly arranged at the center of the bottom of the bulk material plate 11, and the motor 18 is fixedly arranged at the bottom end of the vibration shaft 17.
In this embodiment, the CCD camera mechanism further includes a support rod 3 fixedly disposed at the rear side of the case 15, a connecting block 4 fixedly disposed on the support rod 3 and capable of adjusting the height position up and down or adjusting the horizontal position back and forth, a camera clamp 7 fixedly connected to the connecting block 4 and extending toward the window 150, an up-down fine adjustment knob 5 and a front-back fine adjustment knob 6 rotatably disposed between the connecting block 4 and the support rod 3 through a threaded hole, and an industrial CCD camera 9 fixedly disposed in the camera clamp 7 through a fastening knob 8; the upper and lower fine adjustment knobs 5 are rotated through the threaded holes, so that the camera clamp 7 and the industrial CCD camera 9 are driven to move up and down while the connecting block 4 moves up and down along the supporting rod 3; the front and back fine adjustment knob 6 is rotated through the threaded hole, so that the camera clamp 7 and the industrial CCD camera 9 are driven to move back and forth while the connecting block 4 moves back and forth along the supporting rod 3.
In this embodiment, the front and rear sides of the bulk material plate 11 are respectively and fixedly provided with a baffle 10.
In this embodiment, the inclination adjusting mechanism further includes a hand-operated handle 14 rotatably and fixedly disposed on the screw 13 and driving the screw 13 to rotate, and of course, the hand-operated handle may be changed into an electric handle to realize automatic shaking.
A tablet capsule counting method based on machine vision, comprising the steps of:
step I: firstly, a screw rod 13 is rotated by a hand-operated handle 14, the screw rod 13 simultaneously drives a mandril 19 to move upwards or downwards, the mandril 19 moving upwards or downwards simultaneously drives the rear side of the bulk material plate 11 to ascend or descend, so that the bulk material plate 11 is in a front-low and back-high state, and the inclined included angle between the bulk material plate 11 and the horizontal plane is 15-30 degrees; then, a plurality of tablet capsules 16 to be counted are placed in the bulk material plate 11, then the motor 18 is started, the motor 18 drives the vibration shaft 17 to vibrate the bulk material plate 11, and the tablet capsules 16 slide into the W-shaped grooves 110 under the vibration action until a row of tablet capsule 16 queue in a queue shape is formed in the bottom of each W-shaped groove 110;
step II: then, two oppositely arranged strip-shaped light sources 12 are turned on simultaneously, and the two oppositely arranged strip-shaped light sources 12 emit light to the bulk material plate 11 simultaneously and illuminate a row of tablet capsules 16 in a line form formed in the bottom of the W-shaped groove 110;
step III: and then starting the industrial CCD camera 9, shooting the illuminated array of tablet capsules 16 in the form of a line by the industrial CCD camera 9 to obtain an original true color image, as shown in FIG. 4, transmitting the acquired original true color image to the upper computer module 1 by the industrial CCD camera 9, performing image processing on the original true color image by the upper computer module 1 by adopting an MATLAB tool and an image processing method, performing statistical counting on a plurality of tablet capsules 16 in the original true color image according to an image processing result to obtain the number of the tablet capsules 16 in the bottom of the W-shaped groove 110, and displaying the number of the tablet capsules 16 on the display screen 2.
In this embodiment, the image processing method in step iii includes the following steps:
the method comprises the following steps: reading an original true color image by adopting an MATLAB tool;
step two: image preprocessing: the method comprises the following specific steps:
A. image graying treatment: calculating a Gray level of each pixel point by using R, G, B as a weight according to a component of each pixel point R, G, B in the original true color image and a Gray (i, j) function, so as to convert the original true color image into a Gray level image, as shown in fig. 5, wherein Gray (i, j) is 0.299 × R (i, j) +0.587 × G (i, j) +0.114 × B (i, j), Gray (i, j) is a Gray level of the Gray level image at i, j, R (i, j) is a red brightness value of the original true color image at i, j, G (i, j) is a green brightness value of the original true color image at i, j, and B (i, j) is a blue brightness value of the original true color image at i, j;
B. and (3) image filtering processing: performing median filtering processing on the grayscale image obtained through the processing in the step a by using a median filtering algorithm to obtain a grayscale image with noise information removed, as shown in fig. 6;
C. image binarization processing: b, performing image segmentation processing on the gray image with the noise information removed, which is obtained in the step B, by adopting a binarization threshold segmentation method and an f (x) function, comparing the gray value of each pixel point in the gray image with an optimal threshold T one by one, setting the gray value of the pixel point to be black if the gray value of the pixel point is less than the optimal threshold T, and marking an area formed by the pixel points with black gray values as a background; if the gray value of the pixel point is not less than the optimal threshold value T, setting the gray value of the pixel point to be white, and marking a white communicating block formed by the pixel points with the white gray values as an image of the tablet capsule 16; wherein,t is an optimal threshold; obtaining an image shown in fig. 7 after the image binarization processing of the step C;
step three: image edge detection and contour feature extraction: performing image edge detection on the image of each tablet capsule 16 in the grayscale image obtained in step C by using Rober edge detection algorithm and extracting the edge of the image of each tablet capsule 16 to obtain a black-white image containing the contour features of the image of each tablet capsule 16, as shown in fig. 8;
step four: counting: screening white communicating blocks under a black background through an MATLAB tool and counting the number of the regions outputting the white communicating blocks, so that the number of the white communicating blocks is obtained through statistics, and the number of the tablet capsules 16 is obtained through statistics.
In summary, the above-mentioned embodiments are only preferred embodiments of the present invention, and all equivalent changes and modifications made in the claims of the present invention should be covered by the claims of the present invention.
Claims (10)
1. A tablet capsule counting device based on machine vision is characterized in that: the tablet filling machine comprises a case (15), a bulk cargo mechanism which is fixedly arranged in the case (15) and used for containing tablet capsules (16), a CCD camera mechanism which is fixedly arranged above the case (15), an upper computer module (1) which is connected with the CCD camera mechanism, and a display screen (2) which is connected with the upper computer module (1), wherein a window (150) which is right opposite to the CCD camera mechanism above is arranged at the top of the case (15), and the bulk cargo mechanism comprises a
A bulk material plate (11) which is fixed below the window (150) in an inclinable way through an inclination adjusting mechanism,
the bulk material plate (11) is provided with a plurality of W-shaped grooves (110), and a plurality of tablet capsules (16) are arranged and accommodated in the bottom of the W-shaped grooves (110) to form a row of regularly arranged tablet capsules (16) in a queue shape; the CCD camera mechanism comprises an industrial CCD camera (9) which can adjust the height position up and down or adjust the horizontal position back and forth, the industrial CCD camera (9) is fixedly arranged above the case (15) and is opposite to a window (150) below; the method comprises the steps that an industrial CCD camera (9) is used for shooting a row of tablet capsules (16) which are regularly arranged in a line form and formed in the bottom of a W-shaped groove (110) to obtain an original true color image, the industrial CCD camera (9) transmits the collected original true color image to an upper computer module (1), the upper computer module (1) adopts an MATLAB tool and carries out image processing on the original true color image through an image processing method, a plurality of tablet capsules (16) in the original true color image are counted according to an image processing result to obtain the number of the tablet capsules (16) in the bottom of the W-shaped groove (110), and the number of the tablet capsules (16) is displayed on a display screen (2).
2. The machine vision based tablet capsule counting device of claim 1, wherein: the inclination adjusting mechanism adjusts the inclination angle between the bulk material plate (11) and the horizontal plane within 15-30 degrees.
3. A machine vision based tablet capsule counting device according to claim 1 or 2, characterized in that: the inclination adjusting mechanism comprises an ejector rod (19) and a lead screw (13) which is rotatably and fixedly arranged at the bottom end of the ejector rod (19) and drives the ejector rod (19) to move up and down, and the top end of the ejector rod (19) is fixedly arranged at the bottom of the rear side of the material scattering plate (11).
4. A machine vision based tablet capsule counting device as claimed in claim 3, wherein: the tablet packaging machine further comprises strip-shaped light sources (12) fixedly arranged on two sides of the powder material plate (11), and the two strip-shaped light sources (12) arranged oppositely emit light to the powder material plate (11) and illuminate a row of regularly arranged tablet capsules (16) in a line form formed in the bottom of the W-shaped groove (110).
5. A machine vision based tablet capsule counting device according to claim 1 or 2 or 4, characterized in that: still include the vibration mechanism who carries out the vibration effect to bulk material board (11), vibration mechanism includes vibration axle (17), drive vibration axle (17) and produces motor (18) of vibration effect, and fixed the center of establishing in bulk material board (11) bottom in vibration axle (17) top, and motor (18) are fixed to be established in vibration axle (17) bottom.
6. The machine vision based tablet capsule counting device of claim 5, wherein: the CCD camera mechanism further comprises a supporting rod (3) fixedly arranged on the rear side of the case (15), a connecting block (4) capable of adjusting the height position up and down or adjusting the horizontal position back and forth fixedly arranged on the supporting rod (3), a camera clamp (7) fixedly connected to the connecting block (4) and extending towards the window (150), an upper fine adjustment knob (5) and a lower fine adjustment knob (6) which are rotatably arranged between the connecting block (4) and the supporting rod (3) through threaded holes, and a front fine adjustment knob and a rear fine adjustment knob (6), wherein an industrial CCD camera (9) is fixedly arranged in the camera clamp (7) through a fastening knob (8); the upper and lower fine adjustment knobs (5) are rotated through the threaded holes, so that the camera clamp (7) and the industrial CCD camera (9) are driven to move up and down while the connecting block (4) moves up and down along the supporting rod (3); the front and back fine adjustment knob (6) is rotated through the threaded hole, so that the camera clamp (7) and the industrial CCD camera (9) are driven to move back and forth while the connecting block (4) moves back and forth along the supporting rod (3).
7. A machine vision based tablet capsule counting device according to claim 1 or 2 or 4 or 6, characterized in that: the front side and the rear side of the material scattering plate (11) are fixedly provided with a baffle plate (10) respectively.
8. The machine vision based tablet capsule counting apparatus of claim 7, wherein: the inclination adjusting mechanism also comprises a hand-operated handle (14) or an electric handle which is rotatably and fixedly arranged on the lead screw (13) and drives the lead screw (13) to rotate.
9. A tablet capsule counting method based on machine vision is characterized in that: the method comprises the following steps:
step I: firstly, a screw rod (13) is rotated through a hand-operated handle (14), the screw rod (13) simultaneously drives a mandril (19) to move upwards or downwards, the mandril (19) moving upwards or downwards simultaneously drives the rear side of a bulk material plate (11) to ascend or descend, so that the bulk material plate (11) is in a front-low and back-high state, and the inclined included angle between the bulk material plate (11) and the horizontal plane is 15-30 degrees; then placing a plurality of tablet capsules (16) to be counted into the bulk material plate (11), starting the motor (18), driving the vibration shaft (17) by the motor (18) to vibrate the bulk material plate (11), and sliding the tablet capsules (16) into the W-shaped grooves (110) under the vibration action until a row of tablet capsule (16) queue in a queue form is formed in the bottom of each W-shaped groove (110);
step II: then simultaneously turning on two oppositely arranged strip-shaped light sources (12), wherein the two oppositely arranged strip-shaped light sources (12) simultaneously emit light to the bulk material plate (11) and illuminate a row of tablet capsules (16) in a line form formed in the bottom of the W-shaped groove (110);
step III: and then starting the industrial CCD camera (9), shooting a row of illuminated tablet capsules (16) in a queue by the industrial CCD camera (9) to obtain an original true color image, transmitting the acquired original true color image to the upper computer module (1) by the industrial CCD camera (9), carrying out image processing on the original true color image by the upper computer module (1) by adopting an MATLAB tool and an image processing method, carrying out statistical counting on a plurality of tablet capsules (16) in the original true color image according to an image processing result to obtain the number of the tablet capsules (16) in the bottom of the W-shaped groove (110), and displaying the number of the tablet capsules (16) on the display screen (2).
10. The machine vision based tablet capsule counting method of claim 9, wherein: the image processing method in the step III comprises the following steps:
the method comprises the following steps: reading an original true color image by adopting an MATLAB tool;
step two: image preprocessing: the method comprises the following specific steps:
A. image graying treatment: calculating a Gray level of each pixel point by using R, G, B as a weight and a Gray (i, j) function according to a component of each pixel point R, G, B in the original true-color image, so as to convert the original true-color image into a Gray level image, wherein Gray (i, j) is 0.299 × R (i, j) +0.587 × G (i, j) +0.114 × B (i, j), Gray (i, j) is a Gray level of the Gray level image at (i, j), R (i, j) is a red brightness value of the original true-color image at (i, j), G (i, j) is a green brightness value of the original true-color image at (i, j), and B (i, j) is a blue brightness value of the original true-color image at (i, j);
B. and (3) image filtering processing: d, performing median filtering processing on the gray level image obtained through the processing in the step A by adopting a median filtering algorithm to obtain a gray level image with noise information removed;
C. image binarization processing: b, performing image segmentation processing on the gray image with the noise information removed, which is obtained in the step B, by adopting a binarization threshold segmentation method and an f (x) function, comparing the gray value of each pixel point in the gray image with an optimal threshold T one by one, setting the gray value of the pixel point to be black if the gray value of the pixel point is less than the optimal threshold T, and marking an area formed by the pixel points with black gray values as a background; if the gray value of the pixel point is not less than the optimal threshold value T, setting the gray value of the pixel point to be white, and marking a white communicating block formed by the pixel points with the white gray values as an image of the tablet capsule (16); wherein,t is an optimal threshold;
step three: image edge detection and contour feature extraction: performing image edge detection on the image of each tablet capsule (16) in the gray level image obtained in the step C by adopting a Rober edge detection algorithm and extracting the edge of the image of each tablet capsule (16) to obtain a black-white image containing the contour feature of the image of each tablet capsule (16);
step four: counting: screening white communicating blocks under a black background by an MATLAB tool and counting the number of the regions outputting the white communicating blocks, thereby counting the number of the white communicating blocks and counting the number of the tablet capsules (16).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810636247.0A CN108545265A (en) | 2018-06-20 | 2018-06-20 | A kind of tablet capsule counting device and its method based on machine vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810636247.0A CN108545265A (en) | 2018-06-20 | 2018-06-20 | A kind of tablet capsule counting device and its method based on machine vision |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108545265A true CN108545265A (en) | 2018-09-18 |
Family
ID=63492803
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810636247.0A Pending CN108545265A (en) | 2018-06-20 | 2018-06-20 | A kind of tablet capsule counting device and its method based on machine vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108545265A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109712132A (en) * | 2018-12-28 | 2019-05-03 | 中国科学院长春光学精密机械与物理研究所 | A method of it is counted using electronic device counting device automatic screening |
CN109720625A (en) * | 2019-03-04 | 2019-05-07 | 佛山市南海区广工大数控装备协同创新研究院 | A kind of roasted eggs number detection device |
CN110239797A (en) * | 2019-04-22 | 2019-09-17 | 达尔嘉(广州)标识设备有限公司 | A kind of method of counting of discrete articles |
CN110866917A (en) * | 2019-12-03 | 2020-03-06 | 西安交通大学 | Tablet type and arrangement mode identification method based on machine vision |
CN110927157A (en) * | 2018-09-20 | 2020-03-27 | 富鼎电子科技(嘉善)有限公司 | Detection device and detection method thereof |
CN113096095A (en) * | 2021-04-12 | 2021-07-09 | 江苏理工学院 | Machine vision-based adhesive tablet counting method and counting system |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0447252A1 (en) * | 1990-03-15 | 1991-09-18 | Canon Kabushiki Kaisha | Image communication method and apparatus |
JPH11279936A (en) * | 1998-03-25 | 1999-10-12 | Asahi Chem Ind Co Ltd | Creping capability measurement system for creped woven fabric and creping capability measurement |
CN104318543A (en) * | 2014-01-27 | 2015-01-28 | 郑州大学 | Board metering method and device based on image processing method |
CN104691854A (en) * | 2013-12-06 | 2015-06-10 | 刘扬 | On-line tablet filling detection system |
CN206443043U (en) * | 2017-02-10 | 2017-08-29 | 陈丽红 | A kind of fish roe debonding cleaning device |
CN107590812A (en) * | 2017-09-01 | 2018-01-16 | 南京农业大学 | Wheat fringe portion small ear identifies method of counting |
CN206960278U (en) * | 2017-08-04 | 2018-02-02 | 中国计量大学 | A kind of cereal based on machine vision and beans mass of 1000 kernel and moisture content detection system |
-
2018
- 2018-06-20 CN CN201810636247.0A patent/CN108545265A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0447252A1 (en) * | 1990-03-15 | 1991-09-18 | Canon Kabushiki Kaisha | Image communication method and apparatus |
JPH11279936A (en) * | 1998-03-25 | 1999-10-12 | Asahi Chem Ind Co Ltd | Creping capability measurement system for creped woven fabric and creping capability measurement |
CN104691854A (en) * | 2013-12-06 | 2015-06-10 | 刘扬 | On-line tablet filling detection system |
CN104318543A (en) * | 2014-01-27 | 2015-01-28 | 郑州大学 | Board metering method and device based on image processing method |
CN206443043U (en) * | 2017-02-10 | 2017-08-29 | 陈丽红 | A kind of fish roe debonding cleaning device |
CN206960278U (en) * | 2017-08-04 | 2018-02-02 | 中国计量大学 | A kind of cereal based on machine vision and beans mass of 1000 kernel and moisture content detection system |
CN107590812A (en) * | 2017-09-01 | 2018-01-16 | 南京农业大学 | Wheat fringe portion small ear identifies method of counting |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110927157A (en) * | 2018-09-20 | 2020-03-27 | 富鼎电子科技(嘉善)有限公司 | Detection device and detection method thereof |
CN109712132A (en) * | 2018-12-28 | 2019-05-03 | 中国科学院长春光学精密机械与物理研究所 | A method of it is counted using electronic device counting device automatic screening |
CN109712132B (en) * | 2018-12-28 | 2021-03-19 | 中国科学院长春光学精密机械与物理研究所 | Method for automatically screening and counting by using electronic device counting device |
CN109720625A (en) * | 2019-03-04 | 2019-05-07 | 佛山市南海区广工大数控装备协同创新研究院 | A kind of roasted eggs number detection device |
CN110239797A (en) * | 2019-04-22 | 2019-09-17 | 达尔嘉(广州)标识设备有限公司 | A kind of method of counting of discrete articles |
CN110239797B (en) * | 2019-04-22 | 2021-11-16 | 达尔嘉(广州)标识设备有限公司 | Counting method of discrete articles |
CN110866917A (en) * | 2019-12-03 | 2020-03-06 | 西安交通大学 | Tablet type and arrangement mode identification method based on machine vision |
CN113096095A (en) * | 2021-04-12 | 2021-07-09 | 江苏理工学院 | Machine vision-based adhesive tablet counting method and counting system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108545265A (en) | A kind of tablet capsule counting device and its method based on machine vision | |
CN109225932B (en) | Wine box press cover detection device | |
CN106000903B (en) | A kind of non-contact detection system and method for being used to detect loom cloth gripper edge gap | |
CN110068518A (en) | Machine-made Sand quality detection apparatus and its detection method | |
CN102393396B (en) | Method and system for automatically screening cotton seeds | |
CN117415046A (en) | Aggregate grading continuous detection and adjustment system based on structured light technology | |
CN112468719A (en) | Processed product image acquisition device | |
CN210753857U (en) | Tea impurity removal production line | |
CN114705685A (en) | AI visual detection method and system based on deep learning and readable storage medium | |
CN210449903U (en) | Material appearance detection device | |
CN116921260A (en) | Light-emitting chip sorting method and device | |
CN215263164U (en) | Appearance intelligent detector for die casting of optical module connector | |
CN106339752A (en) | Fry counting device and counting method | |
CN105027732B (en) | The method and system of corn ear test | |
CN210753901U (en) | Mechanical hand of picking of tealeaves impurity | |
CN116891095A (en) | Granular crop grain-by-grain ordered arrangement device | |
CN216771546U (en) | Medicine bag foreign matter detection shooting device | |
DE19645068C1 (en) | Counting and weighing of grain or seed | |
CN114926409B (en) | Intelligent industrial component data acquisition method | |
CN216582879U (en) | Flexible feeding equipment | |
CN106238340B (en) | A kind of onion intelligence sorting unit | |
CN214262806U (en) | Image-text printing quality inspection system | |
CN109297852B (en) | Wheat seed thousand grain weight instrument for laboratory | |
WO2022107188A1 (en) | Image processing device and method for identifying scattered components | |
CN211997760U (en) | Hook sorting and picking device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180918 |