[go: up one dir, main page]

CN103063137B - A kind of medicine bottle measuring system based on machine vision and measuring method thereof - Google Patents

A kind of medicine bottle measuring system based on machine vision and measuring method thereof Download PDF

Info

Publication number
CN103063137B
CN103063137B CN201210582058.2A CN201210582058A CN103063137B CN 103063137 B CN103063137 B CN 103063137B CN 201210582058 A CN201210582058 A CN 201210582058A CN 103063137 B CN103063137 B CN 103063137B
Authority
CN
China
Prior art keywords
medicine bottle
image
medicine
bottle
led backlight
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.)
Expired - Fee Related
Application number
CN201210582058.2A
Other languages
Chinese (zh)
Other versions
CN103063137A (en
Inventor
肖德明
何玉成
胡颖
张宏
曾晖
李伟
雷鸣
丁小容
段丽芳
操静
宋晨
王丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University Shenzhen Hospital
Original Assignee
Peking University Shenzhen Hospital
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Peking University Shenzhen Hospital filed Critical Peking University Shenzhen Hospital
Priority to CN201210582058.2A priority Critical patent/CN103063137B/en
Publication of CN103063137A publication Critical patent/CN103063137A/en
Application granted granted Critical
Publication of CN103063137B publication Critical patent/CN103063137B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Medical Preparation Storing Or Oral Administration Devices (AREA)
  • Length Measuring Devices By Optical Means (AREA)
  • Image Analysis (AREA)

Abstract

本发明公开了一种基于机器视觉的药瓶测量系统及其测量方法,其中,所述基于机器视觉的药瓶测量系统包括:图像采集装置、控制装置、载物转盘、激光扫描仪和LED背光源。其中,所述图像采集装置固定在载物转盘的正上方,控制装置连接图像采集装置,LED背光源设置在载物转盘的外侧,激光扫描仪固定在LED背光源的旁边。所述测量方法能准确地测量药瓶的特征参数,以便机械手精确地抓取、开启药瓶以及配制药液,进而可以减少配药人员的工作量,具有很好的经济效益和社会效益,市场推广前景较佳。

The invention discloses a medicine bottle measurement system based on machine vision and a measurement method thereof, wherein the medicine bottle measurement system based on machine vision includes: an image acquisition device, a control device, a loading turntable, a laser scanner and an LED backlight source. Wherein, the image acquisition device is fixed directly above the loading turntable, the control device is connected to the image acquisition device, the LED backlight is arranged outside the loading turntable, and the laser scanner is fixed beside the LED backlight. The measurement method can accurately measure the characteristic parameters of the medicine bottle, so that the manipulator can accurately grasp, open the medicine bottle and prepare the medicine liquid, thereby reducing the workload of the dispensing personnel, and has good economic and social benefits. The outlook is better.

Description

一种基于机器视觉的药瓶测量系统及其测量方法A medicine bottle measuring system and its measuring method based on machine vision

技术领域 technical field

本发明涉及药品测量技术领域,尤其涉及一种基于机器视觉的药瓶测量系统及其测量方法。 The invention relates to the technical field of medicine measurement, in particular to a medicine bottle measurement system and a measurement method based on machine vision.

背景技术 Background technique

尺寸测量是数字图像测量的一项重要应用。在工业生产上用基于图像的非接触测量方法代替传统的接触式测量,不仅大大提高了工作效率,而且使加工、检测和控制过程的统一成为可能。对于基于图像的尺寸测量,其测量精度受到以下三方面的影响:一、摄像系统的物面分辨率;二、摄像系统的标定及误差修正精度;三、图像中被测目标边缘的定位精度。 Dimension measurement is an important application of digital image measurement. In industrial production, the image-based non-contact measurement method is used to replace the traditional contact measurement method, which not only greatly improves the work efficiency, but also makes it possible to unify the processing, detection and control processes. For image-based size measurement, its measurement accuracy is affected by the following three aspects: first, the object plane resolution of the camera system; second, the calibration and error correction accuracy of the camera system; third, the positioning accuracy of the edge of the measured object in the image.

目前,国内对药瓶的各种规格尺寸及外观缺陷几乎全部通过人工检测,工作强度大,检测的效果不稳定。国外一些发达国家的玻璃制品行业已经开始使用计算机视觉的检测装备。但是,国外的一整套非接触检测设备价格极其昂贵。 At present, almost all the specifications, sizes and appearance defects of medicine bottles in China have been manually inspected, which is labor-intensive and the inspection effect is unstable. The glass product industry in some developed countries abroad has begun to use computer vision testing equipment. However, a complete set of non-contact detection equipment abroad is extremely expensive.

有鉴于此,现有技术有待改进和提高。 In view of this, the prior art needs to be improved and improved.

发明内容 Contents of the invention

鉴于现有技术的不足,本发明目的在于提供一种基于机器视觉的药瓶测量系统及其测量方法。旨在解决现有技术中药瓶尺寸由人工进行检测,从而带来的效率低、检测效果不佳等问题。 In view of the deficiencies in the prior art, the purpose of the present invention is to provide a medicine bottle measuring system and its measuring method based on machine vision. The invention aims to solve the problems of low efficiency, poor detection effect and the like caused by manually detecting the size of the traditional Chinese medicine bottle in the prior art.

本发明的技术方案如下: Technical scheme of the present invention is as follows:

一种基于机器视觉的药瓶测量系统,其中,包括: A medicine bottle measurement system based on machine vision, including:

图像采集装置,用于采集药瓶的图像信息,并将所述图像信息发送至下述的控制装置中; The image acquisition device is used to collect the image information of the medicine bottle, and send the image information to the following control device;

控制装置,用于对所述图像信息进行处理,判断出药瓶的形状特征参数,然后发送相关的指令给配药机器人进行相应的动作; The control device is used to process the image information, determine the shape characteristic parameters of the medicine bottle, and then send relevant instructions to the dispensing robot to perform corresponding actions;

载物转盘,用于传送药瓶; Carousel for conveying medicine bottles;

激光扫描仪,用于扫描药瓶的药品条码,确定所述药瓶的类型及位置; A laser scanner for scanning the drug barcode of the medicine bottle to determine the type and position of the medicine bottle;

LED背光源,用于增强药瓶的背景的对比度,减小外界光的影响; LED backlight is used to enhance the contrast of the background of the medicine bottle and reduce the influence of external light;

所述图像采集装置固定在载物转盘的正上方,控制装置连接图像采集装置,LED背光源设置在载物转盘的外侧,激光扫描仪固定在LED背光源的旁边。 The image acquisition device is fixed directly above the loading turntable, the control device is connected to the image acquisition device, the LED backlight is arranged outside the loading turntable, and the laser scanner is fixed beside the LED backlight.

优选地,所述的基于机器视觉的药瓶测量系统,其中,所述图像采集装置为工业摄像机;所述控制装置为工业控制计算机。 Preferably, in the medicine bottle measurement system based on machine vision, the image acquisition device is an industrial camera; the control device is an industrial control computer.

优选地,所述的基于机器视觉的药瓶测量系统,其中,所述控制装置对所述图像信息进行处理具体包括:图象二值化、滤波、边缘检测和尺寸测量。 Preferably, in the medicine bottle measurement system based on machine vision, the processing of the image information by the control device specifically includes: image binarization, filtering, edge detection and size measurement.

优选地,所述的基于机器视觉的药瓶测量系统,其中,所述LED背光源为用于发出平行光的红色LED背光源,其连接一用于调节LED背光源光强度的光源控制器;所述光源控制器固定在底座上。 Preferably, the medicine bottle measurement system based on machine vision, wherein the LED backlight is a red LED backlight for emitting parallel light, which is connected to a light source controller for adjusting the light intensity of the LED backlight; The light source controller is fixed on the base.

优选地,所述的基于机器视觉的药瓶测量系统,其中,所述控制装置上依次设置有: Preferably, the machine vision-based medicine bottle measurement system, wherein, the control device is sequentially provided with:

图像处理模块,用于对所述图像信息进行处理,其包括:二值化处理、中值滤波、边缘检测和图像标记; An image processing module, configured to process the image information, including: binarization processing, median filtering, edge detection and image marking;

尺寸测量模块,用于根据图像处理模块的标记,确定药瓶的尺寸。 The size measurement module is used for determining the size of the medicine bottle according to the mark of the image processing module.

一种上述的基于机器视觉的药瓶测量系统的测量方法,其中,包括以下步骤: A kind of measuring method of above-mentioned medicine bottle measuring system based on machine vision, wherein, comprise the following steps:

S1、载物转盘在电机的驱动下开始转动,将药瓶传送至扫描工位; S1. The loading carousel starts to rotate under the drive of the motor, and transfers the medicine bottle to the scanning station;

S2、激光扫描仪对扫描工位的药瓶上的药品条码进行扫描,确定药瓶类型,并精确其位置,将相应数据发送至控制装置; S2. The laser scanner scans the drug barcode on the drug bottle at the scanning station, determines the type of the drug bottle, and accurately positions it, and sends the corresponding data to the control device;

S3、载物转盘将药瓶传送至采集工位,图像采集装置采集药瓶的图像信息,并将所述图像信息发送至下述的控制装置; S3. The loading carousel transmits the medicine bottle to the collection station, and the image acquisition device collects the image information of the medicine bottle, and sends the image information to the following control device;

S4、控制装置对所述图像信息进行处理,判断出药瓶的形状特征参数,然后发送相关的指令给配药机器人进行相应的动作。 S4. The control device processes the image information to determine the shape characteristic parameters of the medicine bottle, and then sends relevant instructions to the dispensing robot to perform corresponding actions.

优选地,所述的基于机器视觉的药瓶测量系统的测量方法,其中,所述步骤S4中还包括:通过图像采集装置采集标准件数据信息,对所述药瓶测量系统进行标定。 Preferably, in the measurement method of the medicine bottle measurement system based on machine vision, the step S4 further includes: collecting standard piece data information by an image acquisition device, and calibrating the medicine bottle measurement system.

优选地,所述的基于机器视觉的药瓶测量系统的测量方法,其中,所述步骤S3中还包括:LED背光源发出平行光,增强药瓶在采集工位上背景的对比度。 Preferably, in the measurement method of the medicine bottle measurement system based on machine vision, the step S3 further includes: the LED backlight emits parallel light to enhance the contrast of the background of the medicine bottle on the collecting station.

优选地,所述的基于机器视觉的药瓶测量系统的测量方法,其中,所述步骤S4中控制装置对所述图像信息进行处理,判断出药瓶的形状特征参数具体包括: Preferably, the measurement method of the medicine bottle measurement system based on machine vision, wherein, in the step S4, the control device processes the image information, and determines that the shape characteristic parameters of the medicine bottle specifically include:

S41、对所述图像信息进行二值化处理; S41. Perform binarization processing on the image information;

S42、对二值化处理后的图像进行滤波处理,去除图像上的干扰; S42. Perform filtering processing on the binarized image to remove interference on the image;

S43、滤波完成后,对图像进行边缘检测,获取药瓶的边缘轮廓; S43. After the filtering is completed, edge detection is performed on the image to obtain the edge profile of the medicine bottle;

S44、对药瓶的左、右边缘线进行标记,计算出左、右边缘线之间的像素个数,然后计算出药瓶左右方向上的尺寸; S44. Mark the left and right edge lines of the medicine bottle, calculate the number of pixels between the left and right edge lines, and then calculate the size of the medicine bottle in the left and right direction;

S45、对药瓶的上、下边缘线进行标记,计算出上、下边缘线之间的像素个数,然后计算出药瓶的高度。 S45. Mark the upper and lower edge lines of the medicine bottle, calculate the number of pixels between the upper and lower edge lines, and then calculate the height of the medicine bottle.

优选地,所述的基于机器视觉的药瓶测量系统的测量方法,其中,所述步骤S2中还包括:当激光扫描仪扫描出的物品不是药瓶时,停止测量。 Preferably, in the measurement method of the medicine bottle measurement system based on machine vision, the step S2 further includes: when the item scanned by the laser scanner is not a medicine bottle, stop the measurement.

有益效果: Beneficial effect:

本申请的基于机器视觉的药瓶测量系统及其测量方法,能准确地测量药瓶的特征参数,以便机械手精确地抓取、开启药瓶以及配制药液,进而可以减少配药人员的工作量,具有很好的经济效益和社会效益,市场推广前景较佳。 The medicine bottle measurement system and its measurement method based on machine vision of the present application can accurately measure the characteristic parameters of the medicine bottle, so that the manipulator can accurately grasp, open the medicine bottle and prepare the medicine liquid, thereby reducing the workload of the dispensing personnel. It has very good economic and social benefits, and has a good market promotion prospect.

附图说明 Description of drawings

图1为本申请的基于机器视觉的药瓶测量系统的实施例的示意图。 FIG. 1 is a schematic diagram of an embodiment of a machine vision-based medicine bottle measuring system of the present application.

图2为本申请的基于机器视觉的药瓶测量系统的测量方法的流程图。 Fig. 2 is a flow chart of the measurement method of the medicine bottle measurement system based on machine vision of the present application.

具体实施方式 detailed description

本发明提供一种基于机器视觉的药瓶测量系统及其测量方法,为使本发明的目的、技术方案及效果更加清楚、明确,以下对本发明进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。 The present invention provides a medicine bottle measuring system and its measuring method based on machine vision. In order to make the purpose, technical solution and effect of the present invention clearer and clearer, the present invention will be further described in detail below. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

请参阅图1,其为本申请的基于机器视觉的药瓶测量系统的实施例的示意图。如图所示,所述基于机器视觉的药瓶测量系统包括:图像采集装置100、控制装置200、载物转盘300、激光扫描仪(图中未示出)和LED背光源500。其中,所述图像采集装置100固定在载物转盘300的正上方,控制装置200连接图像采集装置100(图中用示意线表示连接,其也可以采用无线连接方式),LED背光源500设置在载物转盘300的外侧,激光扫描仪400固定在LED背光源500的旁边。 Please refer to FIG. 1 , which is a schematic diagram of an embodiment of a machine vision-based medicine bottle measuring system of the present application. As shown in the figure, the medicine bottle measurement system based on machine vision includes: an image acquisition device 100 , a control device 200 , a loading carousel 300 , a laser scanner (not shown in the figure) and an LED backlight 500 . Wherein, the image acquisition device 100 is fixed directly above the loading carousel 300, the control device 200 is connected to the image acquisition device 100 (the connection is indicated by a schematic line in the figure, and it can also be connected wirelessly), and the LED backlight 500 is set on On the outside of the loading carousel 300 , the laser scanner 400 is fixed beside the LED backlight 500 .

具体来说,所述图像采集装置100用于采集药瓶10的图像信息,并将所述图像信息发送至控制装置200中,在本实施例中,所述图像采集装置100为工业摄像机;所述控制装置200为工业控制计算机,工业摄像机通过USB线和工业控制计算机相连。所述控制装置200用于对所述图像信息进行处理,判断出药瓶的形状特征参数,然后发送相关的指令给配药机器人进行相应的动作,具体图像处理过程会在后续进行详细介绍。所述载物转盘300用于传送药瓶(通过电机310带动转动),其还包括一药品夹具,所述药品夹具主要用来夹持放置好的药品,该药品夹具单元具有自适应调节功能,能够自动调节大小来夹持不同大小的药瓶,所述载物转盘300主要用来传送药具或者药瓶到指定的位置,以便进行下一步的操作。所述激光扫描仪400用于扫描药瓶的药品条码,确定所述药瓶的类型及位置,具体来说,激光扫描仪固定在LED背光源500的旁边,主要用于扫描载物转盘300传送的药瓶的药品条码,以便确定该物品为药具还是药瓶,假如是药瓶,还可以辨别它是安瓿瓶还是西林瓶,然后还可以精确其位置,为后续操作提供数据。所述LED背光源500用于增强药瓶的背景的对比度,减小外界光的影响,其设置在固定支架600上,在本实施例中,所述LED背光源500采用的是红色LED背光源(当然,其他颜色也可以),其穿透能力非常强,而且它发出的光是平行光,成像效果非常好,获取的图像也更清晰。在本实施例中,所述LED背光源500连接一光源控制器,光源控制器固定在底座上,主要用来调节LED背光源的光强度,使其在不同的场合、不同的环境下发出不同亮度的平行光。 Specifically, the image acquisition device 100 is used to collect image information of the medicine bottle 10, and send the image information to the control device 200. In this embodiment, the image acquisition device 100 is an industrial camera; The control device 200 is an industrial control computer, and the industrial camera is connected to the industrial control computer through a USB cable. The control device 200 is used to process the image information, determine the shape characteristic parameters of the medicine bottle, and then send relevant instructions to the dispensing robot to perform corresponding actions. The specific image processing process will be described in detail later. The loading carousel 300 is used to convey the medicine bottle (rotated by the motor 310), and it also includes a medicine clamp, the medicine clamp is mainly used to clamp the placed medicine, and the medicine clamp unit has an adaptive adjustment function, The size can be automatically adjusted to hold medicine bottles of different sizes, and the loading carousel 300 is mainly used to transport medicines or medicine bottles to a designated position for the next step of operation. The laser scanner 400 is used to scan the drug barcode of the medicine bottle to determine the type and position of the medicine bottle. Specifically, the laser scanner is fixed next to the LED backlight 500 and is mainly used to scan the loading carousel 300 to transmit The drug barcode of the medicine bottle, in order to determine whether the item is a medicine or a medicine bottle, if it is a medicine bottle, it can also be distinguished whether it is an ampoule or a vial, and then its location can be precise to provide data for subsequent operations. The LED backlight 500 is used to enhance the contrast of the background of the medicine bottle and reduce the influence of external light. It is arranged on the fixed bracket 600. In this embodiment, the LED backlight 500 uses a red LED backlight (Of course, other colors are also available), its penetrating ability is very strong, and the light it emits is parallel light, the imaging effect is very good, and the obtained image is clearer. In this embodiment, the LED backlight 500 is connected to a light source controller, and the light source controller is fixed on the base, and is mainly used to adjust the light intensity of the LED backlight so that it emits different lights in different occasions and environments. Brightness of parallel light.

其中,控制装置200对图像信息的处理是本发明的关键。在本实施例中,所述控制装置上依次设置有:图像处理模块和尺寸测量模块,所述图像处理模块用于对所述图像信息进行处理,其包括:二值化处理、中值滤波、边缘检测和图像标记;所述尺寸测量模块用于根据图像处理模块的标记,确定药瓶的尺寸。 Among them, the processing of the image information by the control device 200 is the key of the present invention. In this embodiment, the control device is sequentially provided with: an image processing module and a size measurement module, and the image processing module is used to process the image information, which includes: binarization processing, median filtering, Edge detection and image marking; the size measuring module is used to determine the size of the medicine bottle according to the marking of the image processing module.

在本实施例中,当激光扫描仪扫描到的药瓶是安瓿瓶,则通过载物转盘将其放置在工业摄像机和LED背光源之间的特定位置,然后触发工业摄像机进行捕获图像,进一步进行图像匹配,确认其是否是安瓿瓶,然后再进行图像二值化、滤波、边缘提取和尺寸测量,然后确定其直径、瓶颈位置等,其中在尺寸测量的时候先用黄色的线将其左边缘标记出来,然后用绿色的线将其右边缘标记出来,再通过计算得出药瓶的直径。对于瓶颈位置的测量,先通过一系列算法得出按左边缘来测的瓶颈位置,再得出按右边缘来测的瓶颈位置,最后再根据左右瓶颈的测量结果,来确定该药瓶的最终瓶颈位置。 In this embodiment, when the medicine bottle scanned by the laser scanner is an ampoule, it is placed at a specific position between the industrial camera and the LED backlight through the loading carousel, and then the industrial camera is triggered to capture the image, and further Image matching, to confirm whether it is an ampoule, and then perform image binarization, filtering, edge extraction and size measurement, and then determine its diameter, bottleneck position, etc., where the left edge is first marked with a yellow line when measuring the size Mark it, then mark its right edge with a green line, and then calculate the diameter of the medicine bottle. For the measurement of the bottleneck position, the bottleneck position measured by the left edge is first obtained through a series of algorithms, and then the bottleneck position measured by the right edge is obtained, and finally the final size of the medicine bottle is determined according to the measurement results of the left and right bottlenecks. Bottleneck location.

当扫描到的药瓶是西林瓶,则通过载物转盘将其放置在工业摄像机和LED背光源之间的特定位置,然后触发工业摄像机进行捕获图像,进一步进行图像匹配,确认其是否是西林瓶,然后再进行图像二值化、滤波、边缘提取和尺寸测量,然后确定其瓶颈位置,其中在尺寸测量的时候先用黄色的线将其左边缘标记出来,然后用绿色的线将其右边缘标记出来,再通过计算得出药瓶的直径。对于瓶颈位置的测量,先通过一系列算法得出按左边缘来测的瓶颈位置,再得出按右边缘来测的瓶颈位置,最后再根据左右瓶颈的测量结果,来确定该药瓶的最终瓶颈位置。 When the scanned medicine bottle is a vial, it is placed at a specific position between the industrial camera and the LED backlight through the loading carousel, and then the industrial camera is triggered to capture an image, and further image matching is performed to confirm whether it is a vial , and then perform image binarization, filtering, edge extraction and size measurement, and then determine its bottleneck position, where the left edge is first marked with a yellow line when the size is measured, and then its right edge is marked with a green line Mark it out, and then calculate the diameter of the medicine bottle. For the measurement of the bottleneck position, the bottleneck position measured by the left edge is first obtained through a series of algorithms, and then the bottleneck position measured by the right edge is obtained, and finally the final size of the medicine bottle is determined according to the measurement results of the left and right bottlenecks. Bottleneck location.

本发明还提供了一种上述的基于机器视觉的药瓶测量系统的测量方法,如图2所示,包括以下步骤: The present invention also provides a measurement method of the above-mentioned medicine bottle measurement system based on machine vision, as shown in Figure 2, comprising the following steps:

S1、载物转盘在电机的驱动下开始转动,将药瓶传送至扫描工位; S1. The loading carousel starts to rotate under the drive of the motor, and transfers the medicine bottle to the scanning station;

S2、激光扫描仪对扫描工位的药瓶上的药品条码进行扫描,确定药瓶类型,并精确其位置,将相应数据发送至控制装置; S2. The laser scanner scans the drug barcode on the drug bottle at the scanning station, determines the type of the drug bottle, and accurately positions it, and sends the corresponding data to the control device;

S3、载物转盘将药瓶传送至采集工位,图像采集装置采集药瓶的图像信息,并将所述图像信息发送至下述的控制装置; S3. The loading carousel transmits the medicine bottle to the collection station, and the image acquisition device collects the image information of the medicine bottle, and sends the image information to the following control device;

S4、控制装置对所述图像信息进行处理,判断出药瓶的形状特征参数,然后发送相关的指令给配药机器人进行相应的动作。 S4. The control device processes the image information to determine the shape characteristic parameters of the medicine bottle, and then sends relevant instructions to the dispensing robot to perform corresponding actions.

进一步地,所述步骤S3中还包括:LED背光源发出平行光,增强药瓶在采集工位上背景的对比度。另外,所述步骤S4中还包括:通过图像采集装置采集标准件数据信息,对所述药瓶测量系统进行标定。 Further, the step S3 also includes: the LED backlight emits parallel light to enhance the contrast of the background of the medicine bottle on the collecting station. In addition, the step S4 also includes: collecting standard part data information by an image collection device, and calibrating the medicine bottle measurement system.

在本实施例中,定标过程如下:取标准标定药瓶,比如高H=30毫米,直径W=30毫米,放于载物转盘上;转盘旋转一周,激光扫描仪对转盘上的药瓶进行条码扫描,计算机将其扫描的数据进行识别,确认为标准药瓶,并启动系统标定程序,其中标定程序与步骤S4中图像信息处理程序一致,下面会进行详细描述。 In this embodiment, the calibration process is as follows: take a standard calibration medicine bottle, such as height H=30 mm, diameter W=30 mm, and place it on the loading turntable; the turntable rotates once, and the laser scanner scans the medicine bottle on the turntable Scanning the barcode, the computer recognizes the scanned data, confirms it as a standard medicine bottle, and starts the system calibration program, wherein the calibration program is consistent with the image information processing program in step S4, which will be described in detail below.

更进一步地,所述步骤S4中控制装置对所述图像信息进行处理,判断出药瓶的形状特征参数具体包括: Furthermore, in the step S4, the control device processes the image information, and determines that the shape characteristic parameters of the medicine bottle specifically include:

S41、对所述图像信息进行二值化处理; S41. Perform binarization processing on the image information;

S42、对二值化处理后的图像进行滤波处理,去除图像上的干扰; S42. Perform filtering processing on the binarized image to remove interference on the image;

S43、滤波完成后,对图像进行边缘检测,获取药瓶的边缘轮廓; S43. After the filtering is completed, edge detection is performed on the image to obtain the edge profile of the medicine bottle;

S44、对药瓶的左、右边缘线进行标记,计算出左、右边缘线之间的像素个数,然后计算出药瓶左右方向上的尺寸; S44. Mark the left and right edge lines of the medicine bottle, calculate the number of pixels between the left and right edge lines, and then calculate the size of the medicine bottle in the left and right directions;

S45、对药瓶的上、下边缘线进行标记,计算出上、下边缘线之间的像素个数,然后计算出药瓶的高度。 S45. Mark the upper and lower edge lines of the medicine bottle, calculate the number of pixels between the upper and lower edge lines, and then calculate the height of the medicine bottle.

下面分别针对上述步骤进行具体描述: The above steps are described in detail below:

首先,计算机对捕获的图像进行二值化处理,二值化的方法很多,本系统中采用灰度阈值分割法,算法简单,运算速度快,效率高;其表示式为:First of all, the computer performs binarization processing on the captured image. There are many binarization methods. In this system, the gray threshold segmentation method is adopted. The algorithm is simple, the operation speed is fast, and the efficiency is high; the expression is: ;

其中,T为阈值,g(i,j)=1表示目标物体的图像元素,g(i,j)=0表示背景的图像元素。 Among them, T is the threshold value, g(i,j)=1 represents the image element of the target object, and g(i,j)=0 represents the image element of the background.

二值化后,对图像进行滤波处理;去除药瓶图像在形成、采集和接收过程中,存在的干扰,比如复杂的背景、光源照度和信号传输等;本系统采用中值滤波对图像进行处理,经过多次实验,处理效果良好;滤波完成之后,对图像进行边缘检测,获取药瓶的边缘轮廓。 After binarization, filter the image; remove the interference that exists in the process of forming, collecting and receiving the medicine bottle image, such as complex background, light source illumination and signal transmission, etc.; this system uses median filtering to process the image , after many experiments, the processing effect is good; after the filtering is completed, edge detection is performed on the image to obtain the edge profile of the medicine bottle.

在获取药瓶边缘轮廓之后,对药瓶的左、右边缘线进行标记,计算出左、右边缘线之间的像素个数,比如N=30;则可知,在左、右方向上,像素N与药瓶实际尺寸之间的关系如下: After obtaining the edge contour of the medicine bottle, mark the left and right edge lines of the medicine bottle, and calculate the number of pixels between the left and right edge lines, such as N=30; then it can be known that in the left and right direction, the pixel The relationship between N and the actual size of the vial is as follows:

W=30/30*N;其中,W为药瓶直径/毫米,N为像素/个。 W=30/30*N; where, W is the diameter of the medicine bottle/mm, and N is the pixel/unit.

同理,可以计算出在上、下方向上,药瓶高度与像素之间的关系: In the same way, the relationship between the height of the medicine bottle and the pixel can be calculated in the up and down directions:

H=30/30*N;其中,H为药瓶高度/毫米,N为像素/个。 H=30/30*N; Among them, H is the height of the medicine bottle/mm, and N is the pixel/unit.

进一步地,所述步骤S2中还包括:当激光扫描仪扫描出的物品不是药瓶(比如:为药具或者其他产品)时,停止测量。 Further, the step S2 also includes: when the item scanned by the laser scanner is not a medicine bottle (for example: medicine or other products), stop the measurement.

综上所述,本发明的基于机器视觉的药瓶测量系统及其测量方法,其中,所述基于机器视觉的药瓶测量系统包括:图像采集装置、控制装置、载物转盘、激光扫描仪和LED背光源。其中,所述图像采集装置固定在载物转盘的正上方,控制装置连接图像采集装置,LED背光源设置在载物转盘的外侧,激光扫描仪固定在LED背光源的旁边。所述测量方法能准确地测量药瓶的特征参数,以便机械手精确地抓取、开启药瓶以及配制药液,进而可以减少配药人员的工作量,具有很好的经济效益和社会效益,市场推广前景较佳。 In summary, the machine vision-based medicine bottle measurement system and its measurement method of the present invention, wherein, the machine vision-based medicine bottle measurement system includes: an image acquisition device, a control device, a loading carousel, a laser scanner and LED backlight. Wherein, the image acquisition device is fixed directly above the loading turntable, the control device is connected to the image acquisition device, the LED backlight is arranged outside the loading turntable, and the laser scanner is fixed beside the LED backlight. The measurement method can accurately measure the characteristic parameters of the medicine bottle, so that the manipulator can accurately grasp, open the medicine bottle and prepare the medicine liquid, thereby reducing the workload of the dispensing personnel, and has good economic and social benefits. The outlook is better.

应当理解的是,本发明的应用不限于上述的举例,对本领域普通技术人员来说,可以根据上述说明加以改进或变换,所有这些改进和变换都应属于本发明所附权利要求的保护范围。 It should be understood that the application of the present invention is not limited to the above examples, and those skilled in the art can make improvements or transformations according to the above descriptions, and all these improvements and transformations should belong to the protection scope of the appended claims of the present invention.

Claims (2)

1., based on a medicine bottle measuring system for machine vision, it is characterized in that, comprising:
Image collecting device, for gathering the image information of medicine bottle, and is sent in following control device by described image information;
Control device, for processing described image information, judges the parameters for shape characteristic of medicine bottle, then sends relevant instruction and carries out corresponding action to the robot that makes up a prescription;
Loading rotating disk, for transmitting medicine bottle;
Laser scanner, for scanning the medicine bar code of medicine bottle, determines type and the position of described medicine bottle;
LED backlight, for strengthening the contrast of the background of medicine bottle, reduces the impact of ambient light;
Described image collecting device is fixed on directly over loading rotating disk, and control device connects image collecting device, and LED backlight is arranged on the outside of loading rotating disk, and laser scanner is fixed on the side of LED backlight;
Described loading rotating disk also comprises a medicine fixture, and described medicine fixture is used for clamping the medicine placed, and this medicine fixture has Automatic adjusument function;
Described control device is disposed with: image processing module and dimensional measurement module, described image processing module is used for processing described image information, and it comprises: binary conversion treatment, medium filtering, rim detection and image tagged; Described dimensional measurement module is used for the mark according to image processing module, determines the size of medicine bottle;
First with yellow line, medicine bottle left hand edge is marked when dimensional measurement, then with green line, medicine bottle right hand edge is marked, then by calculating the diameter of medicine bottle;
For the measurement of bottleneck position, first drawn the bottleneck position surveyed by left hand edge by series of algorithms, then draw the bottleneck position surveyed by right hand edge, finally again according to the measurement result of left and right bottleneck, determine the final bottleneck position of this medicine bottle;
Described image binaryzation process adopts gray level threshold segmentation method, and described gray level threshold segmentation method expression is:
; Wherein, T is threshold value, and g (i, j)=1 represents the pictorial element of target object, and g (i, j)=0 represents the pictorial element of background;
Described LED backlight is the red LED backlight for sending directional light, and it connects one for regulating the light source controller of LED backlight light intensity; Described light source controller is fixed on base;
Described image collector is set to industrial camera; Described control device is industrial control computer;
When laser scanner scans to medicine bottle be ampoule bottle, then place it in the ad-hoc location between industrial camera and LED backlight by loading rotating disk, then trigger industrial camera to carry out catching image, carry out images match further, confirm whether it is ampoule bottle, and then carry out image binaryzation, filtering, edge extracting and dimensional measurement, then determine its diameter, bottleneck position;
When the medicine bottle scanned is cillin bottle, then place it in the ad-hoc location between industrial camera and LED backlight by loading rotating disk, then trigger industrial camera to carry out catching image, carry out images match further, confirm whether it is cillin bottle, and then carry out image binaryzation, filtering, edge extracting and dimensional measurement, then determine its bottleneck position.
2. a measuring method for the medicine bottle measuring system based on machine vision according to claim 1, is characterized in that, comprise the following steps:
S1, loading rotating disk start to rotate under the driving of motor, medicine bottle are sent to scanning station;
S2, laser scanner scan the medicine bar code on the medicine bottle of scanning station, determine bottle-type, and accurate its position, corresponding data is sent to control device;
Medicine bottle is sent to collection station by S3, loading rotating disk, the image information of image acquisition device medicine bottle, and described image information is sent to control device;
S4, control device process described image information, judge the parameters for shape characteristic of medicine bottle, then send relevant instruction and carry out corresponding action to the robot that makes up a prescription;
In described step S4, control device processes described image information, judges that the parameters for shape characteristic of medicine bottle specifically comprises:
S41, binary conversion treatment is carried out to described image information;
S42, filtering process is carried out to the image after binary conversion treatment, remove the interference on image;
After S43, filtering complete, rim detection is carried out to image, obtain the edge contour of medicine bottle;
S44, the left and right edge line of medicine bottle to be marked, calculate the number of pixels between left and right edge line, then calculate the size on medicine bottle left and right directions;
S45, the upper and lower edge line of medicine bottle to be marked, calculate the number of pixels between upper and lower edge line, then calculate the height of medicine bottle;
Described image binaryzation process adopts gray level threshold segmentation method, and described gray level threshold segmentation method expression is:
; Wherein, T is threshold value, and g (i, j)=1 represents the pictorial element of target object, and g (i, j)=0 represents the pictorial element of background;
Also comprise in described step S3: LED backlight sends directional light, strengthen medicine bottle in the contrast gathering background on station;
Also comprise in described step S4: by image acquisition device standard component data message, described medicine bottle measuring system is demarcated;
Also comprise in described step S2: when the article that laser scanner scans goes out are not medicine bottles, stop measuring;
Described image collector is set to industrial camera; Described control device is industrial control computer;
When laser scanner scans to medicine bottle be ampoule bottle, then place it in the ad-hoc location between industrial camera and LED backlight by loading rotating disk, then trigger industrial camera to carry out catching image, carry out images match further, confirm whether it is ampoule bottle, and then carry out image binaryzation, filtering, edge extracting and dimensional measurement, then determine its diameter, bottleneck position;
When the medicine bottle scanned is cillin bottle, then place it in the ad-hoc location between industrial camera and LED backlight by loading rotating disk, then trigger industrial camera to carry out catching image, carry out images match further, confirm whether it is cillin bottle, and then carry out image binaryzation, filtering, edge extracting and dimensional measurement, then determine its bottleneck position.
CN201210582058.2A 2012-12-28 2012-12-28 A kind of medicine bottle measuring system based on machine vision and measuring method thereof Expired - Fee Related CN103063137B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210582058.2A CN103063137B (en) 2012-12-28 2012-12-28 A kind of medicine bottle measuring system based on machine vision and measuring method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210582058.2A CN103063137B (en) 2012-12-28 2012-12-28 A kind of medicine bottle measuring system based on machine vision and measuring method thereof

Publications (2)

Publication Number Publication Date
CN103063137A CN103063137A (en) 2013-04-24
CN103063137B true CN103063137B (en) 2016-03-30

Family

ID=48105868

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210582058.2A Expired - Fee Related CN103063137B (en) 2012-12-28 2012-12-28 A kind of medicine bottle measuring system based on machine vision and measuring method thereof

Country Status (1)

Country Link
CN (1) CN103063137B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104007122B (en) * 2014-04-30 2016-07-06 楚天科技股份有限公司 Cylinder body side surface detecting device and method based on rotating disc type streamline
CN104236458A (en) * 2014-09-19 2014-12-24 西安交通大学 Plastic bottle geometric dimension online measuring system and measuring method thereof
CN105005338A (en) * 2015-06-26 2015-10-28 国网天津市电力公司 Light intensity self-adaptation method used in robot visual system
CN107014290A (en) * 2016-01-27 2017-08-04 深圳市卫邦科技有限公司 A kind of clamping medicine bottle aligning method and system
CN106372633A (en) * 2016-09-07 2017-02-01 张勇 Liquefied petroleum gas storage bottle production tracking monitoring apparatus and method
CN107041843B (en) * 2017-02-09 2021-03-26 深圳市卫邦科技有限公司 Medicine suction control method and device
CN107213019A (en) * 2017-06-01 2017-09-29 张坚 Medicine distributing device and method
CN108241815A (en) * 2017-11-10 2018-07-03 精华电子(苏州)有限公司 Image collecting device and image-pickup method
CN112284696A (en) * 2019-07-11 2021-01-29 中国科学院半导体研究所 Gas cylinder volume detection method and system based on 3D vision technology
CN113432531A (en) * 2021-06-22 2021-09-24 广东工业大学 Bottle blank size measuring method
CN114910924B (en) * 2022-06-09 2023-02-07 四川先通原子医药科技有限公司 Medicine bottle placing device and method and application thereof

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5414778A (en) * 1993-11-24 1995-05-09 Schwartz; Nira Dynamic fluid level and bubble inspection for quality and process control
CN1529165A (en) * 2003-09-25 2004-09-15 谢森林 Fully-automatic bottled-medicine detecting machine
CN101403706A (en) * 2008-11-06 2009-04-08 清华大学 Full-automatic bottling liquor inspection machine
CN201322727Y (en) * 2008-11-25 2009-10-07 湖南大学 Linear automatic detection device for detecting liquid in special shaped bottle
CN101858734A (en) * 2010-05-19 2010-10-13 山东明佳包装检测科技有限公司 Method and device for detecting PET bottleneck quality
CN201637660U (en) * 2010-04-29 2010-11-17 长沙楚天科技有限公司 Automatic lamp detecting machine
CN102053091A (en) * 2010-11-10 2011-05-11 王喆 Vision detection device used for detecting defects on surface of plastic medicine bottle

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002267612A (en) * 2001-03-13 2002-09-18 Hitachi Eng Co Ltd Apparatus and system for detecting foreign matter in filling liquid such as transparent containers
CN2810778Y (en) * 2005-08-04 2006-08-30 北京凯瑞德图像技术有限责任公司 Small medicine bottle on-line detection system
CN101565109A (en) * 2008-04-23 2009-10-28 上海新先锋药业有限公司 Aluminum cap packaging online detection system in medical powder injection production based on mechanical vision
CN101566582B (en) * 2008-04-23 2011-04-27 上海新先锋药业有限公司 Medicine bottle label information online detection system in powder injection production based on mechanical vision
CN202522527U (en) * 2012-03-14 2012-11-07 上海魏森自动化科技有限公司 Automatic glass medicine bottle flaw detection device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5414778A (en) * 1993-11-24 1995-05-09 Schwartz; Nira Dynamic fluid level and bubble inspection for quality and process control
CN1529165A (en) * 2003-09-25 2004-09-15 谢森林 Fully-automatic bottled-medicine detecting machine
CN101403706A (en) * 2008-11-06 2009-04-08 清华大学 Full-automatic bottling liquor inspection machine
CN201322727Y (en) * 2008-11-25 2009-10-07 湖南大学 Linear automatic detection device for detecting liquid in special shaped bottle
CN201637660U (en) * 2010-04-29 2010-11-17 长沙楚天科技有限公司 Automatic lamp detecting machine
CN101858734A (en) * 2010-05-19 2010-10-13 山东明佳包装检测科技有限公司 Method and device for detecting PET bottleneck quality
CN102053091A (en) * 2010-11-10 2011-05-11 王喆 Vision detection device used for detecting defects on surface of plastic medicine bottle

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
药用玻璃瓶特征参数图像检测系统的研究;殷俊;《中国优秀硕士学位论文全文数据库信息科技辑》;20081115(第11期);第I138-760页:参见论文正文第1.3节,第1.4节,第2.1节,第2.2节的第1段,第2.2.1节,第2.2.4节,第2.3节,第4.1.1节,第4.4.2节,图2-1,图2-6,图4-1,图4-2,图4-4至4-6,图4-18至4-22 *

Also Published As

Publication number Publication date
CN103063137A (en) 2013-04-24

Similar Documents

Publication Publication Date Title
CN103063137B (en) A kind of medicine bottle measuring system based on machine vision and measuring method thereof
CN105181714B (en) A kind of bottling liquid Impurity Detection System and its detection method based on image procossing
CN206114546U (en) Printing defect vision detection system
CN102095733B (en) Machine vision-based intelligent detection method for surface defect of bottle cap
CN108465648A (en) A kind of magnetic core Automated Sorting System based on machine vision
CN203508418U (en) Device for detecting appearance of tobacco packaging box
CN100458422C (en) Glass Bottle and can detecting method and detecting device
CN106290382A (en) Bubble-cap tablet package defective vision detection device and method
CN104111260A (en) Nondestructive ceramic detection device and detection method thereof
CN108344743A (en) One kind being based on machine vision drug blister package defect inspection method and system
CN103257144A (en) Plastic bottleneck excess material detecting method and device based on machine vision
CN102879404B (en) System for automatically detecting medical capsule defects in industrial structure scene
CN105424722A (en) Bottle cap unqualified product marking method based on machine vision
CN204789384U (en) Bottled product extranal packing bottle lid defect detecting system
CN103776841A (en) Automatic detection device and method of synthetic leather defect
CN111080638B (en) Method for detecting dirt at bottom of molded bottle
CN104535006B (en) A kind of bottle cap gap width evaluation method of utilization transmission-type illumination imaging systems
CN205486309U (en) Through whether correct device of test capacitor installation of shooing
CN114383505A (en) An automatic detection device for the size of short shaft parts
CN205449820U (en) Machine vision device of detectable ball bearing defect
CN102854000B (en) The detection method of a kind of high-brightness LED optical axis pick-up unit and light shaft offset
CN103091332B (en) Detection method and detection system of U-shaped powder pipe based on machine vision
CN107247057B (en) Method for detecting defects of production date on surface of bottle cap
CN204286530U (en) A kind of device for detecting liquid level in bottle
CN109945842B (en) Leak detection and labeling error analysis method for end-face labels of bundled round steel

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160330

Termination date: 20161228

CF01 Termination of patent right due to non-payment of annual fee