#include<iostream> #include<opencv2/opencv.hpp> #include<string> #include<fstream> using namespace std; using namespace cv; int char_int(const char *d) { int sum = atoi(d); return(int)sum; } int main() { string prePath = "F:\\zyq\\Jason2txt\\leftImg8bit\\use\\"; ifstream intxt("sample_pos1.txt"); string line; string picName; //if (intxt) //{ // while (getline(intxt, line)) // { // //cout << line << endl; // size_t p = 0; // while (string::npos != p) // { // cout << line.substr(p, line.find(" ")); // p = line.find("", p + 1); // } // } //} string S = "erfurt_000041_000019_leftImg8bit.png 8 851 417 37 89 799 416 31 75 762 409 33 81 1425 394 69 169 1860 338 131 317 -57 307 167 406 148 325 166 405 1549 451 49 118"; //cout << line << endl; size_t p = S.find(" "); size_t temp; cout << S.substr(0, p)<<endl; //输入图片名字 int a[30][4]; int count = 0; int i = 0; int j = 0; while (string::npos != p) { temp = p; p = S.find(" ", temp+1); string tempStr = S.substr(temp + 1, p - temp - 1); // tempStr = +"\0"; int temp1 = char_int(tempStr.c_str()); if (!count) { count = temp1; cout << count << endl; continue; } //cout << temp1 << endl; a[i][j++] = temp1; if (4 == j) { j = 0; ++i; } } for (int i = 0; i < count; i++) for (int j = 0; j < 4; j++) cout << a[i][j]<<endl; system("pause"); }
被库函数整崩溃了
猜你喜欢
转载自blog.csdn.net/qq_24950821/article/details/80357257
今日推荐
周排行