Object Sorting based on color using Raspberry Pi and OpenCV

SKU: PAN_RPI_021 Categories: ,


Object Sorting based on color using Raspberry Pi and OpenCV – Sorting of products ( object Segregation) in an industry is a tedious industrial process, which is generally carried out manually. Continuous manual sorting creates quality consistency issues. Segregation based on different characteristics, especially color, requires different equipment for checking and then separating. We have proposed an efficient method that can sort the object based on color. In this project, we are using Raspberry Pi which will be connected to the USB camera. Here we will use the OpenCV wrapper with python for the object sorting according to its color. To start, we need to initialize a colors dictionary that specifies the mapping of the color name (the key to the dictionary) to the RGB tuple (the value of the dictionary). From there, we allocate memory for a NumPy array to store these colors, followed by initializing the list of color names. The next step is to loop over the colors dictionary, followed by updating the NumPy array and the color Names list, respectively. Finally, we convert the NumPy ?image? from the RGB color space to the?L*a*b* color space. The?CIELAB color space also known as CIE L*a*b, Does it express? color as three numerical values,?L*?for the lightness and a* and? b* for the green-red and blue-yellow color components. In order to sort the objects pick and place a robot is used. In this project first, the object will be detected and then segregated and sorted according to the L*a*b* color space. This makes our work more efficient and fast. Object Sorting


The idea behind this is to actually label and tag regions of an image as containing a certain color, we?ll be com puting the Euclidean distance between our dataset of known colors (i.e., the lab array) and the averages of a particular image region. It will sort the objects according to their color and which gives the computer vision to the computer instead of manually doing it. This will automate the color sorting accordingly.


In the existing system, manual human power is used to sort the object according to the color, or a huge complicated design is made to segment the object according to the color, which will take more time and accuracy is also low.


In this proposed system, Raspberry pi is connected with a USB camera where OpenCV wrapper with python is used in which CIELAB color space is used to sort the objects according to its color. This will make our work easier and more efficient.




Object Sorting based on color using Raspb


  • In this project, USB Camera is connected to the Raspberry Pi.
  • USB camera will act as the computer vision for object sorting based on color.
  • Pick and Place Robot is connected to the raspberry pi which will help in sorting the objects.
  • Connect power supply for Raspberry pi
  • Plug the HDMI cable in Raspberry pi from the monitor using VGA to HDMI converter cable
  • Connect USB Mouse and USB keyboard to the Raspberry pi


  • Raspberry Pi
  • USB Camera
  • Pick and Place Robot.
  • SD card
  • Monitor
  • Raspbian Jessie
  • OpenCV
  • Language: Linux
  • Python


The Object Sorting Based on the Object’s Color has been successfully designed. The USB CAMERA will continuously sense the color and goes to respective Object. The color sensing section performed two main tasks; object detection and color recognition. The system is fully automatic and can take objects. The cost-effective system was designed to perform continuous and reliable tasks without human errors using the simplest concepts. The color sorting systems are useful in industries and different household activities. Since this system is mainly controlled by the Microcontroller, the results obtained are more reliable and fast.


Customer Reviews

There are no reviews yet.

Be the first to review “Object Sorting based on color using Raspberry Pi and OpenCV”

This site uses Akismet to reduce spam. Learn how your comment data is processed.