A System for Real-Time Syringe Classification and Volume Measurement Using a Combination of Image Processing and Artificial Neural Networks



The purpose of this research was to develop a system that can read and report the volume of liquid medication present in syringes.


The system is comprised of a digital webcam which is designed to communicate with a computer program developed using MATLAB. The system includes two functional modules, one supporting syringe classification, and another supporting volume measurement. Adaptive template matching was used to determine the best match point between target and template images. The connected component labeling method was used during volume measurement. An artificial neural network (ANN) model was developed using MATLAB to support the intended volume measurement functionality. The developed ANN was designed as a classifier which determines the plunger depth of the syringe and then leverages this result to calculate and derive the volume of medication inside the syringe as the final system output. Commercial Luer-lock syringes of sizes from 1 to 30 ml were used in conjunction with syringe tip caps of blue and yellow color. Tap water or aqueous dye solutions of yellow, red, and blue color simulated liquid medication in the syringe.


The developed syringe classification system successfully detected and categorized all tested syringes according to their size. The best accuracy of the system was found to be 99.95% with a 3-ml syringe, while the worst accuracy was 95.82% with a 5-ml syringe. It took approximately 6 s to perform the entire task demonstrating the utility of this system to report volumes in real time.


The developed system can be used across a variety of settings that routinely support measuring and handling liquids in syringes including hospitals, pharmacies, and the pharmaceutical industry.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7


  1. 1.

    Hatcher I, Sullivan M, Hutchinson J, Thurman S, Gaffney FA. An intravenous medication safety system: preventing high-risk medication errors at the point of care. J Nurs Adm. 2004;34(10):437–9.

    Article  Google Scholar 

  2. 2.

    Aspden P, Wolcott JA, Bootman JL, Cronenwett LR. Preventing medication errors. National Acad. Press; 2007.

  3. 3.

    Yin HS, Mendelsohn AL, Wolf MS, Parker RM, Fierman A, van Schaick L, et al. Parents’ medication administration errors: role of dosing instruments and health literacy. Arch Pediatr Adolesc Med. 2010;164(2):181–6.

    Article  Google Scholar 

  4. 4.

    Kim GR, Chen AR, Arceci RJ, Mitchell SH, Kokoszka KM, Daniel D, et al. Error reduction in pediatric chemotherapy: computerized order entry and failure modes and effects analysis. Arch Pediatr Adolesc Med. 2006;160(5):495–8.

    Article  Google Scholar 

  5. 5.

    Gudeman J, Jozwiakowski M, Chollet J, Randell M. Potential risks of pharmacy compounding. Drugs in R&d. 2013;13(1):1–8.

    Article  Google Scholar 

  6. 6.

    Rich D, Fricker M Jr, Cohen M, Levine S. Guidelines for the safe preparation of sterile compounds: results of the ISMP sterile preparation compounding safety summit of October 2011. Hosp Pharm. 2013;48(4):282–94. https://doi.org/10.1310/hpj4804-282.

    CAS  Article  PubMed  PubMed Central  Google Scholar 

  7. 7.

    Sasich LD, Sukkari SR. Unknown risks of pharmacy-compounded drugs. The Journal of the American Osteopathic Association. 2008;108(2):86-.

  8. 8.

    ISMP list of high-alert medications in acute care settings. Institute for Safe Medication Practices 2014. http://www.ismp.org/tools/highalertmedications.pdf. Accessed 4 Aug 2017.

  9. 9.

    Phillips MS. Standardizing iv infusion concentrations: national survey results. Am J Health Syst Pharm. 2011;68(22):2176–82.

    CAS  Article  Google Scholar 

  10. 10.

    Pedersen CA, Schneider PJ, Scheckelhoff DJ. ASHP national survey of pharmacy practice in hospital settings: dispensing and administration-2011. Am J Health Syst Pharm. 2012;69(9):768–85.

    Article  Google Scholar 

  11. 11.

    Cantrell SA. Improving the quality of compounded sterile drug products: a historical perspective. Ther Innov Regul Sci. 2016;50(3):266–9.

    Article  Google Scholar 

  12. 12.

    Wilson M. Sterile compounding pharmacies: states that do and do not require compliance with USP< 797> versus FDA 483s. Ther Innov Regul Sci. 2016;50(3):279–303.

    Article  Google Scholar 

  13. 13.

    Forcinio H. Trends and best practices in visual inspection: using best practices for manual or automatic inspection can improve the inspection process. Pharm Technol. 2014.

  14. 14.

    Langille SE. Particulate matter in injectable drug products. PDA J Pharm Sci Technol. 2013;67(3):186–200.

    CAS  Article  Google Scholar 

  15. 15.

    Wichtl M. Herbal drugs and phytopharmaceuticals: a handbook for practice on a scientific basis: CRC press; 2004.

  16. 16.

    Chin RT, Harlow CA. Automated visual inspection: a survey. IEEE Trans Pattern Anal Mach Intell. 1982;6:557–73.

    Article  Google Scholar 

  17. 17.

    Singh S, Bharti M. Image processing based automatic visual inspection system for PCBs. ISOR J Eng. 2012;2:1451–5.

    Article  Google Scholar 

  18. 18.

    Gunatilake P, Siegel M, Jordan AG, Podnar GW, editors. Image understanding algorithms for remote visual inspection of aircraft surfaces. Electronic Imaging’97; 1997: International Society for Optics and Photonics.

  19. 19.

    Acquire Images from Webcams. Mathworks, MA, USA. 2016. http://www.mathworks.com/help/supportpkg/usbwebcams/ug/acquire-images-from-webcams.html. Accessed 12 Aug 2016.

  20. 20.

    Mohr D, Zachmann G, editors. FAST: Fast Adaptive Silhouette Area based Template Matching. BMVC; 2010.

  21. 21.

    Banharnsakun A, Tanathong S. Object detection based on template matching through use of best-so-far ABC. Comput Intell Neurosci. 2014;2014:7.

    Article  Google Scholar 

  22. 22.

    Wu Z, Goshtasby A. Adaptive image registration via hierarchical voronoi subdivision. IEEE Trans Image Process. 2012;21(5):2464–73.

    Article  Google Scholar 

  23. 23.

    Roy S, Rathod D. Real-time object tracking and learning using template matching.

  24. 24.

    Chantara W, Mun J-H, Shin D-W, Ho Y-S. Object tracking using adaptive template matching. IEIE Trans Smart Process Comput. 2015;4(1):1–9.

    Article  Google Scholar 

  25. 25.

    Sharmila R, Uma R. A new approach to image contrast enhancement using weighted threshold histogram equalization with improved switching median filter. Int J Adv Eng Sci Technol. 2011;7:206–11.

    Google Scholar 

  26. 26.

    Otsu N. A threshold selection method from gray-level histograms. Automatica. 1975;11(285–296):23–7.

    Google Scholar 

  27. 27.

    Cheriet M, Said JN, Suen CY. A recursive thresholding technique for image segmentation. IEEE Trans Image Process. 1998;7(6):918–21.

    CAS  Article  Google Scholar 

  28. 28.

    Yapa RD, Harada K. A connected component labelling algorithm for greyscale mammography image processing as a pre-processing tool. Mach Graph Vision Int J. 2007;16(3):305–27.

    Google Scholar 

  29. 29.

    Walczyk R, Armitage A, Binnie D. Comparative study on connected component labeling algorithms for embedded video processing systems. 2010.

    Google Scholar 

  30. 30.

    Rudrapatna M, Sowmya A, editors. Feature weighted minimum distance classifier with multi-class confidence estimation. Australasian Joint Conference on Artificial Intelligence; 2006: Springer.

  31. 31.

    Booth D, Oldfield R. A comparison of classification algorithms in terms of speed and accuracy after the application of a post-classification modal filter. Remote Sens. 1989;10(7):1271–6.

    Article  Google Scholar 

  32. 32.

    Gerstner W. Supervised learning for neural networks: a tutorial with Java Exercises. Recurso disponible on-line: http://diwww.epfl.ch/mantra/tutorial/english/supervised.pdf. 1998.

  33. 33.

    Fine S, Scheinberg K. Efficient SVM training using low-rank kernel representations. J Mach Learn Res. 2001;2(Dec):243–64.

    Google Scholar 

  34. 34.

    Vlacic L. Learning and soft computing, support vector machines, neural networks, and fuzzy logic models. Vojislav Kecman; MIT Press, Cambridge, MA, 2001, ISBN 0-262-11255-8, 2001, pp. 578. Elsevier; 2002.

  35. 35.

    Yu H, Wilamowski BM. Levenberg-Marquardt training. Ind Electron Handb. 2011;5(12):1.

    Google Scholar 

Download references

Author information



Corresponding author

Correspondence to Jerry Nesamony.

Electronic Supplementary Material


(DOCX 25 kb)

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Regmi, H.K., Nesamony, J., Pappada, S.M. et al. A System for Real-Time Syringe Classification and Volume Measurement Using a Combination of Image Processing and Artificial Neural Networks. J Pharm Innov 14, 341–358 (2019). https://doi.org/10.1007/s12247-018-9358-5

Download citation


  • Compounded sterile preparations
  • Real-time measurement
  • Syringe volume
  • Dose accuracy
  • Image analysis
  • Artificial neural networks