If the distinct contents/ingredients really have different colors than you just have to take a picture, always in the same location/distance, and then count the amount of pixels for each color.
You can transform your RGB image to the HSV color space to make it easy to identify specific colors.
image_hsv = rgb2hsv(image_rgb)
greenmax = ...
I didn't read the paper but let me provide some intuition about object detection and tracking. When you try to track a target in a video, object detection algorithms might not be enough and you need to support the algorithm with target tracking methods in bayesian framework. It could be Kalman filter or particle filter.
In particle filter or any Bayesian ...