27 #ifndef _NONA_IMAGEREMAPPER_H
28 #define _NONA_IMAGEREMAPPER_H
40 template <
typename ImageType,
typename AlphaType>
55 vigra::Rect2D outputROI,
74 template <
typename ImageType,
typename AlphaType>
86 typedef std::vector<float>
LUT;
99 unsigned int imgNr, vigra::Rect2D outputROI,
115 template <
class FFType,
class SrcIter,
class SrcAccessor,
class DestIter,
class DestAccessor>
116 void applyFlatfield(vigra::triple<SrcIter, SrcIter, SrcAccessor> srcImg,
117 vigra::pair<DestIter, DestAccessor> destImg,
118 vigra::ImageImportInfo & ffInfo,
122 typename vigra::NumericTraits<typename SrcAccessor::value_type>::RealPromote a,
123 typename vigra::NumericTraits<typename SrcAccessor::value_type>::RealPromote b,
138 #include <vigra/functorexpression.hxx>
142 namespace HuginBase {
146 template <
typename ImageType,
typename AlphaType>
147 RemappedPanoImage<ImageType, AlphaType>*
149 unsigned int imgNr, vigra::Rect2D outputROI,
152 typedef typename ImageType::value_type PixelType;
156 typedef typename vigra::BasicImage<float> FlatImgType;
170 vigra::ImageImportInfo
info(img.getFilename().c_str());
172 int width =
info.width();
173 int height =
info.height();
177 const int r = width % 8;
178 if (r != 0) width += 8 - r;
182 m_remapped->m_ICCProfile =
info.getICCProfile();
184 if (
info.numExtraBands() > 0) {
185 srcAlpha.resize(width, height);
188 bool alpha =
info.numExtraBands() > 0;
189 std::string type =
info.getPixelType();
210 vigra::functor::Arg1()*vigra::functor::Param(scale));
216 vigra::ImageImportInfo ffInfo(img.getFlatfieldFilename().c_str());
218 vigra_precondition(( ffInfo.numBands() == 1),
219 "flatfield vignetting correction: "
220 "Only single channel flatfield images are supported\n");
221 ffImg.resize(ffInfo.width(), ffInfo.height());
237 template <
class FFType,
class SrcIter,
class SrcAccessor,
class DestIter,
class DestAccessor>
239 vigra::pair<DestIter, DestAccessor> destImg,
240 vigra::ImageImportInfo & ffInfo,
244 typename vigra::NumericTraits<typename SrcAccessor::value_type>::RealPromote a,
245 typename vigra::NumericTraits<typename SrcAccessor::value_type>::RealPromote b,
248 FFType ffImg(ffInfo.width(), ffInfo.height());
251 destImg, gamma, gammaMaxVal, division, a, b, dither);
virtual void release(RemappedPanoImage< ImageType, AlphaType > *d)=0
double getMaxValForPixelType(const std::string &v)
virtual void release(RemappedPanoImage< ImageType, AlphaType > *d)
void transformImage(vigra::triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, vigra::triple< DestImageIterator, DestImageIterator, DestAccessor > dest, std::pair< AlphaImageIterator, AlphaAccessor > alpha, vigra::Diff2D destUL, TRANSFORM &transform, PixelTransform &pixelTransform, bool warparound, Interpolator interpol, AppBase::ProgressDisplay *progress, bool singleThreaded=false)
Transform an image into the panorama.
virtual RemappedPanoImage< ImageType, AlphaType > * getRemapped(const PanoramaData &pano, const PanoramaOptions &opts, unsigned int imgNr, vigra::Rect2D outputROI, AppBase::ProgressDisplay *progress)=0
create a remapped pano image.
void remapImage(SrcImgType &srcImg, const MaskImgType &srcAlpha, const FlatImgType &srcFlat, const SrcPanoImage &src, const PanoramaOptions &dest, vigra::Rect2D outputRect, RemappedPanoImage< DestImgType, MaskImgType > &remapped, AppBase::ProgressDisplay *progress)
remap a single image
unsigned int getHeight() const
get panorama height
Contains functions to transform whole images.
void flatfieldVigCorrection(vigra::triple< ImgIter, ImgIter, ImgAccessor > srcImg, vigra::pair< FFIter, FFAccessor > ffImg, vigra::pair< DestIter, DestAccessor > destImg, double gamma, double gammaMaxVal, bool division, typename vigra::NumericTraits< typename ImgAccessor::value_type >::RealPromote a, typename vigra::NumericTraits< typename ImgAccessor::value_type >::RealPromote b, bool dither)
virtual ~SingleImageRemapper()
vigra::pair< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImage(const ROIImage< Image, Mask > &img)
vigra::FRGBImage ImageType
void loadImage(const PanoramaOptions &opts, vigra::ImageImportInfo &info, ImageType &srcImg, AlphaType &srcAlpha)
void applyFlatfield(vigra::triple< SrcIter, SrcIter, SrcAccessor > srcImg, vigra::pair< DestIter, DestAccessor > destImg, vigra::ImageImportInfo &ffInfo, double gamma, double gammaMaxVal, bool division, typename vigra::NumericTraits< typename SrcAccessor::value_type >::RealPromote a, typename vigra::NumericTraits< typename SrcAccessor::value_type >::RealPromote b, bool dither)
load a flatfield image and apply the correction
void setMessage(const std::string &message, const std::string &filename="")
sets the message to given string
functor to create a remapped image
virtual const SrcPanoImage & getImage(std::size_t nr) const =0
get a panorama image, counting starts with 0
RemappedPanoImage< ImageType, AlphaType > * m_remapped
vigra::pair< typename ROIImage< Image, Alpha >::image_traverser, typename ROIImage< Image, Alpha >::ImageAccessor > destImage(ROIImage< Image, Alpha > &img)
vigra::triple< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImageRange(const ROIImage< Image, Mask > &img)
helper function for ROIImages
void importImageAlpha(const ImageImportInfo &import_info, ImageIterator image_iterator, ImageAccessor image_accessor, AlphaIterator alpha_iterator, AlphaAccessor alpha_accessor)
Read the image specified by the given vigra::ImageImportInfo object including its alpha channel...
unsigned int getWidth() const
void setAdvancedOptions(const HuginBase::Nona::AdvancedOptions advancedOptions)
HuginBase::Nona::AdvancedOptions m_advancedOptions
virtual RemappedPanoImage< ImageType, AlphaType > * getRemapped(const PanoramaData &pano, const PanoramaOptions &opts, unsigned int imgNr, vigra::Rect2D outputROI, AppBase::ProgressDisplay *progress)
create a remapped pano image.
std::map< std::string, std::string > AdvancedOptions
static void info(const char *fmt,...)
virtual SrcPanoImage getSrcImage(unsigned imgNr) const =0
get a complete description of a source image
functor to create a remapped image, loads image from disk
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)