28 #include <vigra/stdimage.hxx>
43 const std::string & basename,
50 unsigned int imgNr = *(usedImgs.begin());
51 std::string fname = pano.
getImage(imgNr).getFilename().c_str();
53 vigra::ImageImportInfo
info(fname.c_str());
54 std::string pixelType =
info.getPixelType();
55 int bands =
info.numBands();
56 int extraBands =
info.numExtraBands();
59 for (UIntSet::const_iterator it = usedImgs.begin()++; it != usedImgs.end(); ++it) {
60 vigra::ImageImportInfo info2(pano.
getImage(*it).getFilename().c_str());
61 if ( pixelType != info2.getPixelType() ) {
63 pano.
getImage(*it).getFilename() <<
" uses " <<
64 info2.getPixelType() <<
" valued pixel, while " <<
65 pano.
getImage(0).getFilename() <<
" uses: " << pixelType);
69 if (info2.numBands() - info2.numExtraBands() != bands - extraBands) {
71 pano.
getImage(*it).getFilename() <<
" has " <<
72 info2.numBands() <<
" channels, while " <<
73 pano.
getImage(0).getFilename() <<
" uses: " << bands);
105 if (bands == 1 || (bands == 2 && extraBands == 1)) {
106 stitchPanoIntern<vigra::FImage, vigra::BImage>(pano, opts, progress, basename, usedImgs, advOptions);
107 }
else if (bands == 3 || (bands == 4 && extraBands == 1)) {
108 stitchPanoIntern<vigra::FRGBImage, vigra::BImage>(pano, opts, progress, basename, usedImgs, advOptions);
110 DEBUG_ERROR(
"unsupported depth, only images with 1 and 3 channel images are supported");
111 throw std::runtime_error(
"unsupported depth, only images with 1 and 3 channel images are supported");
115 if (bands == 1 || (bands == 2 && extraBands == 1)) {
116 if (pixelType ==
"UINT8"||
117 pixelType ==
"INT16" ||
118 pixelType ==
"UINT16" )
120 stitchPanoGray_8_16(pano, opts, progress, basename, usedImgs, pixelType.c_str(), advOptions);
124 }
else if (bands == 3 || (bands == 4 && extraBands == 1)) {
125 if (pixelType ==
"UINT8" ||
126 pixelType ==
"INT16" ||
127 pixelType ==
"UINT16" )
129 stitchPanoRGB_8_16(pano, opts, progress, basename, usedImgs, pixelType.c_str(), advOptions);
137 if (bands == 1 || (bands == 2 && extraBands == 1)) {
138 stitchPanoIntern<FImage,BImage>(pano, opts, progress, basename, usedImgs);
139 }
else if (bands == 3 || (bands == 4 && extraBands == 1)) {
140 stitchPanoIntern<FRGBImage,BImage>(pano, opts, progress, basename, usedImgs);
142 DEBUG_ERROR(
"unsupported depth, only images with 1 and 3 channel images are supported");
143 throw std::runtime_error(
"unsupported depth, only images with 1 and 3 channel images are supported");
std::vector< float > outputEMoRParams
void stitchPanoRGB_8_16(const PanoramaData &pano, const PanoramaOptions &opts, AppBase::ProgressDisplay *progress, const std::string &basename, const UIntSet &usedImgs, const char *pixelType, const AdvancedOptions &advOptions)
#define DEBUG_ASSERT(cond)
void stitchPanoGray_8_16(const PanoramaData &pano, const PanoramaOptions &opts, AppBase::ProgressDisplay *progress, const std::string &basename, const UIntSet &usedImgs, const char *pixelType, const AdvancedOptions &advOptions)
std::set< unsigned int > UIntSet
#define UTILS_THROW(class, msg)
empirical model of response
virtual const SrcPanoImage & getImage(std::size_t nr) const =0
get a panorama image, counting starts with 0
void stitchPanorama(const PanoramaData &pano, const PanoramaOptions &opt, AppBase::ProgressDisplay *progress, const std::string &basename, const UIntSet &usedImgs, const AdvancedOptions &advOptions)
The main stitching function.
void stitchPanoGray_32_float(const PanoramaData &pano, const PanoramaOptions &opts, AppBase::ProgressDisplay *progress, const std::string &basename, const UIntSet &usedImgs, const char *pixelType, const AdvancedOptions &advOptions)
Contains various routines used for stitching panoramas.
void stitchPanoRGB_32_float(const PanoramaData &pano, const PanoramaOptions &opts, AppBase::ProgressDisplay *progress, const std::string &basename, const UIntSet &usedImgs, const char *pixelType, const AdvancedOptions &advOptions)
std::map< std::string, std::string > AdvancedOptions
std::string outputPixelType
static void info(const char *fmt,...)
virtual SrcPanoImage getSrcImage(unsigned imgNr) const =0
get a complete description of a source image
virtual std::size_t getNrOfImages() const =0
number of images.