本文整理汇总了C++中UIntSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ UIntSet::end方法的具体用法?C++ UIntSet::end怎么用?C++ UIntSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIntSet
的用法示例。
在下文中一共展示了UIntSet::end方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: overlap
vector<UIntSet> getHDRStacks(const PanoramaData & pano, UIntSet allImgs, PanoramaOptions opts)
{
vector<UIntSet> result;
// if no images are available, return empty result vector
if ( allImgs.empty() )
{
return result;
}
UIntSet stack;
CalculateImageOverlap overlap(&pano);
overlap.calculate(10); // we are testing 10*10=100 points
do {
unsigned srcImg = *(allImgs.begin());
stack.insert(srcImg);
allImgs.erase(srcImg);
// find all images that have a suitable overlap.
for (UIntSet::iterator it = allImgs.begin(); it != allImgs.end(); ) {
unsigned srcImg2 = *it;
++it;
if(overlap.getOverlap(srcImg,srcImg2)>opts.outputStacksMinOverlap)
{
stack.insert(srcImg2);
allImgs.erase(srcImg2);
}
}
result.push_back(stack);
stack.clear();
} while (allImgs.size() > 0);
return result;
}
示例2: AddDependentGlyphs
EStatusCode CFFEmbeddedFontWriter::AddDependentGlyphs(UIntVector& ioSubsetGlyphIDs)
{
EStatusCode status = PDFHummus::eSuccess;
UIntSet glyphsSet;
UIntVector::iterator it = ioSubsetGlyphIDs.begin();
bool hasCompositeGlyphs = false;
for(;it != ioSubsetGlyphIDs.end() && PDFHummus::eSuccess == status; ++it)
{
bool localHasCompositeGlyphs;
status = AddComponentGlyphs(*it,glyphsSet,localHasCompositeGlyphs);
hasCompositeGlyphs |= localHasCompositeGlyphs;
}
if(hasCompositeGlyphs)
{
UIntSet::iterator itNewGlyphs;
for(it = ioSubsetGlyphIDs.begin();it != ioSubsetGlyphIDs.end(); ++it)
glyphsSet.insert(*it);
ioSubsetGlyphIDs.clear();
for(itNewGlyphs = glyphsSet.begin(); itNewGlyphs != glyphsSet.end(); ++itNewGlyphs)
ioSubsetGlyphIDs.push_back(*itNewGlyphs);
sort(ioSubsetGlyphIDs.begin(),ioSubsetGlyphIDs.end());
}
return status;
}
示例3: stackPixel
//now you can do dynamic programming, look thinks up on fly
bool CalculateOptimalROI::stackPixel(int i, int j, UIntSet &stack)
{
bool inside = intersection; // start with true for intersection mode and with false for union mode
//check that pixel at each place
for(UIntSet::const_iterator it=stack.begin();it!=stack.end();it++)
{
double xd,yd;
if(transfMap[*it]->transformImgCoord(xd,yd,(double)i,(double)j))
{
if(o_panorama.getImage(*it).isInside(vigra::Point2D(xd,yd)))
{
if (!intersection) {
//if found in a single image, short cut out
inside=true;
break;
}
}
else {
if (intersection) {
//outside of at least one image - return false
inside=false;
break;
}
}
}
}
return inside;
}
示例4: getImagesinROI
UIntSet getImagesinROI (const PanoramaData& pano, const UIntSet activeImages)
{
UIntSet images;
PanoramaOptions opts = pano.getOptions();
for (UIntSet::const_iterator it = activeImages.begin(); it != activeImages.end(); ++it)
{
vigra::Rect2D roi = estimateOutputROI(pano, opts, *it);
if (! (roi.isEmpty())) {
images.insert(*it);
}
}
return images;
}
示例5: AddDependentGlyphs
void TrueTypeEmbeddedFontWriter::AddDependentGlyphs(UIntVector& ioSubsetGlyphIDs)
{
UIntSet glyphsSet;
UIntVector::iterator it = ioSubsetGlyphIDs.begin();
bool hasCompositeGlyphs = false;
for(;it != ioSubsetGlyphIDs.end(); ++it)
hasCompositeGlyphs |= AddComponentGlyphs(*it,glyphsSet);
if(hasCompositeGlyphs)
{
UIntSet::iterator itNewGlyphs;
for(it = ioSubsetGlyphIDs.begin();it != ioSubsetGlyphIDs.end(); ++it)
glyphsSet.insert(*it);
ioSubsetGlyphIDs.clear();
for(itNewGlyphs = glyphsSet.begin(); itNewGlyphs != glyphsSet.end(); ++itNewGlyphs)
ioSubsetGlyphIDs.push_back(*itNewGlyphs);
sort(ioSubsetGlyphIDs.begin(),ioSubsetGlyphIDs.end());
}
}
示例6: getExposureLayers
vector<UIntSet> getExposureLayers(const PanoramaData & pano, UIntSet allImgs, PanoramaOptions opts)
{
vector<UIntSet> result;
// if no images are available, return empty result vector
if ( allImgs.empty() )
{
return result;
}
UIntSet stack;
do {
unsigned srcImg = *(allImgs.begin());
stack.insert(srcImg);
allImgs.erase(srcImg);
// find all images that have a suitable overlap.
SrcPanoImage simg = pano.getSrcImage(srcImg);
double maxEVDiff = opts.outputLayersExposureDiff;
for (UIntSet::iterator it = allImgs.begin(); it != allImgs.end(); ) {
unsigned srcImg2 = *it;
++it;
SrcPanoImage simg2 = pano.getSrcImage(srcImg2);
if ( fabs(simg.getExposureValue() - simg2.getExposureValue()) < maxEVDiff )
{
stack.insert(srcImg2);
allImgs.erase(srcImg2);
}
}
result.push_back(stack);
stack.clear();
} while (allImgs.size() > 0);
return result;
}
示例7: main
int main(int argc, char* argv[])
{
// parse arguments
const char* optstring = "o:i:l:h";
static struct option longOptions[] =
{
{"output", required_argument, NULL, 'o' },
{"image", required_argument, NULL, 'i' },
{"lines", required_argument, NULL, 'l' },
{"help", no_argument, NULL, 'h' },
0
};
UIntSet cmdlineImages;
int c;
int optionIndex = 0;
int nrLines = 5;
string output;
while ((c = getopt_long (argc, argv, optstring, longOptions,&optionIndex)) != -1)
{
switch (c)
{
case 'o':
output = optarg;
break;
case 'h':
usage(argv[0]);
return 0;
case 'i':
{
int imgNr=atoi(optarg);
if((imgNr==0) && (strcmp(optarg,"0")!=0))
{
cerr << "Could not parse image number.";
return 1;
};
cmdlineImages.insert(imgNr);
};
break;
case 'l':
nrLines=atoi(optarg);
if(nrLines<1)
{
cerr << "Could not parse number of lines.";
return 1;
};
break;
case ':':
cerr <<"Option " << longOptions[optionIndex].name << " requires a number" << endl;
return 1;
break;
case '?':
break;
default:
abort ();
}
}
if (argc - optind != 1)
{
cout << "Warning: " << argv[0] << " can only work on one project file at one time" << endl << endl;
usage(argv[0]);
return 1;
};
string input=argv[optind];
// read panorama
Panorama pano;
ifstream prjfile(input.c_str());
if (!prjfile.good())
{
cerr << "could not open script : " << input << endl;
return 1;
}
pano.setFilePrefix(hugin_utils::getPathPrefix(input));
DocumentData::ReadWriteError err = pano.readData(prjfile);
if (err != DocumentData::SUCCESSFUL)
{
cerr << "error while parsing panos tool script: " << input << endl;
cerr << "DocumentData::ReadWriteError code: " << err << endl;
return 1;
}
if(pano.getNrOfImages()==0)
{
cerr << "error: project file does not contains any image" << endl;
cerr << "aborting processing" << endl;
return 1;
};
std::vector<size_t> imagesToProcess;
if(cmdlineImages.size()==0)
{
//no image given, process all
for(size_t i=0;i<pano.getNrOfImages();i++)
{
imagesToProcess.push_back(i);
};
}
//.........这里部分代码省略.........
示例8: runOptimizer
void OptimizePhotometricPanel::runOptimizer(const UIntSet & imgs)
{
DEBUG_TRACE("");
int mode = m_mode_cb->GetSelection();
// check if vignetting and response are linked, display a warning if they are not
// The variables to check:
const HuginBase::ImageVariableGroup::ImageVariableEnum vars[] = {
HuginBase::ImageVariableGroup::IVE_EMoRParams,
HuginBase::ImageVariableGroup::IVE_ResponseType,
HuginBase::ImageVariableGroup::IVE_VigCorrMode,
HuginBase::ImageVariableGroup::IVE_RadialVigCorrCoeff,
HuginBase::ImageVariableGroup::IVE_RadialVigCorrCenterShift
};
// keep a list of commands needed to fix it:
std::vector<PT::PanoCommand *> commands;
HuginBase::ConstImageVariableGroup & lenses = variable_groups->getLenses();
for (size_t i = 0; i < lenses.getNumberOfParts(); i++)
{
std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> links_needed;
links_needed.clear();
for (int v = 0; v < 5; v++)
{
if (!lenses.getVarLinkedInPart(vars[v], i))
{
links_needed.insert(vars[v]);
}
};
if (!links_needed.empty())
{
commands.push_back(new PT::LinkLensVarsCmd(*m_pano, i, links_needed));
}
}
// if the list of commands is empty, all is good and we don't need a warning.
if (!commands.empty()) {
int ok = wxMessageBox(_("The same vignetting and response parameters should\nbe applied for all images of a lens.\nCurrently each image can have different parameters.\nLink parameters?"), _("Link parameters"), wxYES_NO | wxICON_INFORMATION);
if (ok == wxYES) {
// perform all the commands we stocked up earilier.
for (std::vector<PT::PanoCommand *>::iterator it = commands.begin();
it != commands.end(); it++)
{
GlobalCmdHist::getInstance().addCommand(*it);
}
} else {
// free all the commands, the user doesn't want them used.
for (std::vector<PT::PanoCommand *>::iterator it = commands.begin();
it != commands.end(); it++)
{
delete *it;
}
}
}
Panorama optPano = m_pano->getSubset(imgs);
PanoramaOptions opts = optPano.getOptions();
OptimizeVector optvars;
if(mode==OPT_CUSTOM)
{
optvars = getOptimizeVector();
if (optPano.getNrOfImages() != m_pano->getNrOfImages())
{
OptimizeVector o = optvars;
optvars.clear();
for (UIntSet::const_iterator it = imgs.begin(); it != imgs.end(); ++it)
{
optvars.push_back(o[*it]);
}
}
unsigned int countVar=0;
for(unsigned int i=0;i<optvars.size();i++)
{
countVar+=optvars[i].size();
};
if(countVar==0)
{
wxMessageBox(_("You selected no parameters to optimize.\nTherefore optimization will be canceled."), _("Exposure optimization"), wxOK | wxICON_INFORMATION);
return;
};
};
std::vector<vigra_ext::PointPairRGB> m_points;
// extract points only if not done previously
long nPoints = 200;
wxConfigBase::Get()->Read(wxT("/OptimizePhotometric/nRandomPointsPerImage"), & nPoints);
// get parameters for estimation.
nPoints = wxGetNumberFromUser(_("The vignetting and exposure correction is determined by analysing color values in the overlapping areas.\nTo speed up the computation, only a random subset of points is used."),
_("Number of points per image"),
_("Photometric optimization"), nPoints, 0, 32000,
this);
if (nPoints < 0) {
return;
}
wxConfigBase::Get()->Write(wxT("/OptimizePhotometric/nRandomPointsPerImage"),nPoints);
ProgressReporterDialog progress(5.0, _("Photometric alignment"), _("Loading images"));
progress.Show();
//.........这里部分代码省略.........
示例9: calcFOV
FDiff2D CalculateFOV::calcFOV(const PanoramaData& panorama)
{
if (panorama.getNrOfImages() == 0) {
// no change
return FDiff2D(panorama.getOptions().getHFOV(), panorama.getOptions().getVFOV());
}
vigra::Size2D panoSize(360*2,180*2);
// remap into minature pano.
PanoramaOptions opts;
opts.setHFOV(360);
opts.setProjection(PanoramaOptions::EQUIRECTANGULAR);
opts.setWidth(panoSize.x);
opts.setHeight(panoSize.y);
// remap image
// DGSW - make sure the type is correct
vigra::BImage panoAlpha(panoSize.x, panoSize.y,static_cast< unsigned char >(0));
// vigra::BImage panoAlpha(panoSize.x, panoSize.y,0);
Nona::RemappedPanoImage<vigra::BImage, vigra::BImage> remapped;
UIntSet activeImgs = panorama.getActiveImages();
for (UIntSet::iterator it = activeImgs.begin(); it != activeImgs.end(); ++it) {
// for (unsigned int imgNr=0; imgNr < getNrOfImages(); imgNr++) {
// DGSW FIXME - Unreferenced
// const PanoImage & img = getImage(*it);
remapped.setPanoImage(panorama.getSrcImage(*it), opts, vigra::Rect2D(0,0,panoSize.x,panoSize.y));
//remapped.setPanoImage(*this, *it, vigra::Size2D(img.getWidth(), img.getHeight()), opts);
// calculate alpha channel
remapped.calcAlpha();
// copy into global alpha channel.
vigra::copyImageIf(vigra_ext::applyRect(remapped.boundingBox(),
vigra_ext::srcMaskRange(remapped)),
vigra_ext::applyRect(remapped.boundingBox(),
vigra_ext::srcMask(remapped)),
vigra_ext::applyRect(remapped.boundingBox(),
destImage(panoAlpha)));
// vigra::ImageExportInfo imge2("c:/hugin_calcfov_alpha.png");
// exportImage(vigra::srcImageRange(panoAlpha), imge2);
}
// get field of view
FDiff2D ul,lr;
bool found = false;
ul.x = DBL_MAX;
ul.y = DBL_MAX;
lr.x = -DBL_MAX;
lr.y = -DBL_MAX;
for (int v=0; v< panoSize.y; v++) {
for (int h=0; h < panoSize.x; h++) {
if (panoAlpha(h,v)) {
// pixel is valid
if ( ul.x > h ) {
found=true;
ul.x = h;
}
if ( ul.y > v ) {
found=true;
ul.y = v;
}
if ( lr.x < h) {
found=true;
lr.x = h;
}
if ( lr.y < v) {
found=true;
lr.y = v;
}
}
}
}
if (!found) {
// if nothing found, return current fov
return FDiff2D(panorama.getOptions().getHFOV(), panorama.getOptions().getVFOV());
}
ul=ul/2.0;
lr=lr/2.0;
ul.x = ul.x - 180;
ul.y = ul.y - 90;
lr.x = lr.x - 180;
lr.y = lr.y - 90;
FDiff2D fov (2*std::max(fabs(ul.x), fabs(lr.x)), 2*std::max(fabs(ul.y), fabs(lr.y)));
if(fov.x<40)
{
fov.x+=1;
};
return fov;
}
示例10: automatch
CPVector AutoPanoSiftMultiRow::automatch(CPDetectorSetting &setting, Panorama & pano, const UIntSet & imgs,
int nFeatures, int & ret_value, wxWindow *parent)
{
CPVector cps;
if (imgs.size() < 2)
{
return cps;
};
std::vector<wxString> keyFiles(pano.getNrOfImages());
//generate cp for every consecutive image pair
unsigned int counter=0;
for(UIntSet::const_iterator it = imgs.begin(); it != imgs.end(); )
{
if(counter==imgs.size()-1)
break;
counter++;
UIntSet ImagePair;
ImagePair.clear();
ImagePair.insert(*it);
it++;
ImagePair.insert(*it);
AutoPanoSift matcher;
CPVector new_cps;
new_cps.clear();
if(setting.IsTwoStepDetector())
new_cps=matcher.automatch(setting, pano, ImagePair, nFeatures, keyFiles, ret_value, parent);
else
new_cps=matcher.automatch(setting, pano, ImagePair, nFeatures, ret_value, parent);
if(new_cps.size()>0)
AddControlPointsWithCheck(cps,new_cps);
if(ret_value!=0)
{
Cleanup(setting, pano, imgs, keyFiles, parent);
return cps;
};
};
// now connect all image groups
// generate temporary panorama to add all found cps
UIntSet allImgs;
fill_set(allImgs, 0, pano.getNrOfImages()-1);
Panorama optPano=pano.getSubset(allImgs);
for (CPVector::const_iterator it=cps.begin();it!=cps.end();++it)
optPano.addCtrlPoint(*it);
CPGraph graph;
createCPGraph(optPano, graph);
CPComponents comps;
int n = findCPComponents(graph, comps);
if(n>1)
{
UIntSet ImagesGroups;
for(unsigned int i=0;i<n;i++)
{
ImagesGroups.insert(*(comps[i].begin()));
if(comps[i].size()>1)
ImagesGroups.insert(*(comps[i].rbegin()));
};
AutoPanoSift matcher;
CPVector new_cps;
if(setting.IsTwoStepDetector())
new_cps=matcher.automatch(setting, optPano, ImagesGroups, nFeatures, keyFiles, ret_value, parent);
else
new_cps=matcher.automatch(setting, optPano, ImagesGroups, nFeatures, ret_value, parent);
if(new_cps.size()>0)
AddControlPointsWithCheck(cps,new_cps,&optPano);
if(ret_value!=0)
{
Cleanup(setting, pano, imgs, keyFiles, parent);
return cps;
};
createCPGraph(optPano,graph);
n=findCPComponents(graph, comps);
};
if(n==1 && setting.GetOption())
{
//next steps happens only when all images are connected;
//now optimize panorama
PanoramaOptions opts = pano.getOptions();
opts.setProjection(PanoramaOptions::EQUIRECTANGULAR);
// calculate proper scaling, 1:1 resolution.
// Otherwise optimizer distances are meaningless.
opts.setWidth(30000, false);
opts.setHeight(15000);
optPano.setOptions(opts);
int w = optPano.calcOptimalWidth();
opts.setWidth(w);
opts.setHeight(w/2);
optPano.setOptions(opts);
//generate optimize vector, optimize only yaw and pitch
OptimizeVector optvars;
const SrcPanoImage & anchorImage = optPano.getImage(opts.optimizeReferenceImage);
for (unsigned i=0; i < optPano.getNrOfImages(); i++)
{
std::set<std::string> imgopt;
if(i==opts.optimizeReferenceImage)
{
//optimize only anchors pitch, not yaw
imgopt.insert("p");
//.........这里部分代码省略.........
示例11: centerHorizontically
void CenterHorizontally::centerHorizontically(PanoramaData& panorama)
{
vigra::Size2D panoSize(360,180);
// remap into minature pano.
PanoramaOptions opts;
opts.setHFOV(360);
opts.setProjection(PanoramaOptions::EQUIRECTANGULAR);
opts.setWidth(360);
opts.setHeight(180);
// remap image
vigra::BImage panoAlpha(panoSize);
Nona::RemappedPanoImage<vigra::BImage, vigra::BImage> remapped;
// use selected images.
const UIntSet allActiveImgs(panorama.getActiveImages());
if (allActiveImgs.empty())
{
// do nothing if there are no images
return;
}
//only check unlinked images
UIntSet activeImgs;
for (UIntSet::const_iterator it = allActiveImgs.begin(); it!= allActiveImgs.end(); ++it)
{
const SrcPanoImage & img=panorama.getImage(*it);
bool consider=true;
if(img.YawisLinked())
{
for(UIntSet::const_iterator it2=activeImgs.begin(); it2!=activeImgs.end(); ++it2)
{
if(img.YawisLinkedWith(panorama.getSrcImage(*it2)))
{
consider=false;
break;
};
};
};
if(consider)
activeImgs.insert(*it);
};
for (UIntSet::iterator it = activeImgs.begin(); it != activeImgs.end(); ++it)
{
remapped.setPanoImage(panorama.getSrcImage(*it), opts, vigra::Rect2D(0,0,360,180));
// calculate alpha channel
remapped.calcAlpha();
// copy into global alpha channel.
vigra::copyImageIf(vigra_ext::applyRect(remapped.boundingBox(),
vigra_ext::srcMaskRange(remapped)),
vigra_ext::applyRect(remapped.boundingBox(),
vigra_ext::srcMask(remapped)),
vigra_ext::applyRect(remapped.boundingBox(),
destImage(panoAlpha)));
}
// get field of view
std::vector<int> borders;
bool colOccupied = false;
for (int h=0; h < 360; h++) {
bool curColOccupied = false;
for (int v=0; v< 180; v++) {
if (panoAlpha(h,v)) {
// pixel is valid
curColOccupied = true;
}
}
if ((colOccupied && !curColOccupied) ||
(!colOccupied && curColOccupied))
{
// change in position, save point.
borders.push_back(h-180);
colOccupied = curColOccupied;
}
}
int lastidx = borders.size() -1;
if (lastidx == -1) {
// empty pano
return;
}
if (colOccupied) {
// we have reached the right border, and the pano is still valid
// shift right fragments by 360 deg
// |11 2222| -> | 222211 |
std::vector<int> newBorders;
newBorders.push_back(borders[lastidx]);
for (int i = 0; i < lastidx; i++) {
newBorders.push_back(borders[i]+360);
}
borders = newBorders;
}
const double dYaw=(borders[0] + borders[lastidx])/2;
//.........这里部分代码省略.........