23 #include <vigra/stdimage.hxx>
24 #include <vigra/transformimage.hxx>
41 std::vector<deghosting::BImagePtr>
threshold(
const std::vector<deghosting::FImagePtr> &inputImages,
const double threshold,
const uint16_t
flags) {
42 std::vector<deghosting::BImagePtr> retVal;
43 const uint8_t minValue = 0;
44 const uint8_t maxValue = 255;
48 for (
unsigned int i=0; i < inputImages.size(); ++i) {
51 vigra::Threshold<vigra::FImage::PixelType, vigra::BImage::PixelType>(threshold, 255, 0, 255));
52 retVal.push_back(tmpImg);
58 std::vector<vigra::FImage::traverser> siterators(inputImages.size());
59 std::vector<vigra::BImage::traverser> diterators(inputImages.size());
61 vigra::FImage::traverser send = inputImages[0]->lowerRight();
63 for (
unsigned int i=0; i < inputImages.size(); ++i) {
66 retVal.push_back(tmpImg);
68 siterators[i] = inputImages[i]->upperLeft();
69 diterators[i] = retVal[i]->upperLeft();
75 while (siterators[0].y != send.y) {
77 std::vector<vigra::FImage::traverser> siteratorsX(inputImages.size());
78 std::vector<vigra::BImage::traverser> diteratorsX(inputImages.size());
79 for (
unsigned int i=0; i < inputImages.size(); ++i) {
80 siteratorsX[i] = siterators[i];
81 diteratorsX[i] = diterators[i];
84 while (siteratorsX[0].x != send.x) {
86 unsigned int highestI = 0;
87 for (
unsigned int i=0; i<inputImages.size(); ++i) {
90 *(diteratorsX[i]) = minValue;
92 *(diteratorsX[i]) = maxValue;
94 highestI = (*(siteratorsX[highestI]) > *(siteratorsX[i])) ? highestI : i;
97 *(diteratorsX[highestI]) = maxValue;
100 for (
unsigned int i=0; i<inputImages.size(); ++i) {
106 for (
unsigned int i=0; i<inputImages.size(); ++i) {
const uint16_t ONE_UNMASKED
Advanced threshold Copyright (C) 2009 Lukáš Jirkovský l.jirkovsky@gmail.com
std::shared_ptr< vigra::BImage > BImagePtr
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.
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
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
const uint16_t THRESHOLD_DONTCARE