The motor controlling the belt movement will be controlled by a microcontroller. The micro-controller reads the color information or the card number incase a RFID is used and controls a bifurcation mechanics which will be either a moving robot arm for pushing the object to a tray or doing a pick and place operation.
The color can be sensed using a RGB color sensor like TCS230 which provides a pulse width modulated square wave output proportional to the Red/Green/Blue color intensity detected. The number of Red,Green,Blue bags detected can be displayed on a LCD display for information.
You can also implement a heat sealing mechanism for sealing polythene bags at the belt end.
Click on this link to know more about how TCS230 RGB color sensor works!
Link to video of an working system on Youtube