48 std::set_intersection(
activeImages.begin(),
activeImages.end(), visibleImages.begin(), visibleImages.end(), std::inserter(updatedImages, updatedImages.begin()));
68 catch(std::bad_alloc&)
79 transfMap.insert(std::pair<unsigned int,PTools::Transform*>(*it,transf));
100 for (std::map<unsigned int, PTools::Transform*>::iterator it =
transfMap.begin(); it !=
transfMap.end(); ++it)
111 for(UIntSet::const_iterator it=stack.begin();it!=stack.end();++it)
114 if(
transfMap[*it]->transformImgCoord(xd,yd,(
double)i,(
double)j))
152 for (
unsigned s=0; s <
stacks.size(); s++)
183 if (rect.left() < rect.right() && rect.top() < rect.bottom())
186 if(maxvalue>0 && rect.area()<maxvalue)
191 std::list<vigra::Rect2D>::iterator it=std::find(testingRects.begin(), testingRects.end(), rect);
192 if (it == testingRects.end())
194 testingRects.push_back(rect);
202 for (
int i = rect.left(); i<rect.right(); i++)
210 for (
int j = rect.top(); j<rect.bottom(); j++)
220 vigra::Rect2D
ModifyRect(
const vigra::Rect2D& rect,
long deltaLeft,
long deltaTop,
long deltaRight,
long deltaBottom)
222 vigra::Rect2D newRect(rect);
223 newRect.moveBy(deltaLeft, deltaTop);
224 newRect.addSize(vigra::Size2D(deltaRight - deltaLeft, deltaBottom - deltaTop));
230 std::list<vigra::Rect2D> testRects;
231 testRects.push_back(rect);
233 while(!testRects.empty())
235 vigra::Rect2D testingRect = *testRects.begin();
237 switch(searchStrategy)
251 if(maxvalue<testingRect.area())
253 maxvalue=testingRect.area();
268 if(maxvalue<testingRect.area())
270 maxvalue = testingRect.area();
297 if(maxvalue<testingRect.area())
299 maxvalue = testingRect.area();
304 testRects.pop_front();
323 for(
int acc=startacc;acc>=64;acc/=2)
332 #ifdef PRINT_DEBUG_VALUES
343 for(
int acc=startacc;acc>=1;acc/=2)
352 #ifdef PRINT_DEBUG_VALUES
360 for(
int acc=startacc;acc>=1;acc/=2)
362 #ifdef PRINT_DEBUG_VALUES
390 return vigra::Rect2D();
397 if (activeImgs.empty())
404 opts.
setROI(vigra::Rect2D(vigra::Point2D(0, 0), opts.
getSize()));
407 for (
auto& img : activeImgs)
declaration of functions to handle stacks and layers
void AddCheckingRects(std::list< vigra::Rect2D > &testingRects, const vigra::Rect2D &rect, const long maxvalue)
add new rect to list of rects to be check, do some checks before
bool CheckRectCoversPano(const vigra::Rect2D &rect)
check if given rect covers the whole pano
bool CalcOutsideCrop(PanoramaData &pano, AppBase::ProgressDisplay *progress)
the main crop finding algorithm
std::vector< bool > testedPixels
vigra::Rect2D estimateOutputROI(const PanoramaData &pano, const PanoramaOptions &opts, unsigned i, const double maxLength)
UIntSet getImagesinROI(const PanoramaData &pano, const UIntSet activeImages)
returns set of images which are visible in output ROI
void setMaximum(int newMaximum)
sets the new maximum value of the progress value
bool isInside(vigra::Point2D p, bool ignoreMasks=false) const
check if a coordinate is inside the source image
vigra::Size2D o_optimalSize
void nonreccheck(const vigra::Rect2D &rect, int acc, int searchStrategy, long &maxvalue)
void setStacks(std::vector< UIntSet > hdr_stacks)
sets the stack vector
std::vector< UIntSet > stacks
std::set< unsigned int > UIntSet
bool wasCancelled()
return true, if process should be canceled by user e.g.
virtual AppBase::ProgressDisplay * getProgressDisplay() const
std::vector< bool > pixels
virtual UIntSet getActiveImages() const =0
get active images
float pow(float a, double b)
bool stackPixel(int i, int j, UIntSet &stack)
vigra::Rect2D ModifyRect(const vigra::Rect2D &rect, long deltaLeft, long deltaTop, long deltaRight, long deltaBottom)
virtual const PanoramaOptions & getOptions() const =0
returns the options for this panorama
virtual const SrcPanoImage & getImage(std::size_t nr) const =0
get a panorama image, counting starts with 0
void setROI(const vigra::Rect2D &val)
bool imgPixel(int i, int j)
virtual vigra::Rect2D getResultOptimalROI()
returns the found crop rect
PanoramaData & o_panorama
bool calcOptimalROI(PanoramaData &panorama)
std::map< unsigned int, PTools::Transform * > transfMap
All variables of a source image.
vigra::Size2D getSize() const
get size of output image
virtual bool hasRunSuccessfully()
bool updateDisplayValue()