AnnotatedDatasetInfo getAnnotatedImageData(Mat Image, string datafile){ AnnotatedDatasetInfo info; int rows = 240; int cols = 320; float depth = 50.00; Mat_<signed short int> Labels(rows, cols, CV_16SC1); vector< vector<Point> > Points(1); Mat_<Vec3f> Depths(rows, cols, CV_32FC3); // datafile is binary image that represent object mask // 1 represent object, 0 means non object ifstream ImgData(datafile.c_str()); int row = 0; if (ImgData.is_open()){ while (ImgData.good()) { string line; getline(ImgData, line); if(line.length() == 0) continue; int col = 0; for(unsigned int i = 0 ; i < line.length() ; i++){ char ch = line[i]; // add data into "Labels" if(ch != ' '){ if(ch == '1') { Labels(row, col) = 0; // add Point (row, col) in points for class 2 Point p(col, row); Points[0].push_back(p); } else { Labels(row, col) = -3; // add Point (row, col) in points for class 1 //Point p(col, row); //Points[0].push_back(p); } // add depth into "Depths" // Depths is a R X C X 3 matrix where each pixel has (X,Y,Z) location in world coords Depths(row, col) = Vec3f(float(col), float(row), depth); col++; } } row++; } ImgData.close(); } else cout << "Unable to open file"; info.Labels = Labels; info.Points = Points; info.Depths = Depths; return info; }
void Declarations() { while(strchr("lctvpf", Look)) { switch(Look) { case 'l': Labels(); case 'c': Constants(); case 't': Types(); case 'v': Variables(); case 'p': DoProcedure(); case 'f': DoFunction(); } } }
void Declarations(){ int other = 0; while(!other){ switch(Look){ case 'l' : Labels(); break; case 'c' : Constants(); break; case 't' : Types(); break; case 'v' : Variables(); break; case 'p' : DoProcedure(); break; case 'f' : DoFunction(); break; default : other = 1; } } }