How to compare compare contour of two image

asked 2016-01-15 04:51:08 -0600

updated 2016-01-15 06:18:47 -0600

//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
   }

  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.

edit retag flag offensive close merge delete

Comments

1

area[i+1] is simply wrong. What have you already tried so far? You seem to have good understanding of what you want to do.

boaz001 gravatar imageboaz001 ( 2016-01-15 06:44:50 -0600 )edit