| In the process of making vacant capsules,titanium dioxide and pigments are often added to gelatin to process products of different colours,so as to help to distinguish drug categories and identify the pharmacodynamic status.In the existing capsule production process,the color matching of gelatin raw materials is artificially used,which not only has poor color matching quality,but also has low efficiency.In order to solve the above problems,the machine vision method is introduced,an intelligent color matching algorithm model is proposed,and the capsule color measuring and matching expert system is designed,which can realize the efficient automatic color matching of gelatin vacant capsules.The research is of great value in improving the economic efficiency of enterprises and the safety of medicines.The main contents are summarized as follows:(1)The design of overall system.Aiming at the automatic color matching problem of vacant capsules,combined with the production automation requirements of enterprises,the overall scheme of the system is constructed,including system support structure,rising and falling mechanism for fixed distance color measuring,color matching mechanism,mixing mechanism,hardware selection of image acquisition system and software function design.(2)Image processing and color difference analysis.The gelatin image captured by CCD camera in a fixed illumination environment is processed,including region of interest extraction,image denoising and color feature extraction.In view of the fact that the target image area may contain a few bubbles or small powders,which will affect the image quality to some extent,the main tone histogram analysis method is proposed to extract the RGB color values of the gelatin image as the color feature.Finally,the difference of color features between the current and the standard gelatin image is analyzed by using the color difference formula under CIE regulation,and a unified evaluation taking the place of human eyes for the color matching result is given.(3)The establishment of an intelligent color matching algorithm model.A standard formula database is established by a small color matching experiment and the support vector regression(SVR)model with good generalization ability is used for training and learning to establish a correspondence between RGB color values and pigment mass ratios.By analyzing and comparing the results of kernel function selection and three parameter optimization algorithms,the RBF kernel function is selected and the particle swarm optimization(PSO)algorithm is used to optimize the relevant model parameters.Comparing the prediction results of traditional single-output support vector regression(S-SVR)model and multi-output support vector regression(M-SVR)model,the multi-output support vector regression model based on RGB color features(RGB-MSVR)is determined as the final color matching algorithm model.(4).The design of software interface for color measuring and matching.Based on the VS2010 compiling environment,the MFC human-computer interaction interface of the color measuring and matching expert system is designed and developed in combination with OpenCV,and the corresponding operation functions are introduced in detail.(5)System debugging test.The system is debugged and tested on the spot,including the repeatability test of color value and the accuracy test of color matching.The results show that the system can run steadily and the effect is good.The capsule color measuring and matching expert system can be applied to the actual production process of vacant gelatin capsules.It can give formula suggestions and accomplish color matching quickly,which can not only improve the efficiency of color measuring and matching and ensure the quality of color matching,but also reduce the impact of personnel operation and external environment on color matching effect.It is of great significance to improve the productivity level of pharmaceutical industris in China. |