This snippet of code prints out garbage values.
cv::Mat_<cv::vec3b>::iterator it = img.begin<cv::vec3b>(),itEnd = img.end<cv::vec3b>();
for(; it != itEnd; ++it)
std::cout << (*it)[1] << std::endl;
But this prints out the vector of RGB values.
std::cout << img.at<cv::vec3b>(100,200);
The moment I try to access the individual RGB values I get garbage values printed,
Any reason why this might be happening?