Color Image Processing is our 4th Exercise. The objective of this exercise is to detect an object using color spaces. For this exercise our object is a pig with green tag. We need to detect the pig and the green tag. I use HSV color space for detecting the green tag and YCRCB color space for detecting the pig. The range of minimum and maximum for the pig detection is hardcoded. I use this http://www.wseas.us/e-library/conferences/2011/Mexico/CEMATH/CEMATH-20.pdf as reference for detecting the pig. I cleaned the images using opening method with a kernel size of 20. Here are my sample outputs detecting the green tag: Some bad outputs detecting the pig: The rest of the pig detection are okay: