42 template <
class TRANSFORM>
46 vigra::Rect2D & imgRect,
47 vigra::BImage & alpha,
49 double maxLength = 180.0)
69 vigra::Rect2D destRect;
74 destRect = destRect & vigra::Rect2D(destSz);
84 cropCenter.
x = src.getCropRect().left() + src.getCropRect().width()/2.0;
85 cropCenter.
y = src.getCropRect().top() + src.getCropRect().height()/2.0;
86 radius2 =
std::min(src.getCropRect().width()/2.0, src.getCropRect().height()/2.0);
87 radius2 = radius2 * radius2;
91 vigra::BImage img(destSz.x, destSz.y, (
unsigned char)0);
92 for (
int y=destRect.top(); y < destRect.bottom(); y++) {
93 for (
int x=destRect.left(); x < destRect.right(); x++) {
97 transf.transformImgCoord(sx,sy, x/scale, y/scale);
100 double dx = sx - cropCenter.
x;
101 double dy = sy - cropCenter.
y;
102 if (dx*dx + dy*dy > radius2) {
133 alpha.resize(img.size());
140 ul.
x = destRect.right();
141 ul.
y = destRect.bottom();
142 lr.
x = destRect.left();
143 lr.
y = destRect.top();
145 for (
int y=destRect.top(); y < destRect.bottom(); y++) {
146 for (
int x=destRect.left(); x < destRect.right(); x++) {
166 if ( ul.
x == destRect.right() || ul.
y == destRect.bottom()
167 || lr.
x == destRect.left()|| lr.
y == destRect.top() ) {
170 imgRect = vigra::Rect2D();
172 initImage(img.upperLeft()+destRect.upperLeft(),
173 img.upperLeft()+destRect.lowerRight(),
189 lr.
x = (lr.
x+1)/scale;
190 lr.
y = (lr.
y+1)/scale;
194 imgRect = dest.
getROI() & imgRect;
206 template <
class TRANSFORM>
208 TRANSFORM & transf, vigra::Rect2D & imgRect,
double maxLength = 180.0)
217 vigra::Rect2D imageRect;
229 std::vector<vigra::Rect2D> res;
230 for (UIntSet::const_iterator it = images.begin();
231 it != images.end(); ++it)
vigra::Rect2D estimateOutputROI(const PanoramaData &pano, const PanoramaOptions &opts, unsigned i, const double maxLength)
bool hasActiveMasks() const
returns true, if image has active masks
Contains functions to transform whole images.
void estimateImageAlpha(const SrcPanoImage &src, const PanoramaOptions &dest, TRANSFORM &transf, vigra::Rect2D &imgRect, vigra::BImage &alpha, double &scale, double maxLength=180.0)
calculate the outline of the image
std::set< unsigned int > UIntSet
const vigra::Rect2D & getROI() const
static std::vector< vigra::Rect2D > computeROIS(const PanoramaData &panorama, const PanoramaOptions &opts, const UIntSet &images)
void estimateImageRect(const SrcPanoImage &src, const PanoramaOptions &dest, TRANSFORM &transf, vigra::Rect2D &imgRect, double maxLength=180.0)
calculate the outline of the image
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
virtual SrcPanoImage getSrcImage(unsigned imgNr) const =0
get a complete description of a source image
bool isInsideMasks(vigra::Point2D p) const
returns true, if point p is inside of one mask polygon
All variables of a source image.
vigra::Size2D getSize() const
get size of output image