Build tutorial codes together with other samples

These codes should be included into regular builds.
This commit is contained in:
Andrey Kamaev
2012-11-07 18:21:20 +04:00
parent 6484732509
commit b131dfeecd
58 changed files with 420 additions and 354 deletions

View File

@@ -24,7 +24,7 @@ void thresh_callback(int, void* );
/**
* @function main
*/
int main( int argc, char** argv )
int main( int, char** argv )
{
/// Load source image and convert it to gray
src = imread( argv[1], 1 );
@@ -34,7 +34,7 @@ int main( int argc, char** argv )
blur( src_gray, src_gray, Size(3,3) );
/// Create Window
char* source_window = "Source";
const char* source_window = "Source";
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
imshow( source_window, src );
@@ -65,7 +65,7 @@ void thresh_callback(int, void* )
vector<Point2f>center( contours.size() );
vector<float>radius( contours.size() );
for( int i = 0; i < contours.size(); i++ )
for( size_t i = 0; i < contours.size(); i++ )
{ approxPolyDP( Mat(contours[i]), contours_poly[i], 3, true );
boundRect[i] = boundingRect( Mat(contours_poly[i]) );
minEnclosingCircle( contours_poly[i], center[i], radius[i] );
@@ -74,10 +74,10 @@ void thresh_callback(int, void* )
/// Draw polygonal contour + bonding rects + circles
Mat drawing = Mat::zeros( threshold_output.size(), CV_8UC3 );
for( int i = 0; i< contours.size(); i++ )
for( size_t i = 0; i< contours.size(); i++ )
{
Scalar color = Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );
drawContours( drawing, contours_poly, i, color, 1, 8, vector<Vec4i>(), 0, Point() );
drawContours( drawing, contours_poly, (int)i, color, 1, 8, vector<Vec4i>(), 0, Point() );
rectangle( drawing, boundRect[i].tl(), boundRect[i].br(), color, 2, 8, 0 );
circle( drawing, center[i], (int)radius[i], color, 2, 8, 0 );
}