本文整理汇总了C++中Neighborhood::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Neighborhood::end方法的具体用法?C++ Neighborhood::end怎么用?C++ Neighborhood::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Neighborhood
的用法示例。
在下文中一共展示了Neighborhood::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: neighborhoodsOverlap
bool neighborhoodsOverlap(const Neighborhood &n1, const Neighborhood &n2) {
// both neighborhoods are assumed to be in the same frame
Neighborhood::const_iterator it1, it2;
for (it1 = n1.begin(); it1!=n1.end(); it1++)
for (it2 = n2.begin(); it2 != n2.end(); it2++) {
if ( *it1 == *it2 )
return true;
}
return false;
}
示例2: mergeNeighborhoods
void mergeNeighborhoods(Neighborhood &n1, Neighborhood &n2)
{
Neighborhood::iterator it1, it2;
bool present;
for (it2 = n2.begin(); it2 != n2.end(); it2++) {
present = false;
for (it1 = n1.begin(); it1 != n1.end(); it1++) {
if ( *it1 == *it2 ) {
present = true;
break;
}
}
if (!present) {
n1.push_back( *it2 );
}
}
}
示例3: connectedComponents
void Application::connectedComponents(SparseGraph &G,
Vector<Neighborhood> &components)
{
int N=G.getNumVertices(), componentId=1;
Array1D<bool> mark(N);
mark.setAllTo(false);
for(VertexId i=0 ; i<N ; ++i) {
if(mark[i]) continue;
Neighborhood component;
dfs(G,i,mark,component);
components.push_back(component);
int size=component.size();
cout<<"Component #"<<componentId++<<" "<<size<<" vertices:"<<endl;
for(Neighborhood::iterator cur=component.begin(), end=component.end() ;
cur!=end ; ++cur) {
VertexId id=*cur;
cout<<G.getLabel(id)<<"\t";
}
cout<<endl;
}
}
示例4: main
int main(int argc, char *argv[])
{
int p = 2;
double beta = 10;
int neighbors = 8;
double sigma = 10.0;
double rho = 10.0;
double gamma = 10000.0;
int c;
/* Read command line parameters beta and p. */
while ((c = getopt(argc, argv, "b:p:r:s:g:n:fh")) != -1) {
switch (c)
{
case 'p':
p = atoi(optarg);
break;
case 'b':
beta = atof(optarg);
break;
case 'g':
gamma = atof(optarg);
break;
case 'r':
rho = atof(optarg);
break;
case 's':
sigma = atof(optarg);
break;
case 'n':
neighbors = atoi(optarg);
break;
case '?':
if (optopt == 'p' || optopt == 'b' || optopt == 'g'
|| optopt == 'n' || optopt == 'r'
|| optopt == 's') {
fprintf(stderr, "Option -%c requires an argument.\n",
optopt);
}
else if (isprint(optopt)) {
fprintf(stderr, "Unknown option `-%c'.\n", optopt);
}
else {
fprintf(stderr, "Unknown option character `\\x%x'.\n",
optopt);
}
return 1;
default:
exit(1);
}
}
/*
* Non-option arguments are now in argv from index optind
* to index argc-1
*/
Mat image;
image = imread(argv[optind], CV_LOAD_IMAGE_GRAYSCALE);
if (!image.data) {
cout << "Loading image failed" << endl;
return -1;
}
cout << "Using gamma = " << gamma << endl;
cout << "Using rho = " << rho << endl;
cout << "Using sigma = " << sigma << endl;
Mat_<Tensor> tensors = Mat_<Tensor>::zeros(image.rows, image.cols);
Mat blur, edge, structure, color;
createAnisotropyTensor(tensors, image, sigma, rho, gamma,
blur, edge, structure, color);
imwrite(argv[optind + 1], blur);
imwrite(argv[optind + 2], edge);
imwrite(argv[optind + 3], structure);
imwrite(argv[optind + 4], color);
/*
* Network only handles integer edges, so we increase the scale a bit.
*/
int a;
int b;
a = 100;
b = beta;
/*
* Specify the neighbors of a pixel.
*/
cout << "Creating size " << neighbors << " neighborhood." << endl;
Neighborhood neigh;
if (neighbors >= 4) {
neigh.add( 1, 0, b * 1.0);
neigh.add( 0, 1, b * 1.0);
neigh.add(-1, 0, b * 1.0);
neigh.add( 0,-1, b * 1.0);
}
//.........这里部分代码省略.........