Color and Shape Recognition of Pills using Image Processing

DOI : 10.17577/IJERTCONV7IS08052

Download Full-Text PDF Cite this Publication

Text Only Version

Color and Shape Recognition of Pills using Image Processing

Ranjitha

Dept. of Electronics and Communication Engineering SMVITM, Bantakal Udupi, India

Swati Shripad Kulkarni

Dept. of Electronics and Communication Engineering SMVITM, Bantakal Udupi, India

Rashmi K H

Dept. of Electronics and Communication Engineering SMVITM, Bantakal Udupi, India

Athmashree A T

Dept. of Electronics and Communication Engineering SMVITM, Bantakal Udupi, India

Abstract India is the second largest country in the world. Indias 2018 population is estimated around 1.35 billion. Around

    1. million people died in India due to the medical errors. Health care has not been the priority in India and government has more other priorities. Patient care and patient safety are main priorities of hospital. The prescription of drugs is increasing day by day among youth and older people. The possibility of misidentification and adverse drug events has been increased. It is very difficult among the elderly people to identify the correct pill which they need to take during their medication. But, due to the lack of knowledge in the medical aspects people are taking the un-prescribed drugs and ending up their life. So, it is mandatory to have pill identification system in-terms of color and shape. For patients, correct pill information is important. Many drug recognition system offer keyword searches based on drug names which may vary from product to product. The pill can be identified using online pill database but this is time consuming and may be erroneous. In this paper, we propose a drug image identification system based on multiple features such as shape and color with the help of raspberry pi and camera by capturing the image and detecting the pill. This is mainly applicable in hospitals which help caretakers to provide correct medication to the patients.

      Keywords Color Recognition, Contour Approximation, OpenCV, Ramer-Douglas Peucker Algorithm, Shape detection.

      1. INTRODUCTION

        In the present world, all the youngsters go to work and the elderly people stays at home. Now-a-days, most of senior citizens face different kinds of issues regarding their health. Due to these health problems, they need to take the different pills at different times. Most of the elderly people are illiterate and dont have knowledge about the pill which they need to consume and at what time. Due to the consumption of wrong pills a person may end up his life. Therefore, it becomes important to have a system which identifies the color and shape of the pill. Some people stay in old-age homes where they are taken care by the nurses. Since, the nurses have to look after many other patients, it becomes difficult for them to remember the name of the tablet, whom to provide it and at what time. Hence, there is a requirement of a system which identifies the shape and color of the pill. As the technology is improved day by day, there are many online websites which help to identify the pill on the stored databases but it is time consuming and may be erroneous. In this paper, we are detecting the color and

        shape of the pill by making use of Raspberry pi, camera, memory card and LCD as Hardware requirements and the Raspbian OS and OpenCV as software specifications.

      2. PROCEDURE

        1. Review Stage

          1. Caban, Jesus J., Adrian Rosebrock, and Terry S. Yoo. "Automatic identification of prescription drugs using shape distribution models." In 2012 19th IEEE International Conference on Image Processing, pp. 1005- 1008. IEEE, 2012: This paper introduces a simple technique to automatically identify prescription drugs within image. The size, shape and color of a pill are represented by using shape distribution model, and this is sampled from the centroid of the drug.

          2. Annasaro, E., and A. Hema. "Color and shape feature extraction and matching in pill identification systems." International Journal of Computer Science and Information Technologies 5, no. 2 (2014): 1011-1015: This paper mainly concentrates on legal and illegal pills based on the features such as color, shape, text if they match it is illegal if not illegal pills. The three steps used are feature extraction, matching, feature retrival.

          3. Guo, Peng, Ronald J. Stanley, Justin G. Cole, Jason R. Hagerty, and William V. Stoecker. "Color Feature-based Pillbox Image Color Recognition." In VISIGRAPP (4: VISAPP), pp. 188-194. 2017: This paper concenterates to reduce the possibility of pill misidentification, and possible adverse effects. The main two models used are HSV and RGB models, HSV attempts to seperate chroma and luminance, whereas RGB model is additive in the sense that the three primary color spectra are added together.

          4. Kim, Dongsun, and Junchul Chun. "Drug Image Retrieval by Shape and Color Similarity of the Medication." In 2011 First ACIS/JNU International Conference on Computers Networks, Systems and Industrial Engineering, pp. 387-

            390. IEEE, 2011: This paper purposes a method to retrieve a drug according to the to the query image. In order to use

            such features for image retrieval we need invariant descriptors for shape and color. The proposed contents- based medication image retrieval system consists of two phases: shape classification and color histogram matching between query and database images.

          5. Moore, Jerry, Gregory Hobson, Gary Waldman, and John Wootton. "A real-time visual inspection system for automated prescription dispensing." In Smc 2000 conference proceedings.2000 IEEE international conference on systems, man and cybernetics. 'cybernetics evolving to systems, humans, organizations, and their complex interactions'(cat. no. 0, vol. 1, pp. 577-582. IEEE, 2000: This paper works on automatically confirm the correctness of an order, deny it, or send the prescrption back. Methodology used is pill recognition, feature extraction, online operation.

          6. Neto, Mateus A. Vieira, Joao WM de Souza, Pedro P. Reboucas Filho, and W. de O. Antonio. "CoforDes: An Invariant Feature Extractor for the Drug Pill Identification." In 2018 IEEE 31st International Symposium on ComputerBased Medical Systems (CBMS), pp. 30-35. IEEE, 2018: The paper was focused on the recognition of medicines using the imprint features which are characters printed on the pill. Feature extraction is a key point in pattern recognition. is responsible for computing relevant features of input images.

          7. Palenichka, Roman, Ahmed Lakhssassi, and MyroslavPalenichka. "Visual attention-guided approach to monitoring of medication dispensing using multi- location feature saliency patterns." In Proceedings of the IEEE International Conference on Computer Vision Workshops, pp. 69-76. 2015: The proposed approach to medication recognition and pill counting is by the attention-focusing mechanisms of the human visual system, which serve to time-efficiently locate and reliably recognize objects of interest in complex, changing, and distractive environment. Maintaining the Integrity of the Specifications

        2. Final Stage

        Initially, using the camera the image is captured. To recognize the color of the pill, the captured image should be converted from RGB image to HSV image, because HSV model describes colors similarly to how human eye tends to perceive. We must define the lower and upper boundaries of the color in the HSV image color space. The mask for the color should be constructed; it is basically creating some specific region of the image. Dilation anderosions processes are carried out, where erosion is useful for removing small white noises. Erosion removes white noise but it also shrinks the object so dilation is used which increases the object area.

        To detect the shape of the pill we use the Ramer-Douglas Peucker algorithm which consists of Contour approximation. Contour approximation is an algorithm for reducing the number of points in a curve with a reduced set of point. In order to perform shape detection, initialize the shape name and approximate the contour.

        Example: If it has three vertices then the shape is triangle or if it has four vertices, it is either a square or rectangle. To determine whether square or rectangle is, compute the aspect ratio. If the aspect ratio is equal then it is a square or else it is a rectangle. In case, if there are no vertices then the shape is assumed as a circle.

        On basis of given vertex count, we were able to accurately label each of the shapes. Firstly, load the image and resize it to the smaller factor so that the shape can be approximated better then keep track of the old height to the new resized height.

        Then, convert the resized image to grayscale and smoothen it where smoothing reduces the frequency noise, and finally threshold it. To identify the shapes of the image, and to find the contours in the thresholded image, compute the centre of the contour then detect the name of the shape using only the contour. Later, multiply the contour (x, y) coordinates by the resize the ratio then draw the contours and name of the shape on the image.

      3. HELPFUL HINTS

        1. Abbreviations and Acronyms

          CIE: Commission on Illumination

          GLCM: Gray Level Co-Occurrence Matrix HSV: Hue Saturation Value

          LBP: Local Binary Patterns LDV: Laser Doppler Velocimetry

          NLM: National Library of Medicine RGB: Red Green Blue

        2. Figures

        Fig. 1. Color and shape detection of white pill.

        Fig. 2. Color and shape detection of pink pill.

      4. AUTHORS PROFILE

        A. Authors and Affiliation

        Organization: Shri Madhwa Vadiraja Institute of Technology and Management

        Affiliated to Visvesvaraya Technological University, Belagavi

        Ranjitha

        Rashmi K H

        Swati Shripad Kulkarni

        Athmashree A T

      5. CONCLUSION

The color and shape of the pill is recognized using Raspberry pi and camera. The corresponding pill color and shape is displayed on the LCD.

Additional work can be performed regarding the detection of size of the pill and also detection of multiple colored pills.

ACKNOWLEDGMENT

First, we would like to thank Dr. H.V Balachandra Achar, HOD of our department for giving us this opportunity to carry out our project by providing all the necessities.

We express our gratitude to Ms. Sowmya Bhat, Assistance Professor for supporting us being our mentor and guiding us throughout.

We would like to thank Mr. Sachin Bhat, Assistant professor and coordinator of project for guiding us.

REFERENCES

  1. Caban, Jesus J., Adrian Rosebrock, and Terry S. Yoo, "Automaticidentification of prescription drugs using shape distribution models." In 2012 19th IEEE International Conference on Image Processing, pp. 1005-1008. IEEE, 2012.

  2. Annasaro, E., and A. Hema. "color and shape feature matching pillidentification systems." International Journal of Computer Science and Information Technologies 5, no. 2 (2014): 1011-1015.

  3. Guo, Peng, Ronald J. Stanley, Justin G. Cole, Jason R. Hagerty, andWilliam V. Stoecker, "Color Feature-based

    Pillbox Image Color Recognition." In VISIGRAPP (4: VISAPP), pp. 188-194. 2017.

  4. Kim, Dongsun, and Junchul Chun, "Drug Image Retrieval by Shape andColor Similarity of the Medication." In 2011 First ACIS/JNU International Conference on Computers, Networks, Systems and Industrial Engineering, pp. 387-390. IEEE, 2011.

  5. Moore, Jerry, Gregory Hobson, Gary Waldman, and John Wootton, "Areal-time visual inspection system for automated prescription dispensing." In Smc 2000 conference proceedings. 2000 IEEE international conference on systems, man and cybernetics. 'cybernetics evolving to systems, humans, organizations, and their complex interactions'(cat. no. 0, vol. 1, pp. 577-582. IEEE, 2000.

  6. Neto, Mateus A. Vieira, Joao WM de Souza, Pedro P. Reboucas Filho, andW. de O. Antonio, "CoforDes: An Invariant Feature Extractor for the Drug Pill Identification." In 2018 IEEE 31st International Symposium on Computer-Based Medical Systems (CBMS), pp. 30-35. IEEE, 2018.

  7. Palenichka, Roman, Ahmed Lakhssassi, and Myroslav Palenichka, "Visualattention-guided approach to monitoring of medication dispensing using multi-location feature saliency patterns." In Proceedings of the IEEE International Conference on Computer Vision Workshops, pp. 69-76. 2015

Leave a Reply