Ask Your Question
0

How to display Vec3b single ?

asked 2017-02-08 04:36:09 -0600

Nbb gravatar image

updated 2017-02-08 04:45:58 -0600

I have a cv::Mat color and to print the color I use cout << color.at<cv::vec3b>(row,col); It gives me [100,100,100].

but when I use cout << color.at<cv::vec3b>(row,col)[0] I get weird characters.

Seems like this works

uint8_t r = color.at<cv::Vec3b>(row,col)[0]
cout << unsigned(r);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-02-08 04:44:35 -0600

LBerger gravatar image

Vec3b is an array of char : you have to convert to int:

cout << static_cast<int>(color.at<cv::vec3b>(row,col)[0] );
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-08 04:36:09 -0600

Seen: 1,577 times

Last updated: Feb 08 '17