Ask Your Question

Revision history [back]

How to compare compare contour of two image

//This function takes one frame at a time void draw_ellipse(Mat &a,int count)

{

findContours( th1, contours, hierarchy, CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE, Point(0,0) );

for(i=0;i<contours.size();i++) {="" area.push_back(contourarea(contours[i]));="" area="" is="" a="" vector="" }<="" p="">

for(j=1;j<=count;j++) {

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

    if(area[i]>area[i+1])         // v1,v2,v3 are vectors
       v1.push_back(contours[i]);

    else if(area[i]<area[i+1])
       v2.push_back(contours[i]);

    else if(area[i]==area[i+1])
       v3.push_back(contours[i]);
  }

}

}

Now this function compares contours within same frame but I want that second frame's each contour compare with each contour of 1st frame then it should go in different vectors.

How to compare compare contour of two image

//This function takes one frame at a time
void draw_ellipse(Mat &a,int count)

{

count) { findContours( th1, contours, hierarchy, CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE, Point(0,0) );

for(i=0;i<contours.size();i++) {="" area.push_back(contourarea(contours[i]));="" area="" is="" a="" vector="" }<="" p="">

for(i=0;i<contours.size();i++) { area.push_back(contourArea(contours[i]));// area is a vector } for(j=1;j<=count;j++) {

{

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

    {

        if(area[i]>area[i+1])         // v1,v2,v3 are vectors
        v1.push_back(contours[i]);

     else if(area[i]<area[i+1])
        v2.push_back(contours[i]);

     else if(area[i]==area[i+1])
        v3.push_back(contours[i]);
      }

   }

}

}

}

Now this function compares contours within same frame but I want that second frame's each contour compare with each contour of 1st frame then it should go in different vectors.