I meet a problem when I want to scan through H channel and print its pixel values after splitting a HSV image.The problem is that the outputs are not numbers but messy codes.
Following is my code(using Opencv):
Mat hsv;
cvtColor(saveImage,hsv,CV_BGR2HSV);// convert BRG to HSV
vector<cv::Mat> v_channel;
split(hsv,v_channel); //split into three channels
if (v_channel[0].data==0) //channel[0] is Hue
{
cout<<"Error getting the Hue***********"<<endl;
}
for (int i=0;i<hue.rows;i++) //scan through Hue
{
for (int j=0;j<hue.cols;j++)
{
cout<<v_channel[0].at<uchar>(i,j)<<endl;
}
}
Hope anyone could help . Thanks very much!