Ask Your Question

Revision history [back]

am I getting garbage value instead of RGB while printing out colour of pixels?

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?

Why am I getting garbage value instead of RGB while printing out colour of pixels?

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?

click to hide/show revision 3
now its readable

Why am I getting garbage value instead of RGB while printing out colour of pixels?

This snippet of code prints out garbage values.

cv::Mat_<cv::Vec3b>::iterator it = img.begin<cv::Vec3b>();
cv::Mat_<cv::Vec3b>::iterator itEnd = img.end<cv::Vec3b>();
  

cv::Mat_<cv::vec3b>::iterator it = img.begin<cv::vec3b>(),itEnd = img.end<cv::vec3b>();

for(; it != itEnd; ++it)

++it)

std::cout << (*it)[1] << std::endl;

std::endl;

But this prints out the vector of RGB values.

std::cout <<
  img.at<cv::vec3b>(100,200);

<< 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?

click to hide/show revision 4
No.4 Revision

Why am I getting garbage value instead of RGB while printing out colour of pixels?

This snippet of code prints out garbage values.values. cv::Mat_<cv::vec3b>::iterator it = img.begin<cv::vec3b>(); cv::Mat_<cv::vec3b>::iterator itEnd = img.end<cv::vec3b>();

cv::Mat_<cv::Vec3b>::iterator it = img.begin<cv::Vec3b>();
cv::Mat_<cv::Vec3b>::iterator 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?

click to hide/show revision 5
No.5 Revision

Why am I getting garbage value instead of RGB while printing out colour of pixels?

This snippet of code prints out garbage values. cv::Mat_<cv::vec3b>::iterator it = img.begin<cv::vec3b>(); cv::Mat_<cv::vec3b>::iterator itEnd = img.end<cv::vec3b>();values.

cv::Mat_<cv::Vec3b>::iterator it = img.begin<cv::Vec3b>();
cv::Mat_<cv::Vec3b>::iterator 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?