当前位置: 首页>>代码示例>>C++>>正文


C++ Segments类代码示例

本文整理汇总了C++中Segments的典型用法代码示例。如果您正苦于以下问题:C++ Segments类的具体用法?C++ Segments怎么用?C++ Segments使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Segments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculateFeatureMatrix

cv::Mat OpenCvDetector::calculateFeatureMatrix(const Segments& segments)
{
    cv::Mat featureMatrix(segments.size(), m_featureDimensions.size(), CV_32FC1);

    for(size_t i = 0; i < segments.size(); i++) {
        const Segment& segment = segments[i];
        std::map<FeatureDimension, float> featureValueLookup; // one entry per dimension per feature

        for(size_t j = 0; j < m_features.size(); j++) { 
            Feature::Ptr feature = m_features[j];
            Eigen::VectorXd values;
            feature->evaluate(segment, values);

            // Each feature can have multiple dimensions, store these in a map so we can look up
            // the requested dimensions in the next step
            for(size_t dim = 0; dim < feature->getNDimensions(); dim++) { 
                featureValueLookup[ feature->getDescription(dim) ] = values(dim);
            }
        }

        // Look up the requested dimensions
        for(size_t k = 0; k < m_featureDimensions.size(); k++) { 
            const FeatureDimension& featureDescription = m_featureDimensions[k];
            featureMatrix.at<float>(i, k) = featureValueLookup[featureDescription];
        }
    }

    return featureMatrix;
}
开发者ID:Aharobot,项目名称:spencer_people_tracking,代码行数:29,代码来源:opencv_detector.cpp

示例2: Convert

Segments Conversion::Convert(const Segments& input) const {
  Segments output;
  for (const auto& segment : input) {
    output.AddSegment(Convert(segment));
  }
  return output;
}
开发者ID:huoxudong125,项目名称:OpenCC,代码行数:7,代码来源:Conversion.cpp

示例3: backR

Segments CSGNode::intersectLocal(const ray& r) const{
	Segments ret;
	if (isLeaf){
		SegmentPoint pNear, pFar;
		isect i;
		ray backR(r.at(-10000), r.getDirection());
		if(!item->intersect(backR, i))return ret;
		pNear.t = i.t - 10000;
		pNear.normal = i.N;
		pNear.isRight = false;
		ray contiR(r.at(pNear.t+RAY_EPSILON*10),r.getDirection());
		if (!item->intersect(contiR, i))pFar = pNear;
		else {
			pFar.t = i.t + pNear.t;
			pFar.normal = i.N;
		}
		pFar.isRight = true;
		ret.addPoint(pNear);
		ret.addPoint(pFar);
		return ret;
	}
	else {
		if (!lchild || !rchild)return ret;
		Segments leftSeg, rightSeg;
		leftSeg = lchild->intersectLocal(r);
		rightSeg = rchild->intersectLocal(r);
		leftSeg.Merge(rightSeg,relation);
		return leftSeg;
	}
}
开发者ID:ywangbc,项目名称:RayTracerFinal,代码行数:30,代码来源:CSG.cpp

示例4:

std::shared_ptr<const Table> ShowColumns::_on_execute() {
  TableColumnDefinitions column_definitions;
  column_definitions.emplace_back("column_name", DataType::String);
  column_definitions.emplace_back("column_type", DataType::String);
  column_definitions.emplace_back("is_nullable", DataType::Int);
  auto out_table = std::make_shared<Table>(column_definitions, TableType::Data);

  const auto table = StorageManager::get().get_table(_table_name);
  Segments segments;

  const auto& column_names = table->column_names();
  const auto vs_names = std::make_shared<ValueSegment<pmr_string>>(
      tbb::concurrent_vector<pmr_string>(column_names.begin(), column_names.end()));
  segments.push_back(vs_names);

  const auto& column_types = table->column_data_types();

  auto column_types_as_string = tbb::concurrent_vector<pmr_string>{};
  for (const auto column_type : column_types) {
    column_types_as_string.push_back(pmr_string{data_type_to_string.left.at(column_type)});
  }

  const auto vs_types = std::make_shared<ValueSegment<pmr_string>>(std::move(column_types_as_string));
  segments.push_back(vs_types);

  const auto& column_nullables = table->columns_are_nullable();
  const auto vs_nullables = std::make_shared<ValueSegment<int32_t>>(
      tbb::concurrent_vector<int32_t>(column_nullables.begin(), column_nullables.end()));
  segments.push_back(vs_nullables);

  out_table->append_chunk(segments);

  return out_table;
}
开发者ID:hyrise,项目名称:hyrise,代码行数:34,代码来源:show_columns.cpp

示例5: create_reference_table

std::shared_ptr<Table> create_reference_table(std::shared_ptr<Table> referenced_table, size_t num_rows,
                                              size_t num_columns) {
  const auto num_rows_per_chunk = num_rows / GENERATED_TABLE_NUM_CHUNKS;

  TableColumnDefinitions column_definitions;
  for (size_t column_idx = 0; column_idx < num_columns; ++column_idx) {
    column_definitions.emplace_back("c" + std::to_string(column_idx), DataType::Int);
  }
  auto table = std::make_shared<Table>(column_definitions, TableType::References);

  for (size_t row_idx = 0; row_idx < num_rows;) {
    const auto num_rows_in_this_chunk = std::min(num_rows_per_chunk, num_rows - row_idx);

    Segments segments;
    for (auto column_idx = ColumnID{0}; column_idx < num_columns; ++column_idx) {
      /**
       * By specifying a chunk size of num_rows * 0.2f for the referenced table, we're emulating a referenced table
       * of (num_rows * 0.2f) * REFERENCED_TABLE_CHUNK_COUNT rows - i.e. twice as many rows as the referencing table
       * we're creating. So when creating TWO referencing tables, there should be a fair amount of overlap.
       */
      auto pos_list = generate_pos_list(num_rows * 0.2f, num_rows_per_chunk);
      segments.push_back(std::make_shared<ReferenceSegment>(referenced_table, column_idx, pos_list));
    }
    table->append_chunk(segments);

    row_idx += num_rows_in_this_chunk;
  }

  return table;
}
开发者ID:hyrise,项目名称:hyrise,代码行数:30,代码来源:union_positions_benchmark.cpp

示例6: loadImages

Segments loadImages(QWidget* parent){
    QStringList fileNames=QFileDialog::getOpenFileNames
        (parent,QObject::tr("open file"),QString(),"*.bmp *.jpg *.png *.gif");

    Segments ret;

    foreach(const QString& fileName,fileNames){

        if(fileName.endsWith("gif")){
            FrameSegment gifSegment(fileName);
            if(gifSegment.isValid()){
                ret.append(gifSegment);
                continue;
            }

        }

        QImage image(fileName);
        if(!image.isNull()){
            ret.append(FrameSegment(image));
        }
    }

    return ret;

}
开发者ID:skfuntips,项目名称:skfuntips,代码行数:26,代码来源:gongJu.cpp

示例7:

util::json::Array
ApiResponseGenerator<DataFacadeT>::ListViaIndices(const Segments &segment_list) const
{
    util::json::Array via_indices;
    via_indices.values.insert(via_indices.values.end(), segment_list.GetViaIndices().begin(),
                              segment_list.GetViaIndices().end());
    return via_indices;
}
开发者ID:bblu,项目名称:osrm-core,代码行数:8,代码来源:api_response_generator.hpp

示例8: polylineEncodeAsJSON

util::json::Value ApiResponseGenerator<DataFacadeT>::GetGeometry(const bool return_encoded,
                                                                 const Segments &segments) const
{
    if (return_encoded)
        return polylineEncodeAsJSON(segments.Get());
    else
        return polylineUnencodedAsJSON(segments.Get());
}
开发者ID:bblu,项目名称:osrm-core,代码行数:8,代码来源:api_response_generator.hpp

示例9: popFrame

Segments ReceiveBuffer::popFrame()
{
    Segments frame;
    for( SourceBufferMap::iterator it = _sourceBuffers.begin();
         it != _sourceBuffers.end(); ++it )
    {
        SourceBuffer& buffer = it->second;
        frame.insert( frame.end(), buffer.segments.front().begin(),
                      buffer.segments.front().end( ));
        buffer.pop();
    }
    ++_lastFrameComplete;
    return frame;
}
开发者ID:hernando,项目名称:Deflect,代码行数:14,代码来源:ReceiveBuffer.cpp

示例10: KawigiEdit_RunTest

// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, vector <int> p0, vector <int> p1, bool hasAnswer, string p2) {
    cout << "Test " << testNum << ": [" << "{";
    for (int i = 0; int(p0.size()) > i; ++i) {
        if (i > 0) {
            cout << ",";
        }
        cout << p0[i];
    }
    cout << "}" << "," << "{";
    for (int i = 0; int(p1.size()) > i; ++i) {
        if (i > 0) {
            cout << ",";
        }
        cout << p1[i];
    }
    cout << "}";
    cout << "]" << endl;
    Segments *obj;
    string answer;
    obj = new Segments();
    clock_t startTime = clock();
    answer = obj->intersection(p0, p1);
    clock_t endTime = clock();
    delete obj;
    bool res;
    res = true;
    cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
    if (hasAnswer) {
        cout << "Desired answer:" << endl;
        cout << "\t" << "\"" << p2 << "\"" << endl;
    }
    cout << "Your answer:" << endl;
    cout << "\t" << "\"" << answer << "\"" << endl;
    if (hasAnswer) {
        res = answer == p2;
    }
    if (!res) {
        cout << "DOESN'T MATCH!!!!" << endl;
    } else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
        cout << "FAIL the timeout" << endl;
        res = false;
    } else if (hasAnswer) {
        cout << "Match :-)" << endl;
    } else {
        cout << "OK, but is it right?" << endl;
    }
    cout << "" << endl;
    return res;
}
开发者ID:Ziklon,项目名称:algorithms,代码行数:51,代码来源:Segments.cpp

示例11: intersect

bool CSGTree::intersect(const ray& r, isect& i) const{
	if (!root)return false;
	Segments inters = root->intersectLocal(r);
	SegmentPoint sp;
	if(!inters.firstPositive(sp))return false;
	i.t = sp.t;
	if (sp.isRight){//right - out
		if (sp.normal*r.getDirection() > RAY_EPSILON)i.N = sp.normal;
		else i.N = -sp.normal;
	}
	else {//left - in
		if (sp.normal*r.getDirection() > RAY_EPSILON)i.N = -sp.normal;
		else i.N = sp.normal;
	}
	return true;
}
开发者ID:ywangbc,项目名称:RayTracerFinal,代码行数:16,代码来源:CSG.cpp

示例12: detect

void OpenCvDetector::detect(const Segments& segments, Labels& labels, Confidences& confidences)
{
    cv::Mat featureMatrix = calculateFeatureMatrix(segments);

    for(size_t i = 0; i < segments.size(); i++) {
        // Implemented by the derived class.
        classifyFeatureVector(featureMatrix.row(i), labels[i], confidences[i]);
    }
}
开发者ID:Aharobot,项目名称:spencer_people_tracking,代码行数:9,代码来源:opencv_detector.cpp

示例13: lock

std::shared_ptr<AbstractTask> IndexScan::_create_job_and_schedule(const ChunkID chunk_id, std::mutex& output_mutex) {
  auto job_task = std::make_shared<JobTask>([=, &output_mutex]() {
    const auto matches_out = std::make_shared<PosList>(_scan_chunk(chunk_id));

    // The output chunk is allocated on the same NUMA node as the input chunk.
    const auto chunk = _in_table->get_chunk(chunk_id);
    Segments segments;

    for (ColumnID column_id{0u}; column_id < _in_table->column_count(); ++column_id) {
      auto ref_segment_out = std::make_shared<ReferenceSegment>(_in_table, column_id, matches_out);
      segments.push_back(ref_segment_out);
    }

    std::lock_guard<std::mutex> lock(output_mutex);
    _out_table->append_chunk(segments, nullptr, chunk->get_allocator());
  });

  job_task->schedule();
  return job_task;
}
开发者ID:hyrise,项目名称:hyrise,代码行数:20,代码来源:index_scan.cpp

示例14: ParseKeyValues

static DictEntry* ParseKeyValues(const char* buff) {
  size_t length;
  const char* pbuff = UTF8Util::FindNextInline(buff, '\t');
  if (UTF8Util::IsLineEndingOrFileEnding(*pbuff)) {
    throw InvalidFormat("Invalid text dictionary");
  }
  length = pbuff - buff;
  string key = UTF8Util::FromSubstr(buff, length);
  Segments values;
  while (!UTF8Util::IsLineEndingOrFileEnding(*pbuff)) {
    buff = pbuff = UTF8Util::NextChar(pbuff);
    pbuff = UTF8Util::FindNextInline(buff, ' ');
    length = pbuff - buff;
    const string& value = UTF8Util::FromSubstr(buff, length);
    values.AddSegment(value);
  }
  if (values.Length() == 0) {
    throw InvalidFormat("Invalid text dictionary: No value in an item");
  } else if (values.Length() == 1) {
    return new DictEntry(key, values.At(0));
  } else {
    return new MultiValueDictEntry(key, values);
  }
}
开发者ID:huoxudong125,项目名称:OpenCC,代码行数:24,代码来源:TextDict.cpp

示例15: main

int main(int argc, const char* argv[])
{
	/*
	 *  Build 48 Index with Links
	 */


	// Load Circuit
    Experiment experiment;
    experiment.open(blue_config_filename);
    Microcircuit & microcircuit = experiment.microcircuit();
    const Targets & targets = experiment.targets();
    const Cell_Target target = targets.cell_target("Column");
    microcircuit.load(target, NEURONS | MORPHOLOGIES);

    //Make Neuron Rtrees
    ISpatialIndex *neuronTrees[MORPHOLOGIES_COUNT];
    string *morphologyLabels[MORPHOLOGIES_COUNT];

    int cm=0;
    Morphologies & myMorphologies = microcircuit.morphologies();
    Morphologies::iterator myMorphologiesEnd = myMorphologies.end();
      for (Morphologies::iterator i = myMorphologies.begin(); i != myMorphologiesEnd; ++i)
      {
    	  morphologyLabels[cm] = i->label();
    	  neuronTrees[cm] = RTree::createNewRTree (createNewMemoryStorageManager(), 0.7, 127, 127, 3,RTree::RV_RSTAR,indexIdentifier);
    	  cm++;
      }

    Neurons & myNeurons = microcircuit.neurons();
    Neurons::iterator myNeuronsEnd = myNeurons.end();
    for (Neurons::iterator i = myNeurons.begin(); i != myNeuronsEnd; ++i)
    {
    	cm=0;
    	for (cm=0;cm<MORPHOLOGIES_COUNT;cm++)
    		if (strcmp(i->morphology().label(),morphologyLabels[cm])==0) break;

    	Transform_3D<Micron> trafo = i->global_transform();
    	Sections mySections = i->morphology().all_sections();
    	Sections::iterator mySectionsEnd = mySections.end();
    	for (Sections::iterator s = mySections.begin(); s != mySectionsEnd; ++s)
    	    {
    		 Segments segments = s->segments();
    		 Segments::const_iterator segments_end = segments.end();
    		 for (Segments::const_iterator j = segments.begin(); j != segments_end ; ++j)
    		     {
     			 vect plow, phigh;
     			 get_segment_mbr (*j, trafo, &plow, &phigh);
     			 SpatialIndex::Region mbr = SpatialIndex::Region(plow.data(),phigh.data(),3);

     			 std::stringstream strStream;
     			 strStream << i->gid() <<"-"<< s->id()<< "-" << j->id();
     			 neuronTrees[cm]->insertData (strStream.str().length(), (byte*)(strStream.str().c_str()), mbr, segmentid);
    		     }
    	    }
    }

    // Make Morphology Rtrees
    Morphologies & myMorphologies = microcircuit.morphologies();
    Morphologies::iterator myMorphologiesEnd = myMorphologies.end();
      for (Morphologies::iterator i = myMorphologies.begin(); i != myMorphologiesEnd; ++i)
      {
      	cout << "Indexing Morphology: " << i->label();
      	string baseName = i->label();
        IStorageManager* diskfile = StorageManager::createNewDiskStorageManager(baseName, 4096);
        ISpatialIndex *tree = RTree::createNewRTree (*diskfile, 0.7, 127, 127, 3,RTree::RV_RSTAR,indexIdentifier);
        indexIdentifier++; segmentid=0;

      	Sections mySections = i->all_sections();
      	Sections::iterator mySectionsEnd = mySections.end();
      	for (Sections::iterator s = mySections.begin(); s != mySectionsEnd; ++s)
      	{
            Segments segments = s->segments();
      		Segments::const_iterator segments_end = segments.end();
      		for (Segments::const_iterator j = segments.begin(); j != segments_end ; ++j)
      		{

      			Box<bbp::Micron> Mbr = AABBCylinder::calculateAABBForCylinder(j->begin().center(),
      								  j->begin().radius(),j->end().center(),j->begin().radius());

      			vect plow, phigh;

      			plow[0] = Mbr.center().x() - Mbr.dimensions().x() / 2;
      			phigh[0] = Mbr.center().x() + Mbr.dimensions().x() / 2;
      			plow[1] = Mbr.center().y() - Mbr.dimensions().y() / 2;
      			phigh[1] = Mbr.center().y() + Mbr.dimensions().y() / 2;
      			plow[2] = Mbr.center().z() - Mbr.dimensions().z() / 2;
      			phigh[2] = Mbr.center().z() + Mbr.dimensions().z() / 2;

				SpatialIndex::Region mbr = SpatialIndex::Region(plow.data(),phigh.data(),3);

      			std::stringstream strStream;
      			strStream << s->id()<< "-" << j->id();

      			tree->insertData (strStream.str().length(), (byte*)(strStream.str().c_str()), mbr, segmentid);
      			segmentid++;
      		}
      	}
      	cout << ".. Total Segments: " << segmentid << "\n";
        tree->~ISpatialIndex();
//.........这里部分代码省略.........
开发者ID:allogn,项目名称:TOUCH,代码行数:101,代码来源:MorphologyTest.cpp


注:本文中的Segments类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。