32 static void usage(
const char* name)
34 std::cout << name <<
": apply template" << std::endl
37 <<
"Usage: " << name <<
" [options] input.pto" << std::endl
39 <<
" Options:" << std::endl
40 <<
" -o, --output=file.pto Output Hugin PTO file." << std::endl
41 <<
" Default: <filename>_template.pto" << std::endl
42 <<
" --template=template.pto Apply the given template file" << std::endl
43 <<
" -h, --help Shows this help" << std::endl
47 int main(
int argc,
char* argv[])
50 const char* optstring =
"o:t:h";
56 static struct option longOptions[] =
58 {
"output", required_argument, NULL,
'o' },
59 {
"template", required_argument, NULL,
't'},
60 {
"help", no_argument, NULL,
'h' },
66 std::string templateFile;
67 while ((c = getopt_long (argc, argv, optstring, longOptions,
nullptr)) != -1)
75 templateFile = optarg;
78 std::cerr <<
hugin_utils::stripPath(argv[0]) <<
": Template \"" << templateFile <<
"\" not found." << std::endl;
96 if (argc - optind != 1)
98 if (argc - optind < 1)
108 if (templateFile.empty())
114 std::string input=argv[optind];
130 std::cerr <<
"Error: template expects " << newPano.
getNrOfImages() <<
" images," << std::endl
131 <<
" current project contains " << pano.
getNrOfImages() <<
" images" << std::endl
132 <<
" Could not apply template" << std::endl;
145 newSrcImg.setFilename(oldSrcImg.getFilename());
146 if (oldSrcImg.getSize() != newSrcImg.getSize())
149 newSrcImg.
resize(oldSrcImg.getSize(), &vars[i]);
156 if (!vars[i].empty())
170 std::cout << std::endl <<
"Written project file " << output << std::endl;
bool FileExists(const std::string &filename)
checks if file exists
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
std::string GetOutputFilename(const std::string &out, const std::string &in, const std::string &suffix)
construct output filename, if ouput is known return this value otherwise use the input filename and a...
const CPVector & getCtrlPoints() const
get all control point of this Panorama
virtual void updateVariables(const VariableMapVector &vars)
Set the variables.
std::vector< VariableMap > VariableMapVector
std::string getPathPrefix(const std::string &filename)
Get the path to a filename.
std::size_t getNrOfImages() const
number of images.
void setCtrlPoints(const CPVector &points)
set all control points (Ippei: Is this supposed to be 'add' method?)
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...
void resize(const vigra::Size2D &size, VariableMap *potentialLinkedVars)
"resize" image, adjusts all distortion coefficients for usage with a source image of size size potent...
std::string GetHuginVersion()
return a string with version numbers
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
void setSrcImage(unsigned int nr, const SrcPanoImage &img)
set input image parameters
All variables of a source image.
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[])