#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
int thresh = 100;
int max_thresh = 255;
void thresh_callback(int, void* );
int main(
int,
char** argv )
{
const char* source_window = "Source";
createTrackbar(
" Threshold:",
"Source", &thresh, max_thresh, thresh_callback );
thresh_callback( 0, 0 );
return(0);
}
void thresh_callback(int, void* )
{
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
vector<RotatedRect> minRect( contours.size() );
vector<RotatedRect> minEllipse( contours.size() );
for( size_t i = 0; i < contours.size(); i++ )
if( contours[i].size() > 5 )
}
for( size_t i = 0; i< contours.size(); i++ )
{
Scalar color =
Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );
ellipse( drawing, minEllipse[i], color, 2, 8 );
Point2f rect_points[4]; minRect[
i].points( rect_points );
for( int j = 0; j < 4; j++ )
line( drawing, rect_points[j], rect_points[(j+1)%4], color, 1, 8 );
}
imshow(
"Contours", drawing );
}