28 #include <vigra/copyimage.hxx>
39 vigra::Size2D panoSize(360,180);
49 vigra::BImage panoAlpha(panoSize);
55 if (allActiveImgs.empty())
63 for (UIntSet::const_iterator it = allActiveImgs.begin(); it!= allActiveImgs.end(); ++it)
69 for(UIntSet::const_iterator it2=activeImgs.begin(); it2!=activeImgs.end(); ++it2)
79 activeImgs.insert(*it);
82 for (UIntSet::iterator it = activeImgs.begin(); it != activeImgs.end(); ++it)
97 std::vector<int> borders;
98 bool colOccupied =
false;
99 for (
int h=0;
h < 360;
h++) {
100 bool curColOccupied =
false;
101 for (
int v=0; v< 180 && !curColOccupied; v++) {
102 if (panoAlpha(
h,v)) {
104 curColOccupied =
true;
107 if ((colOccupied && !curColOccupied) ||
108 (!colOccupied && curColOccupied))
111 borders.push_back(
h-180);
112 colOccupied = curColOccupied;
117 const int lastidx = borders.size() -1;
125 if (borders.size() == 1 && borders[0] == -180)
132 std::vector<int> newBorders;
133 newBorders.push_back(borders[lastidx]);
134 for (
int i = 0; i < lastidx; i++) {
135 newBorders.push_back(borders[i]+360);
137 borders = newBorders;
140 const double dYaw=(borders[0] + borders[lastidx])/2;
vigra::triple< ImgIter, ImgIter, ImgAcc > applyRect(vigra::Rect2D &r, vigra::triple< ImgIter, ImgIter, ImgAcc > img)
apply a roi to an image area
void setHeight(unsigned int h)
set panorama height
static void centerHorizontically(PanoramaData &panorama)
void setPanoImage(const SrcPanoImage &src, const PanoramaOptions &dest, vigra::Rect2D roi)
void copyImageIf(SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor src_acc, MaskImageIterator mask_upperleft, MaskAccessor mask_acc, DestImageIterator dest_upperleft, DestAccessor dest_acc)
Contains functions to transform whole images.
virtual void run()
runs the algorithm.
std::set< unsigned int > UIntSet
vigra::Rect2D & boundingBox()
virtual UIntSet getActiveImages() const =0
get active images
virtual const SrcPanoImage & getImage(std::size_t nr) const =0
get a panorama image, counting starts with 0
vigra::pair< typename ROIImage< Image, Alpha >::image_traverser, typename ROIImage< Image, Alpha >::ImageAccessor > destImage(ROIImage< Image, Alpha > &img)
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
vigra::triple< typename ROIImage< Image, Alpha >::mask_const_traverser, typename ROIImage< Image, Alpha >::mask_const_traverser, typename ROIImage< Image, Alpha >::MaskConstAccessor > srcMaskRange(const ROIImage< Image, Alpha > &img)
vigra::pair< typename ROIImage< Image, Alpha >::mask_const_traverser, typename ROIImage< Image, Alpha >::MaskConstAccessor > srcMask(const ROIImage< Image, Alpha > &img)
void calcAlpha()
calculate only the alpha channel.
virtual SrcPanoImage getSrcImage(unsigned imgNr) const =0
get a complete description of a source image
All variables of a source image.
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
struct to hold a image state for stitching
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true