예제 #1
0
void fitLines(const cv::Mat &edges, LFLineFitter &lineFitter)
{
  Ptr<Image<uchar> > fdcmEdges;
  cv2fdcm(edges, fdcmEdges);
  lineFitter.Init();
  lineFitter.FitLine(fdcmEdges);
}
예제 #2
0
void main(int argc, char *argv[])
{
	//IplImage *inputImage=NULL;
	Image<uchar> *inputImage=NULL;
	LFLineFitter lf;

	if(argc != 4)
	{
		std::cerr<<"[Syntax] fitline   input_edgeMap.pgm   output_line.txt   output_edgeMap.pgm"<<std::endl;
		exit(0);
	}

	string imageName(argv[1]);
	string outFilename(argv[2]);
	string outputImageName(argv[3]);
	
	//string imageName("data/hat_edges.pgm");
	//string outFilename("data/hat_edges.txt");
	//string outputImageName("data/hat_edges_display.pgm");

	
	//inputImage = cvLoadImage(imageName.c_str(),0);
	inputImage = ImageIO::LoadPGM(imageName.c_str());
	if(inputImage==NULL)
	{
		std::cerr<<"[ERROR] Fail in reading image "<<imageName<<std::endl;
		exit(0);
	}
	
	lf.Init();
	
	lf.Configure("para_template_line_fitter.txt");
	
	lf.FitLine(inputImage);

	lf.DisplayEdgeMap(inputImage,outputImageName.c_str());	

	lf.SaveEdgeMap(outFilename.c_str());

	//cvReleaseImage(&inputImage);
	delete inputImage;
};