1 | initial version |
First you have to choose color space
To convert an image from one color space to another. use cvtColor function
to get pixel color use :
Mat img=imread("lena.jpg",cv::IMREAD_COLOR);
cout<<img.at<Vec3b>(lig,col);
Mat hsv;
cvtColor(img,hsv,cv::COLOR_BGR2HSV);
cout<<hsv.at<Vec3b>(lig,col);
(result [111, 144, 230][8, 132, 230])
Similarity between colors will depend of context...