void loadImages(const std::string& format,
                int num_frames,
                const cv::Size& screen,
                std::vector<cv::Mat>& images) {
  images.clear();
  int downsample = 0;

  for (int t = 0; t < num_frames; t += 1) {
    cv::Mat image;
    std::string file = makeFrameFilename(format, t);
    bool ok = readColorImage(file, image);
    CHECK(ok) << "Could not load image";

    if (t == 0) {
      while (tooBig(image.size(), screen)) {
        cv::pyrDown(image, image);
        downsample += 1;
      }
    } else {
      for (int i = 0; i < downsample; i += 1) {
        cv::pyrDown(image, image);
      }
    }

    images.push_back(image);
  }
}
Beispiel #2
0
void ModelMaker::readData(int fileIndex, bool isSource){
	char dFilePath[30], iFilePath[30];
	sprintf(dFilePath, "data\\depthraw\\%d_raw.txt", fileIndex);
	sprintf(iFilePath, "data\\color\\%d_color.png", fileIndex);

	if(isSource){
		cout << "Reading Source Image "<< fileIndex << "..." ;
		readDepthImage(srcD, dFilePath);
		readColorImage(srcI, iFilePath);
		cout << " Source Point Cloud..." ;
		srcPointCloud.clear();
		srcColorCloud.clear();
		getPointCloud(srcD, srcPointCloud, srcI, srcColorCloud, srcCenter);
	}else{
		cout << "Reading Destination Image "<< fileIndex << "..." ;
		dstPointCloud.clear();
		dstColorCloud.clear();
		readDepthImage(dstD, dFilePath);
		readColorImage(dstI, iFilePath);
		cout << " Point Cloud...";
		getPointCloud(dstD, dstPointCloud, dstI, dstColorCloud, dstCenter);
	}
}