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


C++ vector类代码示例

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


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

示例1: add

void Pass::add(PassType type, vector<Pass> &passes, const char *name)
{
  for (size_t i = 0; i < passes.size(); i++) {
    if (passes[i].type == type && (name ? (passes[i].name == name) : passes[i].name.empty())) {
      return;
    }
  }

  Pass pass;

  pass.type = type;
  pass.filter = true;
  pass.exposure = false;
  pass.divide_type = PASS_NONE;
  if (name) {
    pass.name = name;
  }

  switch (type) {
    case PASS_NONE:
      pass.components = 0;
      break;
    case PASS_COMBINED:
      pass.components = 4;
      pass.exposure = true;
      break;
    case PASS_DEPTH:
      pass.components = 1;
      pass.filter = false;
      break;
    case PASS_MIST:
      pass.components = 1;
      break;
    case PASS_NORMAL:
      pass.components = 4;
      break;
    case PASS_UV:
      pass.components = 4;
      break;
    case PASS_MOTION:
      pass.components = 4;
      pass.divide_type = PASS_MOTION_WEIGHT;
      break;
    case PASS_MOTION_WEIGHT:
      pass.components = 1;
      break;
    case PASS_OBJECT_ID:
    case PASS_MATERIAL_ID:
      pass.components = 1;
      pass.filter = false;
      break;

    case PASS_EMISSION:
    case PASS_BACKGROUND:
      pass.components = 4;
      pass.exposure = true;
      break;
    case PASS_AO:
      pass.components = 4;
      break;
    case PASS_SHADOW:
      pass.components = 4;
      pass.exposure = false;
      break;
    case PASS_LIGHT:
      /* This isn't a real pass, used by baking to see whether
       * light data is needed or not.
       *
       * Set components to 0 so pass sort below happens in a
       * determined way.
       */
      pass.components = 0;
      break;
#ifdef WITH_CYCLES_DEBUG
    case PASS_BVH_TRAVERSED_NODES:
    case PASS_BVH_TRAVERSED_INSTANCES:
    case PASS_BVH_INTERSECTIONS:
    case PASS_RAY_BOUNCES:
      pass.components = 1;
      pass.exposure = false;
      break;
#endif
    case PASS_RENDER_TIME:
      /* This pass is handled entirely on the host side. */
      pass.components = 0;
      break;

    case PASS_DIFFUSE_COLOR:
    case PASS_GLOSSY_COLOR:
    case PASS_TRANSMISSION_COLOR:
    case PASS_SUBSURFACE_COLOR:
      pass.components = 4;
      break;
    case PASS_DIFFUSE_DIRECT:
    case PASS_DIFFUSE_INDIRECT:
      pass.components = 4;
      pass.exposure = true;
      pass.divide_type = PASS_DIFFUSE_COLOR;
      break;
    case PASS_GLOSSY_DIRECT:
//.........这里部分代码省略.........
开发者ID:dfelinto,项目名称:blender,代码行数:101,代码来源:film.cpp

示例2: deleteStdVecElem

void deleteStdVecElem(vector<Tstve>& v, int idx)
{
    v[idx] = v.back();
    v.pop_back();
}
开发者ID:D-Alex,项目名称:opencv_contrib,代码行数:5,代码来源:ccalib.cpp

示例3: minMoves

int minMoves(vector<int>& nums) {
       return accumulate(nums.begin(), nums.end(), 0L)-nums.size()* *min_element(nums.begin(), nums.end());
}
开发者ID:jiongdu,项目名称:Algorithm,代码行数:3,代码来源:Minimum+Move+to+Equal+Array+Elements--数学思想.cpp

示例4: in

	bool in(string first, vector<string> second){
		for (int i = 0; i < second.size(); i++)
		if (first == second[i])
			return true;
		return false;
	}
开发者ID:ladfaa,项目名称:CCF,代码行数:6,代码来源:源.cpp

示例5: print

template<class T> void print(const vector<T> &v){ostringstream os; for(int i=0; i<v.size(); ++i){if(i)os<<' ';os<<v[i];} cout<<os.str()<<endl;}
开发者ID:shuklaravi,项目名称:Online-Judges,代码行数:1,代码来源:MinskyMysteryDiv2.cpp

示例6: drawImageBatch

void CCanvasContext::drawImageBatch(CImage *image, const vector<float> &coords)
{
	//LOG("drawImageBatch: %d", coords.size());
	int count = (int)(coords.size() / 8);
	if( !image || count <= 0 )
		return;

	//glPushMatrix();
	
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, image->getTexture());
	
	if( image->hasAlpha() )
	{
		glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
		glEnable(GL_BLEND);
	}
	else
	{
		glDisable(GL_BLEND);
	}
	
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	
	int vertexCount = count * 6;
	
	static int maxVertex = 100;
	static GLfloat *vertices = NULL;
	static GLfloat *textureCoords = NULL;
	if( !vertices )
	{
		vertices = (GLfloat *) malloc(maxVertex * 2 * sizeof(GLfloat));
	}
	if( !textureCoords )
	{
		textureCoords = (GLfloat *) malloc(maxVertex * 2 * sizeof(GLfloat));
	}
	
	if( vertexCount > maxVertex )
	{
		int newMaxVertex = maxVertex * 2;
		if( vertexCount > newMaxVertex )
		{
			newMaxVertex = vertexCount;
		}
		GLfloat *newVertexBuf = (GLfloat *) malloc(newMaxVertex * 2 * sizeof(GLfloat));
		GLfloat *newTextureCoordBuf = (GLfloat *) malloc(newMaxVertex * 2 * sizeof(GLfloat));
		
		free(vertices);
		free(textureCoords);
		
		vertices = newVertexBuf;
		textureCoords = newTextureCoordBuf;
		maxVertex = newMaxVertex;
	}

	for( int i=0; i<count; i++ )
	{
		float sx = coords[i*8];
		float sy = coords[i*8+1];
		float sw = coords[i*8+2];
		float sh = coords[i*8+3];
		
		float dx = coords[i*8+4];
		float dy = coords[i*8+5];
		float dw = coords[i*8+6];
		float dh = coords[i*8+7];
		
		// 6个点的订单坐标,其中2,3点和4,5点相同
		
		vertices[i*12] = dx;
		vertices[i*12+1] = dy;
		
		vertices[i*12+2] = dx + dw;
		vertices[i*12+3] = dy;
		
		vertices[i*12+4] = dx;
		vertices[i*12+5] = dy + dh;
		
		vertices[i*12+6] = dx + dw;
		vertices[i*12+7] = dy;
		
		vertices[i*12+8] = dx;
		vertices[i*12+9] = dy + dh;
		
		vertices[i*12+10] = dx + dw;
		vertices[i*12+11] = dy + dh;
		
		// 6个点的纹理坐标,其中2,3点和4,5点相同
		unsigned long POTWidth = image->POTWidth();
		unsigned long POTHeight = image->POTHeight();

		textureCoords[i*12] = sx / POTWidth;
		textureCoords[i*12+1] = sy / POTHeight;
		
		textureCoords[i*12+2] = (sx + sw) / POTWidth;
		textureCoords[i*12+3] = sy / POTHeight;
		
		textureCoords[i*12+4] = sx / POTWidth;
//.........这里部分代码省略.........
开发者ID:renbing,项目名称:Canvas,代码行数:101,代码来源:context.cpp

示例7: streets

// static
void StreetsMatcher::FindStreets(BaseContext const & ctx, FeaturesFilter const & filter,
                                 QueryParams const & params, vector<Prediction> & predictions)
{
  for (size_t startToken = 0; startToken < ctx.m_numTokens; ++startToken)
  {
    if (ctx.IsTokenUsed(startToken))
      continue;

    // Here we try to match as many tokens as possible while
    // intersection is a non-empty bit vector of streets. Single
    // tokens that are synonyms to streets are ignored.  Moreover,
    // each time a token that looks like a beginning of a house number
    // is met, we try to use current intersection of tokens as a
    // street layer and try to match BUILDINGs or POIs.
    CBV streets(ctx.m_streets);

    CBV all;
    all.SetFull();

    size_t curToken = startToken;

    // This variable is used for prevention of duplicate calls to
    // CreateStreetsLayerAndMatchLowerLayers() with the same
    // arguments.
    size_t lastToken = startToken;

    // When true, no bit vectors were intersected with |streets| at all.
    bool emptyIntersection = true;

    // When true, |streets| is in the incomplete state and can't be
    // used for creation of street layers.
    bool incomplete = false;

    auto emit = [&]()
    {
      if (!streets.IsEmpty() && !emptyIntersection && !incomplete && lastToken != curToken)
      {
        CBV fs(streets);
        CBV fa(all);

        ASSERT(!fs.IsFull(), ());
        ASSERT(!fa.IsFull(), ());

        if (filter.NeedToFilter(fs))
          fs = filter.Filter(fs);

        if (fs.IsEmpty())
          return;

        if (filter.NeedToFilter(fa))
          fa = filter.Filter(fa).Union(fs);

        predictions.emplace_back();
        auto & prediction = predictions.back();

        prediction.m_tokenRange = TokenRange(startToken, curToken);

        ASSERT_NOT_EQUAL(fs.PopCount(), 0, ());
        ASSERT_LESS_OR_EQUAL(fs.PopCount(), fa.PopCount(), ());
        prediction.m_prob = static_cast<double>(fs.PopCount()) / static_cast<double>(fa.PopCount());

        prediction.m_features = move(fs);
        prediction.m_hash = prediction.m_features.Hash();
      }
    };

    StreetTokensFilter filter([&](strings::UniString const & /* token */, size_t tag)
                              {
                                auto buffer = streets.Intersect(ctx.m_features[tag]);
                                if (tag < curToken)
                                {
                                  // This is the case for delayed
                                  // street synonym.  Therefore,
                                  // |streets| is temporarily in the
                                  // incomplete state.
                                  streets = buffer;
                                  all = all.Intersect(ctx.m_features[tag]);
                                  emptyIntersection = false;

                                  incomplete = true;
                                  return;
                                }
                                ASSERT_EQUAL(tag, curToken, ());

                                // |streets| will become empty after
                                // the intersection. Therefore we need
                                // to create streets layer right now.
                                if (buffer.IsEmpty())
                                  emit();

                                streets = buffer;
                                all = all.Intersect(ctx.m_features[tag]);
                                emptyIntersection = false;
                                incomplete = false;
                              });
开发者ID:milchakov,项目名称:omim,代码行数:96,代码来源:streets_matcher.cpp

示例8: findv

int findv(vector<int> &v,int x){
    for (int i=0; i<v.size(); i++) {
        if (v[i] == x) return i;
    }
    return -1;
}
开发者ID:wrchow,项目名称:algorithm,代码行数:6,代码来源:hulu2.cpp

示例9: merge_clusters

void merge_clusters(vector<string> filenames, int min_count_for_filters, int cluster_edit_distance_threshold) {
    vector<map<string, int> > file_data(filenames.size());
    set<string> keys;
    int ct = 0;
    double histogram_bin_growth_factor = 1.4;
    
    //load data from files
    for(vector<string>::const_iterator filename = filenames.begin(); filename != filenames.end(); filename++) {
        ifstream file(filename->c_str());
        
        string line;
        while(true) {
            string name;
            int count;
            getline(file, line);
            
            istringstream ss( line );
            getline( ss, name, ',' );
            ss >> count;
            
            if(!file.good() || ss.fail())
                break;
            
            file_data[ct][name] = count;
            file_data[ct].insert(pair<string, int>(name, count));
            keys.insert(name);
        }
        ct++;
    }
    
    //identify keys to be remapped
    map<string,int> counts;
    vector<pair<string,int> > sorted_keys;
    for(set<string>::const_iterator key = keys.begin(); key != keys.end(); key++) {
        counts[*key] = 0;
        for(vector<map<string,int> >::iterator data = file_data.begin(); data != file_data.end(); data++) {
            if(data->count(*key))
                counts[*key] += (*data)[*key];
        }
        sorted_keys.push_back(std::pair<string, int>(*key, counts[*key]));
    }
    
    map<string, string> remapped_keys;
    int attached = 0;
    
    value_sorter vs;
    sort(sorted_keys.begin(), sorted_keys.end(), vs);
    
    for(vector<pair<string,int> >::const_reverse_iterator i1 = sorted_keys.rbegin(); i1 != sorted_keys.rend(); i1++) {
        for(vector<pair<string,int> > ::const_iterator i2 = sorted_keys.begin(); i2 != sorted_keys.end(); i2++) {
            if(i1->first == i2->first)
                break;
            if(cluster_distance(i1->first, i2->first, cluster_edit_distance_threshold+2) <= cluster_edit_distance_threshold) {
                remapped_keys[i2->first] = i1->first;
                if(!remapped_keys.count(i1->first))
                    remapped_keys[i1->first] = i1->first;
                //cerr << "Attaching " << i2->first << " to cluster " << i1->first << endl;
                attached += 1;
            }
        }
    }
    
    //remove keys mapped to a cluster node that doesn't exist any more
    set<string> keys_seen_once, keys_seen_twice, keys_difference;
    
    for(map<string, string>::const_iterator i = remapped_keys.begin(); i != remapped_keys.end(); i++) {
        if(!keys_seen_once.count(i->second)) {
            keys_seen_once.insert(i->second);
            continue;
        }
        if(!keys_seen_twice.count(i->second))
            keys_seen_twice.insert(i->second);
    }
    
    
    set_difference(keys_seen_once.begin(), keys_seen_once.end(), keys_seen_twice.begin(), keys_seen_twice.end(), inserter(keys_difference, keys_difference.end()));
    int removed = 0;
    vector<string> to_remove;
    for(map<string, string>::const_iterator i = remapped_keys.begin(); i != remapped_keys.end(); i++) {
        if(!keys_difference.count(i->second)) {
            //cerr << "Removing orphan cluster mapping " << i->first << " to " << i->second << endl;
            //remapped_keys.erase(i->first);
            to_remove.push_back(i->first);
            removed++;
        }
    }
    for(vector<string>::const_iterator i = to_remove.begin(); i != to_remove.end(); i++)
        remapped_keys.erase(*i);
    
    cerr << "Clustering stage 2: Attached " << attached << " sequences to clusters" << endl;
    
    // generate new names for cluster centers
    map<string, string> remapped_names;
    for(map<string, string>::const_iterator i = remapped_keys.begin(); i != remapped_keys.end(); i++) {
        if(remapped_names.count(i->second))
            remapped_names[i->second] = cluster_name(i->first, remapped_names[i->second]);
        else
            remapped_names[i->second] = i->second;
    }
    
//.........这里部分代码省略.........
开发者ID:adaptivegenome,项目名称:clusterseq,代码行数:101,代码来源:cluster.cpp

示例10: display

void display(void)
{
    glClear(GL_COLOR_BUFFER_BIT);

    //Drawing and updating each vertex object in <points>
    if (flag1 == true)			//First point selected, but no object created yet
    {
        if (current == Dot)	drawStart(px1, py1, size, c);
        else if (current == Line)
        {
            if (points.size() == 0 || points.size() % 2 == 0) drawStart(px1, py1, size, c);
            else {
                drawPoint(points[points.size() - 1]);
                drawStart(px1, py1, size, c);
            }
        }
        else
        {
            if (lastMarker == 0 && polygonMarkers.size() > 0)
            {
                if (points.size() == 0) drawStart(px1, py1, size, c);
                else drawPoint(points[lastMarker]);
            }
            for (size_t i = lastMarker + 1; i < points.size(); i++) drawPoint(points.at(i));
            drawStart(px1, py1, size, c);
        }
    }
    //Checking for the first point on a line before the second point's initial position
    //is defined (Line Mode Only)
    else if (flag1 == false && current != Dot)
    {
        if (current == Line)
        {
            if (points.size() > 0 && points.size() % 2 != 0) drawPoint(points.at(points.size() - 1));
        }

        else if (current == Polygon)
        {
            if (polygonMarkers.size() > 0)
            {
                if (lastMarker == 0 && points.size() < 1) drawPoint(points.at(0));
                else
                {
                    for (size_t i = lastMarker + 1; i < points.size(); i++) polySet.push_back(points.at(i));
                    drawFilledPolygon(polySet);
                    polySet.erase(polySet.begin(), polySet.begin() + polySet.size());
                }
            }
        }
    }

    //Drawing the animated objects
    if (current == Dot)
    {
        for (size_t i = 0; i < points.size(); i++)
        {
            drawPoint(points.at(i));
            if (pauseflag == false) points.at(i).UpdatePosition();
        }
    }
    else if (current == Line)
    {
        //Making sure that the vector limit passed has an even number of Vertex objects
        if (points.size() % 2 == 0) limit = points.size();
        else limit = points.size() - 1;

        for (int i = 0; i < limit; i = i + 2)
        {
            drawVertexLine(points.at(i), points.at(i + 1));
            if (pauseflag == false) {
                points.at(i).UpdatePosition();
                points.at(i + 1).UpdatePosition();
            }
        }
    }
    else if (current == Polygon)
    {
        if (polygonMarkers.size() > 1)
        {
            //Drawing the first polygon
            for (int k = polygonMarkers.at(0); k < polygonMarkers.at(1); k++)
            {
                polySet.push_back(points.at(k));
                if (pauseflag == false) points.at(k).UpdatePosition();
            }
            polySet.push_back(points.at(polygonMarkers.at(1)));
            drawFilledPolygon(polySet);
            polySet.erase(polySet.begin(), polySet.begin() + polySet.size());

            //Drawing the remaining polygons
            for (size_t i = 1; i < polygonMarkers.size(); i++)
            {
                for (int j = polygonMarkers.at(i - 1) + 1; j < polygonMarkers.at(i); j++)
                {
                    polySet.push_back(points.at(j));
                    if (pauseflag == false) points[j].UpdatePosition();
                }
                polySet.push_back(points.at(polygonMarkers.at(i)));
                drawFilledPolygon(polySet);
                polySet.erase(polySet.begin(), polySet.begin() + polySet.size());
//.........这里部分代码省略.........
开发者ID:GenevaS,项目名称:OpenGL,代码行数:101,代码来源:ScreenSaverProgram.cpp

示例11: showAllLogs

void Log::showAllLogs()
{
	// look at all logs stored in the string vector and output them
	for (int i = 0; i < logList.size(); i++)
		cout << logList[i] << " " << endl;
}
开发者ID:Collinux,项目名称:Now_Manager_CPP_Terminal,代码行数:6,代码来源:Log.cpp

示例12: ConvexHull

/**
convex_hull : including collinear points
counterclockwise
*/
void ConvexHull(vector<PT>& poly,vector<PT>& ret)
{
    int n=SZ(poly);
    if(n==0) return ;
    sort(all(poly));
    poly.resize(distance(poly.begin(),unique(all(poly))));
    n=SZ(poly);
    PT fpoint = poly[0];
    for(int i=0;i<n;i++)
    {
        poly[i]=poly[i]-fpoint;
    }
    stack<PT> S;
    PT f;
    PT p1,p2,p3;
    if(n>2)
    {
        sort(poly.begin()+1,poly.end(),compAng);
        bool ok;
        ll c;
        S.push(poly[0]);
        S.push(poly[1]);
        for(int i=2;i<=n;i++)
        {
            p3=poly[i%n];
            ok=(i!=n);
            do{
                p2=S.top(); S.pop();
                p1=S.top();
                S.push(p2);
                c=cross(p2-p1,p3-p1);
                if(c<0)
                {
                    if(SZ(S)>2) S.pop();
                    else break;
                }
                else if(c==0)
                {
                    ll d12=dot(p2-p1,p2-p1),d13=dot(p3-p1,p3-p1);
                    if(d13<=d12) ok=false;
                    else
                    {
                        if(SZ(S)>=2) S.pop();
                    }
                    break;
                }
                else break;
            }while(SZ(S)>=2);
            if(ok) S.push(p3);
        }
        while(!S.empty()){
            ret.psb(S.top());
            S.pop();
        }
        reverse(all(ret));
    }
    else
    {
        ret=poly;
    }
    n=SZ(ret);
    for(int i=0;i<n;i++)
    {
        ret[i]=ret[i]+fpoint;
    }
    return ;
}
开发者ID:draak-krijger,项目名称:test,代码行数:71,代码来源:GeometryTemplate2D(integer).cpp

示例13: mixChannels

bool LED_Detector::findLEDs(const cv::Mat& RGBImage, cv::Mat &grayImage, cv::Mat &binaryImage,
    vector<Point2f> &leds, const LED_Detector::Params &params,
    bool havePreviousState, const vector<Point2f> &reprojImgPts)
{
    // Extract the red channel and save as gray image
    const int mixCh[]= {2,0};
    mixChannels(&RGBImage,1,&grayImage,1,mixCh,1);

    // threshold the gray image
    threshold(grayImage, binaryImage, params.threshold, 255, THRESH_BINARY);

#ifdef SHOW_BINARY_IMG
    imshow("binary",binaryImage);
#endif

    // detect contours -- use CV_RETR_EXTERNAL to avoid returning holes
    vector<vector<Point> > contours;
    findContours(binaryImage,contours,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_SIMPLE);

    /// Jump back to here if we can't use previous state
    not_detected_stop:


    /// We now have a vectorized contours object: vector<vector<Point> > contours
    /// Loop through each contour and filter/classify it by its properties

    static LED_Detector::contourStructObj contourStruct;
    vector <LED_Detector::contourStructObj> contourStructVec;
    int n_detected = 0;
    vector<Point2f> leaderROI_contour;       // vectorize the rectangle as a contour

    if (havePreviousState) // Need to initialize proximities
    {
        proximityVec.resize(NO_LEDS);  // This will resize 1st dimension to proximityVec[5][]
        for (int i=0; i<NO_LEDS; i++)
            proximityVec[i].resize(0);  // this will clear the contents of each subvector

        // Compute the wingspan based on reprojected image points from last frame
        float span_sq = pow((reprojImgPts[NO_LEDS-1].x - reprojImgPts[0].x),2)
            + pow((reprojImgPts[NO_LEDS-1].y - reprojImgPts[0].y),2);
        span = sqrt(span_sq);

        // Determine the bounding rectangle of the lead UAV and scale up a little bit
        RotatedRect leaderROI = minAreaRect(reprojImgPts);
        leaderROI.size.height += 90;
        leaderROI.size.width  += 90;
        Point2f verticies[4];

        // vectorize the bounding ROI
        leaderROI.points(verticies);
        leaderROI_contour.assign(verticies,verticies + 4);

        /// Uncomment to draw ROI on image frame
#if defined (DEBUG_VIDEO) || defined (SAVEOFF_FRAMES)
        for (int i_test=0; i_test<4; i_test++)
            line(frame, leaderROI_contour[i_test], leaderROI_contour[(i_test+1)%4], Scalar(255,255,255));
#endif
    }

    for (size_t contourIdx = 0; contourIdx < contours.size(); contourIdx++)
    {

        /// Reduce resolution
        //approxPolyDP(contours[contourIdx], contours[contourIdx], 2, true);

        /// Use minEnclosingCircle for blob area
        minEnclosingCircle(contours[contourIdx], contourStruct.center, contourStruct.radius);
        contourStruct.area = CV_PI * (contourStruct.radius * contourStruct.radius);

        /// Uncomment to view all detected blobs
#if (!ARM)
        cv::circle(frame,contourStruct.center, 6, cv::Scalar(255,255,255), 3);
#endif
        /// Consider only the points that fall within a ROI around the last known position
        if (havePreviousState)
        {
            // if point does not lie within or lie on leaderROI RotatedRect, continue
            if (pointPolygonTest(leaderROI_contour,contourStruct.center,false) < 0 )
                continue;
            /// Uncomment to show/highlight blobs that appear inside ROI
#if (!ARM)
            cv::circle(frame,contourStruct.center, 6, cv::Scalar(255,255,255), 2);
#endif
        }

        if (params.filterByArea)
        {
            if (contourStruct.area < params.minArea || contourStruct.area >= params.maxArea)
                continue;
        }

        if (params.filterByCircularity)
        {
            Moments moms = moments(Mat(contours[contourIdx]));
            static float area = moms.m00;
            static float ratio = area / contourStruct.area;  // (blob area) / (min enclosing circle area)
            if (ratio < params.minCircularity || ratio >= params.maxCircularity)
                continue;
            contourStruct.circularity = ratio;
        }
//.........这里部分代码省略.........
开发者ID:qazzz789,项目名称:LinuxVision,代码行数:101,代码来源:LED_Detector.cpp

示例14: dfs1

void dfs1(int now){
    u[now]=1;
    for(int i:G[now])if(!u[i])dfs1(i);
    tp.pb(now);
}
开发者ID:edisonhello,项目名称:cpp,代码行数:5,代码来源:1929.cpp

示例15: init_seg

void init_seg(int N) {
	node tmp;
	tmp.pr=INT_MIN;tmp.su=INT_MIN;tmp.bs=INT_MIN,tmp.sm=INT_MIN;
	segtree.resize(4*N,tmp);
}
开发者ID:vedsarkushwaha,项目名称:code,代码行数:5,代码来源:gss3.cpp


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