string filename = "/data1/home/duyaru/SDK/xuanwu_sdk_0226/jpeg.value";
std::ifstream inf(filename);
if (!inf.is_open()){
std::cout << "Error opening file";
}
vector<int> res;
while (!inf.eof()){
char d[256];
inf.getline(d,100);
stringstream ss;
ss.clear();
ss.str(d);
// words split by space
while(!ss.fail()){
string a;
ss >> a ;
int value ;
if(a.find_first_of("0123456789") != std::string::npos){
if(a.find_last_of('[')!= std::string::npos) {
value = atoi( a.substr(a.find_last_of("[")+1).c_str());
}
else if(a.find_first_of(']') != std::string::npos){
value = atoi(a.substr(0,a.find_first_of("]")).c_str());
}
else value = atoi(a.c_str()); // << " ";
res.push_b
输入vector生成三通道的Mat
最新推荐文章于 2024-02-19 11:43:58 发布
本文介绍如何将输入的vector数据转换成OpenCV中的三通道Mat图像,适用于计算机视觉处理中的图像数据预处理,涉及OpenCV库的使用和图像通道合成。
摘要由CSDN通过智能技术生成