本文整理汇总了C++中ImageView::getBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageView::getBounds方法的具体用法?C++ ImageView::getBounds怎么用?C++ ImageView::getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageView
的用法示例。
在下文中一共展示了ImageView::getBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTo
double PhotonArray::addTo(ImageView<T> target) const
{
Bounds<int> b = target.getBounds();
if (!b.isDefined())
throw std::runtime_error("Attempting to PhotonArray::addTo an Image with"
" undefined Bounds");
// Factor to turn flux into surface brightness in an Image pixel
dbg<<"In PhotonArray::addTo\n";
dbg<<"bounds = "<<b<<std::endl;
double addedFlux = 0.;
#ifdef DEBUGLOGGING
double totalFlux = 0.;
double lostFlux = 0.;
int nx = target.getXMax()-target.getXMin()+1;
int ny = target.getYMax()-target.getYMin()+1;
std::vector<std::vector<double> > posFlux(nx,std::vector<double>(ny,0.));
std::vector<std::vector<double> > negFlux(nx,std::vector<double>(ny,0.));
#endif
for (int i=0; i<int(size()); i++) {
int ix = int(floor(_x[i] + 0.5));
int iy = int(floor(_y[i] + 0.5));
#ifdef DEBUGLOGGING
totalFlux += _flux[i];
xdbg<<" photon: ("<<_x[i]<<','<<_y[i]<<") f = "<<_flux[i]<<std::endl;
#endif
if (b.includes(ix,iy)) {
#ifdef DEBUGLOGGING
if (_flux[i] > 0.) posFlux[ix-target.getXMin()][iy-target.getXMin()] += _flux[i];
else negFlux[ix-target.getXMin()][iy-target.getXMin()] -= _flux[i];
#endif
target(ix,iy) += _flux[i];
addedFlux += _flux[i];
} else {
#ifdef DEBUGLOGGING
xdbg<<"lost flux at ix = "<<ix<<", iy = "<<iy<<" with flux = "<<_flux[i]<<std::endl;
lostFlux += _flux[i];
#endif
}
}
#ifdef DEBUGLOGGING
dbg<<"totalFlux = "<<totalFlux<<std::endl;
dbg<<"addedlFlux = "<<addedFlux<<std::endl;
dbg<<"lostFlux = "<<lostFlux<<std::endl;
for(int ix=0;ix<nx;++ix) {
for(int iy=0;iy<ny;++iy) {
double pos = posFlux[ix][iy];
double neg = negFlux[ix][iy];
double tot = pos + neg;
if (tot > 0.) {
xdbg<<"eta("<<ix+target.getXMin()<<','<<iy+target.getXMin()<<") = "<<
neg<<" / "<<tot<<" = "<<neg/tot<<std::endl;
}
}
}
#endif
return addedFlux;
}