Example #1
0
File: main.cpp Project: CCJY/coliru
int main()
{
	//Exercise 1
	transformIntToStringVector();

	//Exercise 2
	printStrUpper("exercise");

	//Exercise 3
	printEvenValuesOfVectorInt(populateVector());

	//Exercise 4
	printMinMax(populateVector());

	//Exercise 5
	printOddValues(populateVector());

	//Exercise 6/7
	printUniqueValues(populateVector());

	//Exercise 8
	CFileParser parser("file.txt");
	parser.printAll();

	return 0;
}
int main(int argc, const char *argv[])
{
    if(argc<4) {
        printf("too fewer arguments!");
        return -1;
    }
    
//    makeimg();
    IplImage *phase1 = cvLoadImage(argv[1]);
    IplImage *phase2 = cvLoadImage(argv[2]);
    IplImage *phase3 = cvLoadImage(argv[3]);

    ThreeStepPhaseShift decoder(phase1,phase2,phase3);

    decoder.phaseDecode();
    IplImage* wrappedPhase = decoder.getWrappedPhase();
    //IplImage* imgColor = decoder.getColorImage();
    printMinMax(wrappedPhase);
    //cvScale(wrappedPhase, wrappedPhase, 1, 0.5); 
    
    decoder.compute();
    
    IplImage* unwrappedPhase = decoder.getUnwrappedPhase();
    //scale(unwrappedPhase);
    //printMinMax(unwrappedPhase);
    
    IplImage *imgDepth = cvCreateImageHeader(cvGetSize(unwrappedPhase),IPL_DEPTH_32F,1);
    imgDepth->imageData = (char *)decoder.getDepth();
    scale(imgDepth);
    printMinMax(imgDepth);
    //printMinMax(unwrappedPhase);

    cvShowImage("depth",imgDepth);
    cvShowImage("wrapped phase",wrappedPhase);
    cvShowImage("unwrapped phase",unwrappedPhase);
    cvShowImage("mask",boolarr2img(decoder.getMask(),cvGetSize(wrappedPhase)));
    
    cvWaitKey(0);

    return 0;
}
Example #3
0
  void visWorker()
  {
    NamedImage named_img;

    while(!shutdown_)
    {
      if(image_queue_.pop_back(&named_img))
      {
        cv::Mat img;

        if(!named_img.modifier.empty())
        {
          ((cv::Mat) named_img.img).copyTo(img);
          named_img.modifier(img);
        }
        else
        {
          img = named_img.img;
        }

        dvo::visualization::show(named_img.name.c_str(), img);

        if(save_)
        {
          if(image_sequence_lookup_.find(named_img.name) == image_sequence_lookup_.end())
          {
            image_sequence_lookup_[named_img.name] = 0;
          }

          std::stringstream filename;
          filename << named_img.name << "_" << image_sequence_lookup_[named_img.name] << ".png";
          printMinMax(img,  named_img.name.c_str());
          double min, max;

          cv::minMaxLoc(img, &min, &max);

          cv::imwrite(filename.str(), img / max * 255);

          image_sequence_lookup_[named_img.name] += 1;
        }

        if(!external_wait_) // if we call waitKey from more than one thread, we can deadlock :(
          cv::waitKey(3);
      }
    }
  }