1. Vincent Rabeux
  2. 2011-dawin-cppopencv-vrabeux

Commits

Vincent Rabeux  committed 07c27cf

Support for OpenCV 2.1

  • Participants
  • Parent commits fca4a17
  • Branches default

Comments (0)

Files changed (1)

File sources/src/ExtractionResultView.cpp

View file
  • Ignore whitespace
 #include "ExtractionResultView.hpp"
 
 #include <highgui.h>
+#include <math.h>
 
 ExtractionResultView::ExtractionResultView(const std::string &windowName)
     : _windowName (windowName)
         if(res.hierachy[idx][3] > 0) {
              color = cv::Scalar( 255, 255, 255);
         }
-
-        cv::drawContours( dst, res.list, idx, color, CV_FILLED, 8, res.hierachy);
+	cv::drawContours( dst, res.list, idx, color, CV_FILLED, 8, res.hierachy, std::abs(idx));
     }
 
+	
     cv::imshow( _windowName, dst );
     cv::waitKey();
 }
+
+/*if( res.list.size() > 0 )
+	    {
+	        // iterate through all the top-level contours,
+	        // draw each connected component with its own random color
+	        int idx = 0;
+	        for( ; idx >= 0; idx = res.hierachy[idx][0] )
+	        {
+	            cv::Scalar color( (rand()&255), (rand()&255), (rand()&255) );
+	            drawContours( dst, res.list, idx, color, CV_FILLED, 8, res.hierachy, std::abs(idx) );
+	        }
+	    }
+	*/