[go: up one dir, main page]

CN112053377A - A kind of drug synthesis process control method and system - Google Patents

A kind of drug synthesis process control method and system Download PDF

Info

Publication number
CN112053377A
CN112053377A CN202010883502.9A CN202010883502A CN112053377A CN 112053377 A CN112053377 A CN 112053377A CN 202010883502 A CN202010883502 A CN 202010883502A CN 112053377 A CN112053377 A CN 112053377A
Authority
CN
China
Prior art keywords
medicine
deviation
drug
model
frame
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
Application number
CN202010883502.9A
Other languages
Chinese (zh)
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.)
Changzhou Code Library Data Technology Co ltd
Original Assignee
Changzhou Code Library Data Technology Co ltd
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 Changzhou Code Library Data Technology Co ltd filed Critical Changzhou Code Library Data Technology Co ltd
Priority to CN202010883502.9A priority Critical patent/CN112053377A/en
Publication of CN112053377A publication Critical patent/CN112053377A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

本发明公开了一种药物合成过程控制方法及系统,获取若干历史药物最终态图片,对药物最终态图片进行预处理,得到药物合成最终态的灰度均值和偏差;实时获取转动中药罐内药物从开始合成反应到结束的每帧图片信息;依时间顺序将每帧图片信息在颜色模型的基础上进行阈值分割,确定出药物所在区域后计算该帧图片的灰度均值和偏差;依次将计算得到的每帧图片信息的灰度均值和偏差与药物合成最终态的灰度均值和偏差进行对比;若误差范围在预先设置的范围内,则表示到达指定状态,并停止药罐转动;否则继续转动,继续对下一帧图片信息的灰度均值和偏差的对比。优点:降低了人工成本,实现自动化;能够对于药物合成反应过程实现精确判断,提高药物合成率。

Figure 202010883502

The invention discloses a drug synthesis process control method and system, which obtains several historical drug final state pictures, preprocesses the drug final state pictures to obtain the gray mean value and deviation of the drug synthesis final state; obtains drugs in a rotating traditional Chinese medicine tank in real time Each frame of picture information from the beginning of the synthesis reaction to the end; the information of each frame of pictures is divided into thresholds based on the color model in time sequence, and the gray mean value and deviation of the frame picture are calculated after determining the area where the drug is located; The gray mean value and deviation of the obtained picture information of each frame are compared with the gray mean value and deviation of the final state of drug synthesis; if the error range is within the preset range, it means that the specified state is reached, and the rotation of the medicine tank is stopped; otherwise, continue Rotate and continue to compare the gray mean and deviation of the next frame of picture information. Advantages: reduce labor cost and realize automation; can realize accurate judgment of drug synthesis reaction process and improve drug synthesis rate.

Figure 202010883502

Description

一种药物合成过程控制方法及系统A kind of drug synthesis process control method and system

技术领域technical field

本发明涉及一种药物合成过程控制方法及系统,具体涉及一种基于机器视觉的药物合成过程控制方法及系统,属于图像处理和机器视觉技术领域。The invention relates to a drug synthesis process control method and system, in particular to a machine vision-based drug synthesis process control method and system, belonging to the technical field of image processing and machine vision.

背景技术Background technique

现今,药机企业所生产的整机或生产线,是由成千上万种零部件组装而成。而这些零部件在加工过程中存在各种各样的瑕疵,品质管控的手段也多以人工检验为主,借助部分工装检具、测量仪器进行辅助测量。众所周知,“4M1E”中最难以管控的因素就是“人”的因素,受限于人体自身难以避免的这些缺陷,极易造成不良零件的漏检。Today, the complete machines or production lines produced by pharmaceutical machine companies are assembled from thousands of components. These parts have various defects in the processing process, and the means of quality control are mostly manual inspection, with the help of some tooling inspection tools and measuring instruments for auxiliary measurement. As we all know, the most difficult factor to control in "4M1E" is the "human" factor, which is limited by these unavoidable defects of the human body, which can easily lead to missed inspection of defective parts.

然而这些细微的不良,如若发现不及时,对于药企制药的安全则存在着巨大的安全隐患;如若发现及时,重新制作、更换可以消除风险,但对于药机企业来说,也存在着大量的人力、财力、物力的浪费,更有可能影响产品的交付,使企业信誉降低。However, if these minor defects are not found in time, there will be huge safety hazards for the safety of pharmaceutical companies; if they are found in time, re-manufacturing and replacement can eliminate the risks, but for pharmaceutical machine companies, there are also a large number of safety hazards. The waste of human, financial and material resources is more likely to affect the delivery of products and reduce the reputation of the enterprise.

发明内容SUMMARY OF THE INVENTION

本发明所要解决的技术问题是克服现有技术的缺陷,提供一种药物合成过程控制方法及系统。The technical problem to be solved by the present invention is to overcome the defects of the prior art, and to provide a method and system for controlling a drug synthesis process.

为解决上述技术问题,本发明提供一种药物合成过程控制方法,获取若干历史药物最终态图片,对药物最终态图片进行预处理,得到药物合成最终态的灰度均值和偏差;In order to solve the above-mentioned technical problems, the present invention provides a method for controlling a drug synthesis process, obtaining several historical pictures of the final state of the drug, preprocessing the pictures of the final state of the drug, and obtaining the gray mean value and deviation of the final state of the drug synthesis;

实时获取转动中药罐内药物从开始合成反应到结束的每帧图片信息;Obtain real-time picture information of each frame of the medicine in the rotating Chinese medicine tank from the start of the synthesis reaction to the end;

依时间顺序将每帧图片信息在颜色模型的基础上进行阈值分割,确定出药物所在区域后计算该帧图片的灰度均值和偏差;Perform threshold segmentation on the basis of color model for each frame of picture information in chronological order, and calculate the grayscale mean and deviation of the frame of pictures after determining the area where the drug is located;

依次将计算得到的每帧图片信息的灰度均值和偏差与药物合成最终态的灰度均值和偏差进行对比;Compare the gray mean value and deviation of each frame of picture information obtained by calculation with the gray mean value and deviation of the final state of drug synthesis in turn;

若误差范围在预先设置的范围内,则表示到达指定状态,并停止药罐转动;否则继续转动,继续对下一帧图片信息的灰度均值和偏差的对比。If the error range is within the preset range, it means that the designated state is reached, and the rotation of the medicine can is stopped; otherwise, the rotation is continued, and the gray mean value and deviation of the next frame of picture information are compared.

进一步的,所述依时间顺序将每帧图片信息在颜色模型的基础上进行阈值分割,确定出药物所在区域后计算其灰度均值和偏差的过程包括:Further, the process of performing threshold segmentation on the basis of the color model for each frame of picture information in chronological order, and determining the area where the medicine is located, and calculating its grayscale mean and deviation include:

根据药物颜色的变化情况确定YUV模型,将每帧图片信息的RGB模型转换为YUV模型:Determine the YUV model according to the change of drug color, and convert the RGB model of each frame of picture information into a YUV model:

Figure BDA0002654844080000021
Figure BDA0002654844080000021

其中,YUV模型表示明亮度和色度模型,其中Y表示明亮度,U和V表示色度,RGB模型为加色法混色模型,R表示红色的百分比,G表示绿色的百分比),B表示蓝色的百分比;Among them, the YUV model represents the brightness and chrominance model, where Y represents the brightness, U and V represent the chromaticity, the RGB model is an additive color mixing model, R represents the percentage of red, G represents the percentage of green), B represents blue percentage of color;

基于YUV模型基础上阈值分割,记T为前景与背景的分割阈值,前景像素点数占图像比例为ω0,平均灰度为u0;背景像素点数占图像比例为ω1,平均灰度为u1,图像的总平均灰度为u,前景和背景图象的方差g,则有:Threshold segmentation based on the YUV model, denoting T as the segmentation threshold between foreground and background, the proportion of foreground pixels in the image is ω 0 , and the average gray level is u 0 ; the proportion of background pixels in the image is ω 1 , and the average gray level is u 1 , the total average gray level of the image is u, and the variance g of the foreground and background images is:

u=ω0×u01×u1 u=ω 0 ×u 01 ×u 1

g=ω0×(u0-u)21×(u1-u)2 g=ω 0 ×(u 0 -u) 21 ×(u 1 -u) 2

联立上式得:Combine the above equations to get:

g=ω0×ω1×(u0-u1)2 g=ω 0 ×ω 1 ×(u 0 -u 1 ) 2

或:or:

Figure BDA0002654844080000022
Figure BDA0002654844080000022

当方差g最大时,此时前景和背景差异最大,此时的灰度T是最佳阈值,通过对明亮度和色度阈值分割确定出药物所在区域;When the variance g is the largest, the difference between the foreground and the background is the largest at this time, and the gray level T at this time is the best threshold, and the area where the drug is located is determined by dividing the brightness and chromaticity thresholds;

对确定出的药物区域进行均值和偏差计算,得到该帧图片的灰度均值和偏差。The mean value and deviation of the determined drug area are calculated to obtain the gray mean value and deviation of the frame picture.

该步骤的YUV色彩模型将亮度和色度分离开,从而适合于图像处理领域。The YUV color model of this step separates luminance and chrominance, which is suitable for the field of image processing.

进一步的,还包括:选取药罐为参照物设定坐标系,计算药物位置变换;Further, it also includes: selecting the medicine tank as the reference object to set the coordinate system, and calculating the position transformation of the medicine;

所述选取药罐为参照物设定坐标系,计算药物位置变换的过程包括:The described selection medicine tank is the reference object to set the coordinate system, and the process of calculating the medicine position transformation includes:

所述药罐为球形药罐,根据所述球形药罐特征,选取球形药罐倾斜轴为Y轴,球形药罐中心为坐标原点建立笛卡尔坐标系;The medicine tank is a spherical medicine tank, and according to the characteristics of the spherical medicine tank, the inclined axis of the spherical medicine tank is selected as the Y axis, and the center of the spherical medicine tank is the coordinate origin to establish a Cartesian coordinate system;

计算球形药罐的直径大小,计算出三分之二处位置的坐标P(x,y),根据Y轴的倾斜率和P点坐标绘制出一条线段AB,此线段为药罐三分之二的分界线,当药物运动超过此界限则降低药罐转动转速,反之加速。Calculate the diameter of the spherical medicine tank, calculate the coordinates P(x, y) of the two-thirds position, and draw a line segment AB according to the inclination of the Y-axis and the coordinates of point P, which is two-thirds of the medicine tank. When the movement of the medicine exceeds this limit, the rotation speed of the medicine tank is reduced, and vice versa.

该步骤能够快速准确的定位出药罐内药物的具体位置。This step can quickly and accurately locate the specific position of the medicine in the medicine tank.

进一步的,还包括:对所述控制方法进行图像测试并调整参数,其过程包括:Further, it also includes: performing image testing on the control method and adjusting parameters, and the process includes:

多次记录药物合成反应过程,反复调整YUV模型的阈值参数使其具有兼容性;Record the drug synthesis reaction process multiple times, and repeatedly adjust the threshold parameters of the YUV model to make it compatible;

将多次合成得到的所述指定状态与实际情况进行对比,确定作为最佳终止数值的灰度均值和偏差;Compare the specified state obtained by multiple synthesis with the actual situation, and determine the gray mean value and deviation as the optimal termination value;

调整坐标系以确定药罐在图片中位置,保证三分之二处位置的相对稳定。Adjust the coordinate system to determine the position of the medicine can in the picture, and ensure the relative stability of the two-thirds position.

一种药物合成过程控制系统,包括:A drug synthesis process control system, comprising:

第一获取模块,用于获取若干历史药物最终态图片,对药物最终态图片进行预处理,得到药物合成最终态的灰度均值和偏差;The first acquisition module is used to acquire several historical drug final state pictures, and preprocess the final drug state pictures to obtain the gray mean value and deviation of the final drug synthesis state;

第二获取模块,用于实时获取转动中药罐内药物从开始合成反应到结束的每帧图片信息;The second acquisition module is used to acquire in real time the picture information of each frame of the medicine in the rotating Chinese medicine tank from the start of the synthesis reaction to the end;

分割及计算模块,用于依时间顺序将每帧图片信息在颜色模型的基础上进行阈值分割,确定出药物所在区域后计算该帧图片的灰度均值和偏差;The segmentation and calculation module is used to perform threshold segmentation on the basis of the color model for each frame of picture information in chronological order, and calculate the gray mean value and deviation of the frame of pictures after determining the area where the drug is located;

对比模块,用于依次将计算得到的每帧图片信息的灰度均值和偏差与药物合成最终态的灰度均值和偏差进行对比;The comparison module is used to sequentially compare the calculated grayscale mean value and deviation of each frame of picture information with the grayscale mean value and deviation of the final state of drug synthesis;

判断模块,用于判断,若误差范围在预先设置的范围内,则表示到达指定状态,并停止药罐转动;否则继续转动,继续对下一帧图片信息的灰度均值和偏差的对比。The judgment module is used to judge that if the error range is within the preset range, it means that the designated state is reached, and the rotation of the medicine can is stopped;

进一步的,所述分割及计算模块包括:Further, the segmentation and calculation module includes:

模型转换模块,用于根据药物颜色的变化情况确定YUV模型,将每帧图片信息的RGB模型转换为YUV模型:The model conversion module is used to determine the YUV model according to the change of drug color, and convert the RGB model of each frame of picture information into a YUV model:

Figure BDA0002654844080000031
Figure BDA0002654844080000031

其中,YUV模型表示明亮度和色度模型,其中Y表示明亮度,U和V表示色度,RGB模型为加色法混色模型,R表示红色的百分比,G表示绿色的百分比),B表示蓝色的百分比;Among them, the YUV model represents the brightness and chrominance model, where Y represents the brightness, U and V represent the chromaticity, the RGB model is an additive color mixing model, R represents the percentage of red, G represents the percentage of green), B represents blue percentage of color;

分割模块,用于基于YUV模型基础上阈值分割,记T为前景与背景的分割阈值,前景像素点数占图像比例为ω0,平均灰度为u0;背景像素点数占图像比例为ω1,平均灰度为u1,图像的总平均灰度为u,前景和背景图象的方差g,则有:The segmentation module is used for threshold segmentation based on the YUV model, denoting T as the segmentation threshold between foreground and background, the proportion of foreground pixels in the image is ω 0 , the average gray level is u 0 ; the proportion of background pixels in the image is ω 1 , The average gray level is u 1 , the total average gray level of the image is u, and the variance g of the foreground and background images is:

u=ω0×u01×u1 u=ω 0 ×u 01 ×u 1

g=ω0×(u0-u)21×(u1-u)2 g=ω 0 ×(u 0 -u) 21 ×(u 1 -u) 2

联立上式得:Combine the above equations to get:

g=ω0×ω1×(u0-u1)2 g=ω 0 ×ω 1 ×(u 0 -u 1 ) 2

或:or:

Figure BDA0002654844080000041
Figure BDA0002654844080000041

当方差g最大时,此时前景和背景差异最大,此时的灰度T是最佳阈值,通过对明亮度和色度阈值分割确定出药物所在区域;When the variance g is the largest, the difference between the foreground and the background is the largest at this time, and the gray level T at this time is the best threshold, and the area where the drug is located is determined by dividing the brightness and chromaticity thresholds;

计算模块,用于对确定出的药物区域进行均值和偏差计算,得到该帧图片的灰度均值和偏差。The calculation module is used to calculate the mean value and deviation of the determined drug area, and obtain the grayscale mean value and deviation of the frame picture.

进一步的,还包括坐标系确定及计算模块,用于选取药罐为参照物设定坐标系,计算药物位置变换;Further, it also includes a coordinate system determination and calculation module, which is used to select the medicine tank as the reference object to set the coordinate system, and calculate the position transformation of the medicine;

所述坐标系确定及计算模块包括:The coordinate system determination and calculation module includes:

坐标系建立模块,用于确定所述药罐为球形药罐,根据所述球形药罐特征,选取球形药罐倾斜轴为Y轴,球形药罐中心为坐标原点建立笛卡尔坐标系;The coordinate system establishment module is used to determine that the medicine tank is a spherical medicine tank, and according to the characteristics of the spherical medicine tank, the inclined axis of the spherical medicine tank is selected as the Y axis, and the center of the spherical medicine tank is the coordinate origin to establish a Cartesian coordinate system;

位置变换计算模块,用于计算球形药罐的直径大小,计算出三分之二处位置的坐标P(x,y),根据Y轴的倾斜率和P点坐标绘制出一条线段AB,此线段为药罐三分之二的分界线,当药物运动超过此界限则降低药罐转动转速,反之加速。The position transformation calculation module is used to calculate the diameter of the spherical medicine tank, calculate the coordinates P(x, y) of the two-thirds position, and draw a line segment AB according to the inclination of the Y axis and the coordinates of the point P. This line segment It is the dividing line of two-thirds of the medicine tank. When the movement of the medicine exceeds this limit, the rotation speed of the medicine tank is reduced, and vice versa.

进一步的,还包括:测试及调整模块,用于对所述控制方法进行图像测试并调整参数;Further, it also includes: a test and adjustment module for performing image testing on the control method and adjusting parameters;

所述测试及调整模块包括:The test and adjustment modules include:

模型阈值调整模块,用于多次记录药物合成反应过程,反复调整YUV模型的阈值参数使其具有兼容性;The model threshold adjustment module is used to record the drug synthesis reaction process multiple times, and repeatedly adjust the threshold parameters of the YUV model to make it compatible;

灰度均值及偏差确定模块,用于将多次合成得到的所述指定状态与实际情况进行对比,确定作为最佳终止数值的灰度均值和偏差;The gray mean value and deviation determination module is used to compare the specified state obtained by multiple synthesis with the actual situation, and determine the gray mean value and deviation as the optimal termination value;

坐标系调整模块,用于调整坐标系以确定药罐在图片中位置,保证三分之二处位置的相对稳定。The coordinate system adjustment module is used to adjust the coordinate system to determine the position of the medicine can in the picture, so as to ensure the relative stability of two-thirds of the position.

本发明所达到的有益效果:Beneficial effects achieved by the present invention:

本发明降低了人工成本,实现自动化;能够对于药物合成反应过程实现精确判断,提高药物合成率。The invention reduces labor cost and realizes automation; accurate judgment can be realized for the drug synthesis reaction process, and the drug synthesis rate can be improved.

附图说明Description of drawings

图1为药物检测流程示意图;Fig. 1 is a schematic diagram of a drug detection process flow;

图2、图3为发明效果示意图。2 and 3 are schematic diagrams of the effect of the invention.

具体实施方式Detailed ways

为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,下面所描述的实施例仅仅是本发明一部分实施例,而非全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the purpose, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the following The described embodiments are only some, but not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

如图1所示,基于机器视觉的药物合成过程控制方法,通过传统图像处理实现药物合成过程的精准控制,降低人工成本,同时提高药物合成率。包括如下步骤:As shown in Figure 1, the machine vision-based drug synthesis process control method realizes precise control of the drug synthesis process through traditional image processing, reduces labor costs, and improves the drug synthesis rate. It includes the following steps:

步骤一,将摄像头实时拍摄的视频内容转换为一帧一帧的图片形式;Step 1: Convert the video content captured by the camera in real time into a frame-by-frame picture format;

(1)、使用单目摄像头拍摄药罐内药物从开始合成反应到结束的全过程视频,将获取的视频转换为.avi格式;(1), use the monocular camera to shoot the whole process video of the drug in the medicine tank from the start of the synthesis reaction to the end, and convert the obtained video into .avi format;

(2)、新建ImageDrug文件夹,使用获取视频帧的方法将.avi格式的视频转换为一张一张.png格式的图片存放在文件夹中;(2), create a new ImageDrug folder, use the method of obtaining video frames to convert the video in .avi format into pictures in .png format and store them in the folder;

步骤二,药物最终合成状态预处理;Step 2, pretreatment of the final synthetic state of the drug;

准备几张药物最终态的图片进行预处理。由于最终药物合成的状态是均匀的、有一定颜色的液体,故选用均值(Mean)和偏差(Deviation)的测量方式来判断药物是否达到需要状态。手动选取感兴趣区域R为药物区域,p是来自R的像素点,其灰度值为g(p),F是平面(F=|R|),则计算公式如下:Prepare several pictures of the final state of the drug for preprocessing. Since the final state of drug synthesis is a uniform liquid with a certain color, the measurement methods of mean and deviation are used to judge whether the drug reaches the required state. Manually select the region of interest R as the drug region, p is the pixel point from R, its gray value is g(p), and F is the plane (F=|R|), the calculation formula is as follows:

Figure BDA0002654844080000061
Figure BDA0002654844080000061

Figure BDA0002654844080000062
Figure BDA0002654844080000062

通过上述公式可计算出药物合成最终态的均值Mean1和偏差Dev1;The mean value Mean1 and the deviation Dev1 of the final state of drug synthesis can be calculated by the above formula;

步骤三,选取颜色模型,包括如下步骤:Step 3, select a color model, including the following steps:

(1)、观察根据药物颜色的变化情况选取YUV(明亮度和色度)模型,其中“Y”表示明亮度(Luminance或Luma),也就是灰阶值;而“U”和“V”表示的则是色度(Chrominance或Chroma),作用是描述影像色彩及饱和度,用于指定像素的颜色。对于YUV所表示的图像,Y和UV分量是分离的。如果只有Y分量而没有UV分离,那么图像表示的就是黑白图像。所以,并不是每个像素点都需要包含了Y、U、V三个分量,根据不同的采样格式,可以每个Y分量都对应自己的UV分量,也可以几个Y分量共用UV分量。YUV主要用于优化彩色视频信号的传输。与RGB视频信号传输相比,它最大的优点在于只需占用极少的频宽(RGB要求三个独立的视频信号同时传输)。主要的采样格式有YCbCr 4:2:0、YCbCr 4:2:2、YCbCr 4:1:1和YCbCr 4:4:4。其中YCbCr 4:1:1比较常用,其含义为:每个点保存一个8bit的亮度值(也就Y值),每2x2个点保存一个Cr和Cb值,图像在肉眼中的感觉不会起太大的变化。所以,原来用RGB(R,G,B都是8bit unsigned)模型,1个点需要8x3=24bits(如下图第一个图),(全采样后,YUV仍各占8bit)。按4:1:1采样后,而现在平均仅需要8+(8/4)+(8/4)=12bits(4个点,8*4(Y)+8(U)+8(V)=48bits),平均每个点占12bits(如下图第二个图)。这样就把图像的数据压缩了一半。因此将原图RGB模型转换为YUV模型:(1), observe and select the YUV (luminance and chromaticity) model according to the change of the color of the drug, where "Y" represents the brightness (Luminance or Luma), that is, the grayscale value; and "U" and "V" represent The chrominance (Chrominance or Chroma) is used to describe the color and saturation of the image, and is used to specify the color of the pixel. For images represented by YUV, the Y and UV components are separated. If there is only a Y component and no UV separation, then the image represents a black and white image. Therefore, not every pixel needs to contain three components of Y, U, and V. According to different sampling formats, each Y component can correspond to its own UV component, or several Y components can share UV components. YUV is mainly used to optimize the transmission of color video signals. Compared with RGB video signal transmission, its biggest advantage is that it only takes up very little bandwidth (RGB requires three independent video signals to be transmitted at the same time). The main sampling formats are YCbCr 4:2:0, YCbCr 4:2:2, YCbCr 4:1:1 and YCbCr 4:4:4. Among them, YCbCr 4:1:1 is more commonly used, and its meaning is: each point saves an 8-bit brightness value (that is, the Y value), and every 2x2 points saves a Cr and Cb value, and the image will not feel in the naked eye. too much change. Therefore, the original RGB (R, G, B are all 8bit unsigned) model, 1 point needs 8x3=24bits (the first picture below), (after full sampling, YUV still occupies 8bits). After sampling by 4:1:1, and now the average only needs 8+(8/4)+(8/4)=12bits (4 points, 8*4(Y)+8(U)+8(V) =48bits), each point occupies 12bits on average (the second picture below). This compresses the image data in half. So convert the original RGB model to a YUV model:

Figure BDA0002654844080000063
Figure BDA0002654844080000063

步骤四,在颜色模型的基础上进行阈值分割选出药物所在区域后计算其灰度均值和偏差,与药物最终态对比,包括如下步骤:Step 4: On the basis of the color model, threshold segmentation is performed to select the area where the drug is located, and then the average gray value and deviation of the gray level are calculated, and compared with the final state of the drug, including the following steps:

(1)、先对图片进行灰度增强,再在基于YUV模型基础上阈值分割,记T为前景与背景的分割阈值,前景像素点数占图像比例为00,平均灰度为u0;背景像素点数占图像比例为ω1,平均灰度为u1,图像的总平均灰度为u,前景和背景图象的方差g,则有:(1), first perform grayscale enhancement on the image, and then perform threshold segmentation based on the YUV model, denote T as the segmentation threshold between foreground and background, the proportion of foreground pixels in the image is 0 0 , and the average gray level is u 0 ; background The proportion of pixels in the image is ω 1 , the average gray level is u 1 , the total average gray level of the image is u, and the variance g of the foreground and background images is:

u=ω0×u01×u1 u=ω 0 ×u 01 ×u 1

g=ω0×(u0-u)21×(u1-u)2 g=ω 0 ×(u 0 -u) 21 ×(u 1 -u) 2

联立上式得:Combine the above equations to get:

g=ω0×ω1×(u0-u1)2 g=ω 0 ×ω 1 ×(u 0 -u 1 ) 2

或:or:

Figure BDA0002654844080000071
Figure BDA0002654844080000071

当方差g最大时,可以认为此时前景和背景差异最大,此时的灰度T是最佳阈值,通过对明亮度和色度阈值分割选出药物所在区域;When the variance g is the largest, it can be considered that the difference between the foreground and the background is the largest at this time, and the gray level T at this time is the best threshold, and the area where the drug is located is selected by dividing the brightness and chromaticity thresholds;

(2)、使用形态学方法,对所在区域进行膨胀,适当扩大选中区域的范围。膨胀操作就是将图像(或图像的一部分区域,记为A)与核(记为B)进行卷积。核可以是任何的形状和大小,它拥有一个单独定义出来的参考点,记为锚点。多数情况下,核是一个小的中间带有参考点和实心正方形或者圆盘,其实可以把核视为模板或者掩码。而膨胀就是求局部最大值的操作,核B与图形卷积,即计算核B覆盖的区域(体现局部)的像素点的最大值,并把这个最大值赋值给参考点指定的像素。这样就会使图像中的高亮区域逐渐增长。(x,y)表示需要膨胀的区域,x’、y’表示膨胀像素值:(2) Use morphological methods to expand the area and appropriately expand the range of the selected area. The dilation operation is to convolve the image (or a part of the image, denoted as A) with the kernel (denoted as B). The kernel can be of any shape and size, and it has a separately defined reference point, called the anchor point. In most cases, the kernel is a small solid square or disk with a reference point in the middle, but the kernel can actually be thought of as a template or mask. The expansion is the operation of finding the local maximum value. The kernel B is convolved with the graph, that is, the maximum value of the pixel points in the area covered by the kernel B (reflecting the local area) is calculated, and this maximum value is assigned to the pixel specified by the reference point. This will cause the highlighted areas in the image to grow gradually. (x, y) represents the area that needs to be expanded, and x', y' represent the pixel value of expansion:

Figure BDA0002654844080000072
Figure BDA0002654844080000072

(3)、对选出的药物区域进行均值(Mean)和偏差(Deviation)计算;(3), perform mean (Mean) and deviation (Deviation) calculation on the selected drug area;

(4)、将求出的均值和偏差与步骤二所述的最终实际需要的药物状态进行对比,误差范围±0.2内,表示到达指定状态,并停止药罐转动。(4) Comparing the obtained mean value and deviation with the final actual required drug state described in step 2, within the error range ±0.2, it means that the specified state is reached, and the rotation of the medicine tank is stopped.

步骤五中选取药罐为参照物设定坐标系,计算药物位置变换,包括如下步骤:In step 5, the medicine tank is selected as the reference object to set the coordinate system, and the position transformation of the medicine is calculated, including the following steps:

(4-1)观察药罐特征,选取其倾斜方向为Y轴,并计算其相对于水平方向的倾斜角度为

Figure BDA0002654844080000073
以球形药罐中心为坐标原点建立笛卡尔坐标系;(4-1) Observe the characteristics of the medicine tank, select its inclination direction as the Y axis, and calculate its inclination angle relative to the horizontal direction as
Figure BDA0002654844080000073
The Cartesian coordinate system is established with the center of the spherical medicine tank as the coordinate origin;

(4-2)根据阈值分割、形状选择等方法框选出球形药罐轮廓,由于药罐是球形,故求出其直径大小l,计算出三分之二处位置的坐标

Figure BDA0002654844080000081
根据Y轴的倾斜率θ和P点坐标可画出一条直线L:(4-2) Select the outline of the spherical medicine tank according to the methods such as threshold segmentation and shape selection. Since the medicine tank is spherical, its diameter l is obtained, and the coordinates of the two-thirds position are calculated.
Figure BDA0002654844080000081
According to the slope θ of the Y-axis and the coordinates of point P, a straight line L can be drawn:

Figure BDA0002654844080000082
Figure BDA0002654844080000082

直线L为药罐三分之二的分界线,使用步骤四的方法检测药物所在区域,计算出药物沿倾斜轴方向的最小外接矩形的长和宽,令沿倾斜轴方向的边为宽lc,邻边为长lh。当外接矩形的宽

Figure BDA0002654844080000083
时表明药罐内液体超出三分之二区域,此时药罐转速降低,反之增加。The straight line L is the dividing line of two-thirds of the medicine tank. Use the method in step 4 to detect the area where the medicine is located, and calculate the length and width of the smallest circumscribed rectangle of the medicine along the inclined axis. Let the side along the inclined axis be the width l c , and the adjacent side is of length l h . When the width of the enclosing rectangle
Figure BDA0002654844080000083
When the liquid in the medicine tank exceeds two-thirds of the area, the rotation speed of the medicine tank decreases, and vice versa.

步骤六,算法测试与评估,用已完成的算法进行大量图像测试并调整参数,从而提高算法精度。Step 6: Algorithm testing and evaluation. Use the completed algorithm to test a large number of images and adjust parameters to improve the accuracy of the algorithm.

(1)、多次记录药物合成反应过程,反复调整YUV模型的阈值参数使其具有兼容性,最后选择U(80~115);(1) Record the drug synthesis reaction process multiple times, repeatedly adjust the threshold parameters of the YUV model to make it compatible, and finally select U (80-115);

(2)、将程序运行结果与实际情况进行对比,多次测验表明灰度均值(218.5±0.2和偏差(13.2±0.2)时,是最佳终止数值;(2) Comparing the program running results with the actual situation, multiple tests show that the gray mean value (218.5±0.2 and deviation (13.2±0.2) is the best termination value;

(3)、反复测验,调整坐标系以确定药罐在图片中位置,保证三分之二处位置的相对稳定。(3) Repeat the test, adjust the coordinate system to determine the position of the medicine can in the picture, and ensure the relative stability of two-thirds of the position.

输入不同反应时间的图像进行测试Enter images of different reaction times to test

(1)、药品终止反应的结果示意图如图2所示;(1), the schematic diagram of the result of the drug termination reaction is shown in Figure 2;

(2)、药罐转速控制示意图如图3所示。(2) The schematic diagram of the speed control of the medicine tank is shown in Figure 3.

(3)、经测试,本发明使用的基于传统图像处理的药物合成过程控制方法,解决了人眼观测不准确存在误差的问题,同时降低了人工成本,使自动化进一步走入生活,服务社会。(3) After testing, the traditional image processing-based drug synthesis process control method used in the present invention solves the problem of inaccurate human eye observations and errors, reduces labor costs, and enables automation to further enter life and serve the society.

相应的本发明还提供一种药物合成过程控制系统,包括:Correspondingly, the present invention also provides a drug synthesis process control system, comprising:

第一获取模块,用于获取若干历史药物最终态图片,对药物最终态图片进行预处理,得到药物合成最终态的灰度均值和偏差;The first acquisition module is used to acquire several historical drug final state pictures, and preprocess the final drug state pictures to obtain the gray mean value and deviation of the final drug synthesis state;

第二获取模块,用于实时获取转动中药罐内药物从开始合成反应到结束的每帧图片信息;The second acquisition module is used to acquire in real time the picture information of each frame of the medicine in the rotating Chinese medicine tank from the start of the synthesis reaction to the end;

分割及计算模块,用于依时间顺序将每帧图片信息在颜色模型的基础上进行阈值分割,确定出药物所在区域后计算该帧图片的灰度均值和偏差;The segmentation and calculation module is used to perform threshold segmentation on the basis of the color model for each frame of picture information in chronological order, and calculate the gray mean value and deviation of the frame of pictures after determining the area where the drug is located;

对比模块,用于依次将计算得到的每帧图片信息的灰度均值和偏差与药物合成最终态的灰度均值和偏差进行对比;The comparison module is used to sequentially compare the calculated grayscale mean value and deviation of each frame of picture information with the grayscale mean value and deviation of the final state of drug synthesis;

判断模块,用于判断,若误差范围在预先设置的范围内,则表示到达指定状态,并停止药罐转动;否则继续转动,继续对下一帧图片信息的灰度均值和偏差的对比。The judgment module is used to judge that if the error range is within the preset range, it means that the designated state is reached, and the rotation of the medicine can is stopped;

所述分割及计算模块包括:The segmentation and calculation module includes:

模型转换模块,用于根据药物颜色的变化情况确定YUV模型,将每帧图片信息的RGB模型转换为YUV模型:The model conversion module is used to determine the YUV model according to the change of drug color, and convert the RGB model of each frame of picture information into a YUV model:

Figure BDA0002654844080000091
Figure BDA0002654844080000091

其中,YUV模型表示明亮度和色度模型,其中Y表示明亮度,U和V表示色度,RGB模型为加色法混色模型,R表示红色的百分比,G表示绿色的百分比),B表示蓝色的百分比;Among them, the YUV model represents the brightness and chrominance model, where Y represents the brightness, U and V represent the chromaticity, the RGB model is an additive color mixing model, R represents the percentage of red, G represents the percentage of green), B represents blue percentage of color;

分割模块,用于基于YUV模型基础上阈值分割,记T为前景与背景的分割阈值,前景像素点数占图像比例为ω0,平均灰度为u0;背景像素点数占图像比例为ω1,平均灰度为u1,图像的总平均灰度为u,前景和背景图象的方差g,则有:The segmentation module is used for threshold segmentation based on the YUV model, denoting T as the segmentation threshold between foreground and background, the proportion of foreground pixels in the image is ω 0 , the average gray level is u 0 ; the proportion of background pixels in the image is ω 1 , The average gray level is u 1 , the total average gray level of the image is u, and the variance g of the foreground and background images is:

u=ω0×u01×u1 u=ω 0 ×u 01 ×u 1

g=ω0×(u0-u)21×(u1-u)2 g=ω 0 ×(u 0 -u) 21 ×(u 1 -u) 2

联立上式得:Combine the above equations to get:

g=ω0×ω1×(u0-u1)2 g=ω 0 ×ω 1 ×(u 0 -u 1 ) 2

或:or:

Figure BDA0002654844080000092
Figure BDA0002654844080000092

当方差g最大时,此时前景和背景差异最大,此时的灰度T是最佳阈值,通过对明亮度和色度阈值分割确定出药物所在区域;When the variance g is the largest, the difference between the foreground and the background is the largest at this time, and the gray level T at this time is the best threshold, and the area where the drug is located is determined by dividing the brightness and chromaticity thresholds;

计算模块,用于对确定出的药物区域进行均值和偏差计算,得到该帧图片的灰度均值和偏差。The calculation module is used to calculate the mean value and deviation of the determined drug area, and obtain the grayscale mean value and deviation of the frame picture.

还包括坐标系确定及计算模块,用于选取药罐为参照物设定坐标系,计算药物位置变换;It also includes a coordinate system determination and calculation module, which is used to select the medicine tank as the reference object to set the coordinate system and calculate the position transformation of the medicine;

所述坐标系确定及计算模块包括:The coordinate system determination and calculation module includes:

坐标系建立模块,用于确定所述药罐为球形药罐,根据所述球形药罐特征,选取球形药罐倾斜轴为Y轴,球形药罐中心为坐标原点建立笛卡尔坐标系;The coordinate system establishment module is used to determine that the medicine tank is a spherical medicine tank, and according to the characteristics of the spherical medicine tank, the inclined axis of the spherical medicine tank is selected as the Y axis, and the center of the spherical medicine tank is the coordinate origin to establish a Cartesian coordinate system;

位置变换计算模块,用于计算球形药罐的直径大小,计算出三分之二处位置的坐标P(x,y),根据Y轴的倾斜率和P点坐标绘制出一条线段AB,此线段为药罐三分之二的分界线,当药物运动超过此界限则降低药罐转动转速,反之加速。The position transformation calculation module is used to calculate the diameter of the spherical medicine tank, calculate the coordinates P(x, y) of the two-thirds position, and draw a line segment AB according to the inclination of the Y axis and the coordinates of the point P. This line segment It is the dividing line of two-thirds of the medicine tank. When the movement of the medicine exceeds this limit, the rotation speed of the medicine tank is reduced, and vice versa.

还包括:测试及调整模块,用于对所述控制方法进行图像测试并调整参数;Also includes: a test and adjustment module for performing image testing on the control method and adjusting parameters;

所述测试及调整模块包括:The test and adjustment modules include:

模型阈值调整模块,用于多次记录药物合成反应过程,反复调整YUV模型的阈值参数使其具有兼容性;The model threshold adjustment module is used to record the drug synthesis reaction process multiple times, and repeatedly adjust the threshold parameters of the YUV model to make it compatible;

灰度均值及偏差确定模块,用于将多次合成得到的所述指定状态与实际情况进行对比,确定作为最佳终止数值的灰度均值和偏差;The grayscale mean value and deviation determination module is used to compare the specified state obtained by multiple synthesis with the actual situation, and determine the grayscale mean value and deviation as the optimal termination value;

坐标系调整模块,用于调整坐标系以确定药罐在图片中位置,保证三分之二处位置的相对稳定。The coordinate system adjustment module is used to adjust the coordinate system to determine the position of the medicine can in the picture, so as to ensure the relative stability of two-thirds of the position.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by those skilled in the art, the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.

以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: The technical solutions described in the embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A method for controlling the process of synthesizing a drug,
acquiring a plurality of historical drug final state pictures, and preprocessing the drug final state pictures to obtain a gray average value and deviation of a drug synthesis final state;
acquiring information of each frame of picture from the beginning to the end of the synthesis reaction of the medicine in the rotary traditional Chinese medicine tank in real time;
performing threshold segmentation on each frame of picture information on the basis of a color model according to a time sequence, and calculating a gray average value and deviation of the frame of picture after determining a region where a medicine is located;
sequentially comparing the gray level mean value and the deviation of each frame of image information obtained by calculation with the gray level mean value and the deviation of the final state of the drug synthesis;
if the error range is within the preset range, indicating that the specified state is reached, and stopping the rotation of the medicine tank; and if not, continuing to rotate, and continuing to compare the gray average value and the deviation of the next frame of picture information.
2. The method of claim 1, wherein the process of performing threshold segmentation on each frame of image information based on the color model according to the time sequence and calculating the mean value and deviation of the gray scale after determining the region where the drug is located comprises:
determining a YUV model according to the change condition of the medicine color, and converting the RGB model of each frame of picture information into a YUV model:
Figure FDA0002654844070000011
the YUV model represents a brightness and chrominance model, wherein Y represents brightness, U and V represent chrominance, the RGB model is an additive color mixing model, R represents the percentage of red, G represents the percentage of green), and B represents the percentage of blue;
based on YUV model, threshold segmentation is carried out, T is recorded as a segmentation threshold of the foreground and the background, and the number of foreground pixels in the image is omega0Average gray of u0(ii) a The number of background pixels in the image is omega1Average gray of u1Total average gray of the image is u, variance of the foreground and background imagesg, then there are:
u=ω0×u01×u1
g=ω0×(u0-u)21×(u1-u)2
the simultaneous expression is as follows:
g=ω0×ω1×(u0-u1)2
or:
Figure FDA0002654844070000021
when the variance g is maximum, the difference between the foreground and the background is maximum, the gray level T is the optimal threshold value, and the region where the medicine is located is determined by segmenting the brightness threshold value and the chroma threshold value;
and calculating the mean value and the deviation of the determined medicine area to obtain the mean value and the deviation of the gray level of the frame of picture.
3. The method for controlling a drug synthesis process according to claim 1, further comprising: selecting a medicine tank as a reference object, setting a coordinate system, and calculating the position transformation of the medicine;
the method is characterized in that a coordinate system is set for the medicine tank as a reference object, and the process of calculating the position change of the medicine comprises the following steps:
the medicine pot is a spherical medicine pot, according to the characteristics of the spherical medicine pot, an inclined shaft of the spherical medicine pot is selected as a Y axis, and the center of the spherical medicine pot is taken as a coordinate origin to establish a Cartesian coordinate system;
calculating the diameter of the spherical medicine tank, calculating coordinates P (x, Y) of two-thirds positions, drawing a line segment AB according to the inclination of the Y axis and the coordinates of the point P, wherein the line segment is a boundary of two-thirds positions of the medicine tank, and when the medicine movement exceeds the boundary, the rotation speed of the medicine tank is reduced, otherwise, the medicine movement is accelerated.
4. The method for controlling a drug synthesis process according to claim 3, further comprising: the control method is subjected to image test and parameter adjustment, and the process comprises the following steps:
recording the drug synthesis reaction process for multiple times, and repeatedly adjusting the threshold parameter of the YUV model to ensure that the YUV model has compatibility;
comparing the designated state obtained by multiple synthesis with the actual situation, and determining the gray average value and the deviation as the optimal termination value;
and adjusting the coordinate system to determine the position of the medicine tank in the picture, and ensuring the relative stability of the two-thirds position.
5. A drug synthesis process control system, comprising:
the first acquisition module is used for acquiring a plurality of historical drug final state pictures, preprocessing the drug final state pictures and acquiring the gray average value and deviation of the drug synthesis final state;
the second acquisition module is used for acquiring each frame of picture information from the beginning to the end of the synthesis reaction of the medicine in the rotary traditional Chinese medicine tank in real time;
the segmentation and calculation module is used for performing threshold segmentation on each frame of picture information on the basis of the color model according to the time sequence, and calculating the gray average value and the deviation of the frame of picture after determining the region where the medicine is;
the contrast module is used for sequentially comparing the gray average value and the deviation of each frame of image information obtained by calculation with the gray average value and the deviation of the final state of the drug synthesis;
the judgment module is used for judging, if the error range is within the preset range, the specified state is reached, and the rotation of the medicine tank is stopped; and if not, continuing to rotate, and continuing to compare the gray average value and the deviation of the next frame of picture information.
6. The drug synthesis process control system of claim 5, wherein the segmentation and calculation module comprises:
the model conversion module is used for determining a YUV model according to the change condition of the medicine color and converting the RGB model of each frame of picture information into the YUV model:
Figure FDA0002654844070000031
the YUV model represents a brightness and chrominance model, wherein Y represents brightness, U and V represent chrominance, the RGB model is an additive color mixing model, R represents the percentage of red, G represents the percentage of green), and B represents the percentage of blue;
a segmentation module for threshold segmentation based on YUV model, wherein T is the segmentation threshold of foreground and background, and the ratio of foreground pixel point to image is omega0Average gray of u0(ii) a The number of background pixels in the image is omega1Average gray of u1The total average gray of the image is u, and the variance g of the foreground and background images is:
u=ω0×u01×u1
g=ω0×(u0-u)21×(u1-u)2
the simultaneous expression is as follows:
g=ω0×ω1×(u0-u1)2
or:
Figure FDA0002654844070000032
when the variance g is maximum, the difference between the foreground and the background is maximum, the gray level T is the optimal threshold value, and the region where the medicine is located is determined by segmenting the brightness threshold value and the chroma threshold value;
and the calculation module is used for calculating the mean value and the deviation of the determined medicine area to obtain the mean value and the deviation of the gray level of the frame of picture.
7. The system of claim 5, further comprising a coordinate system determination and calculation module for selecting the canister for setting a coordinate system for a reference, calculating a drug position transformation;
the coordinate system determination and calculation module comprises:
the coordinate system establishing module is used for determining that the medicine tank is a spherical medicine tank, selecting a tilting shaft of the spherical medicine tank as a Y axis according to the characteristics of the spherical medicine tank, and establishing a Cartesian coordinate system by taking the center of the spherical medicine tank as an origin of coordinates;
and the position transformation calculation module is used for calculating the diameter of the spherical medicine tank, calculating coordinates P (x, Y) of two-thirds positions, drawing a line segment AB according to the inclination rate of the Y axis and the coordinates of a point P, wherein the line segment is a two-thirds boundary of the medicine tank, and when the medicine movement exceeds the boundary, the rotation speed of the medicine tank is reduced, otherwise, the medicine tank is accelerated.
8. The pharmaceutical synthesis process control system of claim 7, further comprising: the test and adjustment module is used for carrying out image test on the control method and adjusting parameters;
the test and adjustment module includes:
the model threshold adjusting module is used for recording the drug synthesis reaction process for multiple times and repeatedly adjusting the threshold parameter of the YUV model to ensure that the YUV model has compatibility;
the gray mean and deviation determining module is used for comparing the specified state obtained by multiple times of synthesis with the actual situation and determining the gray mean and deviation as the optimal termination value;
and the coordinate system adjusting module is used for adjusting a coordinate system to determine the position of the medicine tank in the picture and ensure the relative stability of the two-thirds position.
CN202010883502.9A 2020-08-28 2020-08-28 A kind of drug synthesis process control method and system Pending CN112053377A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010883502.9A CN112053377A (en) 2020-08-28 2020-08-28 A kind of drug synthesis process control method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010883502.9A CN112053377A (en) 2020-08-28 2020-08-28 A kind of drug synthesis process control method and system

Publications (1)

Publication Number Publication Date
CN112053377A true CN112053377A (en) 2020-12-08

Family

ID=73606469

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010883502.9A Pending CN112053377A (en) 2020-08-28 2020-08-28 A kind of drug synthesis process control method and system

Country Status (1)

Country Link
CN (1) CN112053377A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114092437A (en) * 2021-11-18 2022-02-25 国网四川省电力公司电力科学研究院 Method for detecting oil leakage of transformer
CN117523503A (en) * 2024-01-08 2024-02-06 威科电子模块(深圳)有限公司 Preparation equipment safety monitoring method and system based on thick film circuit board

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030010530A (en) * 2001-07-26 2003-02-05 캐논 가부시끼가이샤 Image processing method, apparatus and system
GB0302426D0 (en) * 2002-02-03 2003-03-05 Fraunhofer Ges Forschung Method of real-time recognition and compensation of deviations in the illumination in digital colour images
CN101859378A (en) * 2010-06-11 2010-10-13 湖南大学 Visual inspection method for liquid medicine quality on high-speed pharmaceutical production line
CN104615160A (en) * 2014-12-24 2015-05-13 安徽华润金蟾药业股份有限公司 Liquid level detection device and method for production and concentration process of traditional Chinese medicinal granules
CN207488210U (en) * 2017-06-08 2018-06-12 无锡瑞奇海力信息技术有限公司 A kind of products detection system with production statistics management function
CN111369527A (en) * 2020-03-03 2020-07-03 浙江中控技术股份有限公司 Control method and device for medicine manufacturing section

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030010530A (en) * 2001-07-26 2003-02-05 캐논 가부시끼가이샤 Image processing method, apparatus and system
GB0302426D0 (en) * 2002-02-03 2003-03-05 Fraunhofer Ges Forschung Method of real-time recognition and compensation of deviations in the illumination in digital colour images
CN101859378A (en) * 2010-06-11 2010-10-13 湖南大学 Visual inspection method for liquid medicine quality on high-speed pharmaceutical production line
CN104615160A (en) * 2014-12-24 2015-05-13 安徽华润金蟾药业股份有限公司 Liquid level detection device and method for production and concentration process of traditional Chinese medicinal granules
CN207488210U (en) * 2017-06-08 2018-06-12 无锡瑞奇海力信息技术有限公司 A kind of products detection system with production statistics management function
CN111369527A (en) * 2020-03-03 2020-07-03 浙江中控技术股份有限公司 Control method and device for medicine manufacturing section

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
刘云粼;王树东;: "基于SSE2的YUV与RGB色彩空间转换", 中国图象图形学报, no. 01, pages 45 - 46 *
孙华魁: "数字图像处理与识别技术研究", 31 May 2019, 天津科学技术出版社, pages: 98 - 99 *
张善文等: "图像模式识别", 29 February 2020, 西安电子科技大学出版社 , pages: 42 - 43 *
阴躲芬;李一民;王英妹;王林;: "图像阀值分割技术的研究", 科技广场, no. 03, pages 136 - 137 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114092437A (en) * 2021-11-18 2022-02-25 国网四川省电力公司电力科学研究院 Method for detecting oil leakage of transformer
CN114092437B (en) * 2021-11-18 2023-04-25 国网四川省电力公司电力科学研究院 Transformer leakage oil detection method
CN117523503A (en) * 2024-01-08 2024-02-06 威科电子模块(深圳)有限公司 Preparation equipment safety monitoring method and system based on thick film circuit board
CN117523503B (en) * 2024-01-08 2024-05-03 威科电子模块(深圳)有限公司 Preparation equipment safety monitoring method and system based on thick film circuit board

Similar Documents

Publication Publication Date Title
CN112837257B (en) Curved surface label splicing detection method based on machine vision
US8525847B2 (en) Enhancing images using known characteristics of image subjects
WO2016106999A1 (en) Method for automatically identifying and calibrating medical color and gray-scale images
US10148895B2 (en) Generating a combined infrared/visible light image having an enhanced transition between different types of image information
KR20000068697A (en) Image data processing device and method, and transmission medium
CN112053377A (en) A kind of drug synthesis process control method and system
CN110909772B (en) High-precision real-time multi-scale dial pointer detection method and system
CN117114997B (en) Image stitching method and device based on suture line search algorithm
CN115546141A (en) A small sample Mini LED defect detection method and system based on multi-dimensional measurement
CN110987886A (en) Full-automatic microscopic image fluorescence scanning system
CN109949248B (en) Method, apparatus, device and medium for modifying color of vehicle in image
CN111426693A (en) Quality defect detection system and detection method thereof
CN107545550A (en) Cell image color cast correction
US11852465B2 (en) Wafer inspection method and apparatus thereof
CN113409330A (en) Method, device and equipment for image automatic testing
CN116132650A (en) White balance calibration method, device and equipment
CN109141457A (en) Navigate appraisal procedure, device, computer equipment and storage medium
JP4061760B2 (en) Particle image segmentation method
JP2006133055A (en) MURA DEFECT DETECTING METHOD AND DEVICE, SPATIAL FILTER, MURA DEFECT INSPECTION SYSTEM, AND MURA DEFECT DETECTING METHOD PROGRAM
JP3709656B2 (en) Image processing device
JP2000339452A (en) Method and device for extracting picture and storage medium
CN111667500A (en) Tongue picture segmentation algorithm based on image block prior
CN115984261B (en) Tooth image-based identification tracking method
CN110674828A (en) Method and device for normalizing fundus images
US11578620B2 (en) Fixture for supporting a plurality of gas turbine engine components to be imaged

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

Application publication date: 20201208

RJ01 Rejection of invention patent application after publication