Mat中的元素类型,以及获取

1、Mat图像里元素类型为什么是uchar?

节省空间 https://www.cnblogs.com/happyamyhope/p/7244538.html

2、Mat图像具体元素的获取,用.at()  https://www.cnblogs.com/feifanrensheng/p/8947185.html

灰度图:cout<<(int)gray.at<uchar>(row,col)<<endl;

彩色图:

cout<<img.at<Vec3b>(row,col)<<endl; //b、g、r三元素的向量

cout<<(int)img.at<Vec3b>(row,col)[0]<<endl; //b的值

猜你喜欢

转载自www.cnblogs.com/xixixing/p/12372068.html