From c11a7184c998284737300bf4f9e95d3f6ebb3721 Mon Sep 17 00:00:00 2001 From: Kirill Kornyakov Date: Sat, 30 Jul 2011 11:59:09 +0000 Subject: [PATCH] minarea.cpp sample reformatted --- samples/cpp/minarea.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/samples/cpp/minarea.cpp b/samples/cpp/minarea.cpp index 34afab9e0..e7eaf7278 100644 --- a/samples/cpp/minarea.cpp +++ b/samples/cpp/minarea.cpp @@ -1,26 +1,28 @@ #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" + #include + using namespace cv; using namespace std; void help() { cout << "This program demonstrates finding the minimum enclosing box or circle of a set\n" - "of points using functions: minAreaRect() minEnclosingCircle().\n" - "Random points are generated and then enclosed.\n" - "Call:\n" - "./minarea\n" - "Using OpenCV version %s\n" << CV_VERSION << "\n" << endl; + "of points using functions: minAreaRect() minEnclosingCircle().\n" + "Random points are generated and then enclosed.\n" + "Call:\n" + "./minarea\n" + "Using OpenCV version %s\n" << CV_VERSION << "\n" << endl; } - - int main( int /*argc*/, char** /*argv*/ ) { - Mat img(500, 500, CV_8UC3); - RNG& rng = theRNG(); help(); + + Mat img(500, 500, CV_8UC3); + RNG& rng = theRNG(); + for(;;) { int i, count = rng.uniform(1, 101); @@ -35,6 +37,7 @@ int main( int /*argc*/, char** /*argv*/ ) } RotatedRect box = minAreaRect(Mat(points)); + Point2f center, vtx[4]; float radius = 0; minEnclosingCircle(Mat(points), center, radius); @@ -55,6 +58,6 @@ int main( int /*argc*/, char** /*argv*/ ) if( key == 27 || key == 'q' || key == 'Q' ) // 'ESC' break; } + return 0; } -