43 static void usage(
const char* name)
45 std::cout << name <<
": transform pixel coordinates" << std::endl
48 <<
"Usage: " << name <<
" input.pto [ image_nr ]" << std::endl
50 <<
"pano_trafo reads pixel coordinates from standard input and" << std::endl
51 <<
"prints the transformed coordinates to standard output." << std::endl
52 <<
"If you pass an image number on the command line," << std::endl
53 <<
"it reads pairs of coordinates and transforms them." << std::endl
54 <<
"If you don't pass an image number, it will read triplets" << std::endl
55 <<
"of the form <image number> <x coordinate> <y coordinate>" << std::endl
56 <<
"and output the transformed coordinates." << std::endl
58 <<
" -r|--recursive Transform from panorama to image coordinates" << std::endl
59 <<
" -h|--help Shows help" << std::endl
79 std::cerr <<
"not enough memory" ;
83 for ( image = 0 ; image < images ; image++ )
97 double xin , yin , xout , yout ;
99 while ( std::cin >> image >> xin >> yin )
101 if ( image < 0 || image >= images )
103 std::cerr <<
"no image " << image <<
" in pano" << std::endl ;
107 std::cout << xout <<
" " << yout << std::endl ;
112 int main(
int argc,
char* argv[])
115 const char* optstring =
"hr";
116 static struct option longOptions[] =
118 {
"recursive", no_argument, NULL,
'r' },
119 {
"help", no_argument, NULL,
'h' },
124 bool reverse =
false;
125 while ((c = getopt_long(argc, argv, optstring, longOptions,
nullptr)) != -1)
146 if (argc - optind < 1 || argc - optind > 2)
148 std::cerr <<
hugin_utils::stripPath(argv[0]) <<
": Expected one project file and optional one image number" << std::endl;
152 std::string input=argv[optind];
161 std::cout.setf ( std::ios::fixed ) ;
162 std::cout.precision ( 6 ) ;
164 if ( argc - optind == 1 )
175 int imageNumber = atoi(argv[optind+1]);
178 std::cerr <<
"Not enough images in panorama" << std::endl;
193 double xin , yin , xout , yout ;
197 while ( std::cin >> xin >> yin )
200 std::cout << xout <<
" " << yout << std::endl ;
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
void work_on_triplets(const HuginBase::Panorama &pano, bool reverse)
std::string getPathPrefix(const std::string &filename)
Get the path to a filename.
std::size_t getNrOfImages() const
number of images.
bool ReadPTOFile(const std::string &filename, const std::string &prefix="")
read pto file from the given filename into Panorama object it does some checks on the file and issues...
const PanoramaOptions & getOptions() const
returns the options for this panorama
std::string GetHuginVersion()
return a string with version numbers
std::string stripPath(const std::string &filename)
remove the path of a filename (mainly useful for gui display of filenames)
int main(int argc, char *argv[])