本文整理汇总了C++中KSpace::sCoord方法的典型用法代码示例。如果您正苦于以下问题:C++ KSpace::sCoord方法的具体用法?C++ KSpace::sCoord怎么用?C++ KSpace::sCoord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KSpace
的用法示例。
在下文中一共展示了KSpace::sCoord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: image
bool
processShape( const std::string & name,
Shape & aShape,
double border_min[],
double border_max[],
double h,
const std::string & namePCLFile = "" )
{
typedef typename Space::RealPoint RealPoint;
typedef typename Space::Integer Integer;
typedef GaussDigitizer< Space, Shape > Digitizer;
typedef KhalimskySpaceND< Space::dimension, Integer > KSpace;
typedef LightImplicitDigitalSurface< KSpace, Digitizer > LightImplicitDigSurface;
typedef HyperRectDomain< Space > Domain;
typedef DigitalSurface< LightImplicitDigSurface > MyDigitalSurface;
typedef typename MyDigitalSurface::ConstIterator ConstIterator;
typedef typename KSpace::Surfel Surfel;
Digitizer dig;
dig.attach( aShape );
dig.init( RealPoint( border_min ), RealPoint( border_max ), h );
Domain domain = dig.getDomain();
typedef typename ImageSelector< Domain, unsigned int >::Type Image;
Image image( domain );
DGtal::imageFromRangeAndValue( domain.begin(), domain.end(), image );
KSpace K;
bool ok = K.init( domain.lowerBound(), domain.upperBound(), true );
if ( ! ok )
{
std::cerr << "[compareShapeEstimators]" << " error in creating KSpace." << std::endl;
return false;
}
try
{
// Extracts shape boundary
SurfelAdjacency< KSpace::dimension > SAdj ( true );
Surfel bel = Surfaces<KSpace>::findABel ( K, dig, 10000 );
LightImplicitDigSurface LightImplDigSurf ( K, dig, SAdj, bel );
MyDigitalSurface surf ( LightImplDigSurf );
typedef typename MyDigitalSurface::ConstIterator SurfelConstIterator;
std::ofstream PCL;
trace.info() << "Filename = "<<namePCLFile<<std::endl;
PCL.open( namePCLFile.c_str() );
//Count the number of points
long int cpt=0;
for(SurfelConstIterator it = surf.begin(), itend=surf.end(); it != itend; ++it)
cpt++;
trace.info() << "Surface size = "<<cpt<<std::endl;
PCL << "# range size = " << surf.size() << std::endl;
PCL << "# h = " << h << std::endl;
PCL << "# .PCD v.7 - Point Cloud Data file format"<< std::endl;
PCL <<" VERSION .7"<<std::endl;
PCL <<" FIELDS x y z"<<std::endl;
PCL <<" SIZE 4 4 4 4"<<std::endl;
PCL <<" TYPE I I I I"<<std::endl;
PCL <<" COUNT 1 1 1 1"<<std::endl;
PCL <<" WIDTH "<< cpt <<std::endl;
PCL <<" HEIGHT 1"<<std::endl;
PCL <<" VIEWPOINT 0 0 0 1 0 0 0"<<std::endl;
PCL <<" POINTS "<< cpt <<std::endl;
PCL <<" DATA ascii"<<std::endl;
PCL <<std::endl;
for(SurfelConstIterator it = surf.begin(), itend=surf.end(); it != itend; ++it)
PCL << K.sCoord(*it , 0) << " " << K.sCoord(*it , 1) <<" "<< K.sCoord(*it , 2) <<std::endl;
PCL.close();
}
catch ( InputException e )
{
std::cerr << "[estimatorCurvatureComparator3D]"
<< " error."
<< e.what() << std::endl;
return false;
}
return true;
}