[Solved] The best color to track using opencv


The best way to track object is to transform the video you get from RGB to HSV

//convert frame from BGR to HSV colorspace
cvtColor(cameraFeed,HSV,COLOR_BGR2HSV);

and than use erode() and dilate() function to avoid disorders.

Than using a certain range of HUE values you can select a range of colors.

There isn’t a best color, the important thing is the difference between your object and the background.

enter image description here

Search for green in the ROI

//initial min and max HSV filter values.
//these will be changed using trackbars
int H_MIN = 0;
int H_MAX = 180;
int S_MIN = 0;
int S_MAX = 255;
int V_MIN = 20;
int V_MAX = 50;
//filter HSV image between values and store filtered image to
    //threshold matrix
inRange(HSV,Scalar(H_MIN,S_MIN,V_MIN),Scalar(H_MAX,S_MAX,V_MAX),threshold);

However would be quite useful have your piece of code, just to test what you are saying about shine colours.

solved The best color to track using opencv