本文整理汇总了C++中ap::real_1d_array::gethighbound方法的典型用法代码示例。如果您正苦于以下问题:C++ real_1d_array::gethighbound方法的具体用法?C++ real_1d_array::gethighbound怎么用?C++ real_1d_array::gethighbound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ap::real_1d_array
的用法示例。
在下文中一共展示了real_1d_array::gethighbound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newiteration_residOpticalFlow_mt
//===============================
//=====================================================================
void newiteration_residOpticalFlow_mt(int iter, const ap::real_1d_array& x, double f,const ap::real_1d_array& g, void *params)
{
globs_LBFGS_ *glob_param=(globs_LBFGS_*)params;
double normG=0.0;
for(int ii=g.getlowbound();ii<=g.gethighbound();ii++) normG+=g(ii)*g(ii);
normG=sqrt(normG);
cout<<"Iter="<<iter<<";fData="<<glob_param->fData<<";fSmooth="<<glob_param->fSmooth<<";fData+lambda*fSmooth="<<f<<";RMS(g)="<<normG/((double)(g.gethighbound()-g.getlowbound()+1))<<endl;
}
示例2: funcgrad_residOpticalFlow_mt
/*
*
* The cost function considered here is the following (with u(x,y,z),v(x,y,z),w(x,y,z) the flow at each pixel or super-pixel)
*
* E(u,v,w)=\sum_{s\inS}\sum_{n\in s} Huber(r(u_s,v_s,w_s),deltaHdataTerm) + \lambda \sum_{s \in S}\sum_{a\in Neigh(s) s.t. a<s} \left[ Huber(u_s-u_a,deltaHsmoothTerm) + Huber(v_s-v_a,deltaHsmoothTerm) + Huber(w_s-w_a,deltaHsmoothTerm) \right]
*
* S is the set of superpixels (stores in the partition). Thus, we impose that the flow is the same for voxels belonging to teh same supervoxel
*
* r(u,v,w)=I(x+u,y+v,z+w,t+1)-I(x,y,z,t)=imTarget(p+uvw)-imSource(p)
*
* I(x+u,y+v,z+w,t+1) and its partial derivatives need to be calculated using interpolation. As usual it is a trade-off between accuracy and speed.
*/
void funcgrad_residOpticalFlow_mt (ap::real_1d_array x, double& f, ap::real_1d_array& g, void *params)
{
#define INTERP_TRILINEAR //decides the kind of interpolation we want
globs_LBFGS_ *glob_param=(globs_LBFGS_*)params;
mylib::Partition* imTargetPartition=glob_param->imTargetPartition;
mylib::Array* imSource=glob_param->imSource;
mylib::Array* imTarget=glob_param->imTarget;
mylib::Array* imTarget_dx=glob_param->imTarget_dx;
mylib::Array* imTarget_dy=glob_param->imTarget_dy;
mylib::Array* imTarget_dz=glob_param->imTarget_dz;
vector<vector<pair<int,double> > >* partitionNeigh=glob_param->partitionNeigh;
//mylib::Region** regionPvec=glob_param->regionPvec;
double lambda=glob_param->lambda;
double deltaHsmoothTerm=glob_param->deltaHsmoothTerm;
//double deltaHdataTerm=glob_param->deltaHdataTerm;
//float* scale=glob_param->scale;
if(imSource->type!=mylib::UINT16_TYPE || imTarget->type!=mylib::UINT16_TYPE)
{
cout<<"ERROR: funcgrad_residOpticalFlow: code expects UINT16 images"<<endl;
exit(2);
}
//mylib::uint16* imSourcePtr=(mylib::uint16*)(imSource->data);
//initialize residual and gradient
int numPartitions=mylib::Get_Partition_Vertex_Count(imTargetPartition);
f=0;
double fSmooth=0;
memset(g.getcontent(),0,sizeof(double)*3*numPartitions);
int sizeX=x.gethighbound()-x.getlowbound()+1;
if(3*numPartitions!=sizeX)
{
cout<<"ERROR: funcgrad_residOpticalFlow: size of unknowns does not much number of image regions"<<endl;
exit(2);
}
int numPpos=0,numNeighPos=0;
//int *listedges=NULL;
//int nedges=0;;
double fAux,gAux,auxU,auxV,auxW;
//int ndims=imTarget->ndims;
//--------------------------
/*
//needed if we calculate data term directly in here instead of calling the function calculateDataTermOneRegion
mylib::Size_Type k;
mylib::Indx_Type p;
double auxI,der;
mylib::Coordinate *c=mylib::Make_Array(mylib::PLAIN_KIND,mylib::DIMN_TYPE,1,&ndims);
//memset(gAux,0,sizeof(double)*(ndims));
mylib::Region* regionP=NULL;
double* xx=new double[imTarget->ndims];
*/
//-------------------------
#ifdef INTERP_TRILINEAR
const mylib::Array** imTargetDer=(const mylib::Array**)malloc(sizeof(mylib::Array*)*imTarget->ndims);
imTargetDer[0]=imTarget_dx;imTargetDer[1]=imTarget_dy;imTargetDer[2]=imTarget_dz;
#endif
mylib::Use_Array_Basis(imTarget);//set basis to get all the coordinate indexes
//-------------------------------------------
/*
const int numThreads=12;
double* fVec=new double[numThreads];
boost::thread_group threads;
int numPini=0,numPend=0;
int step=(int)floor(double(numPartitions)/double(numThreads));
for (int i = 0; i < numThreads-1; ++i)
{
numPend+=step;
threads.create_thread(fDataTermThread(regionPvec,imTarget,imTargetDer,imSourcePtr,x.getcontent(),scale,deltaHdataTerm,fVec[i],g.getcontent(),numPini,numPend));
numPini+=step;
}
threads.create_thread(fDataTermThread(regionPvec,imTarget,imTargetDer,imSourcePtr,x.getcontent(),scale,deltaHdataTerm,fVec[numThreads-1],g.getcontent(),numPini,numPartitions));//residual
threads.join_all();
for (int i = 0; i < numThreads; ++i) f+=fVec[i];
delete[] fVec;
*/
//---------------------------------------------------------------------
//.........这里部分代码省略.........