From fddcaa56fcbe57752ac1f9ccd9bc87ad6131d101 Mon Sep 17 00:00:00 2001
From: Gary Bradski <no@email>
Date: Sat, 4 Dec 2010 08:28:57 +0000
Subject: [PATCH] revamped

---
 samples/cpp/ffilldemo.cpp | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/samples/cpp/ffilldemo.cpp b/samples/cpp/ffilldemo.cpp
index 72e527c2b..e5e52481d 100644
--- a/samples/cpp/ffilldemo.cpp
+++ b/samples/cpp/ffilldemo.cpp
@@ -6,6 +6,24 @@
 using namespace cv;
 using namespace std;
 
+void help()
+{
+    cout << "\nThis program demonstrated the floodFill() function\n"
+    		"Call:\n"
+    		"./ffilldemo [image_name -- Default: fruits.jpg]\n" << endl;
+
+	cout << "Hot keys: \n"
+			"\tESC - quit the program\n"
+			"\tc - switch color/grayscale mode\n"
+			"\tm - switch mask mode\n"
+			"\tr - restore the original image\n"
+			"\ts - use null-range floodfill\n"
+			"\tf - use gradient floodfill with fixed(absolute) range\n"
+			"\tg - use gradient floodfill with floating(relative) range\n"
+			"\t4 - use 4-connectivity mode\n"
+			"\t8 - use 8-connectivity mode\n" << endl;
+}
+
 Mat image0, image, gray, mask;
 int ffillMode = 1;
 int loDiff = 20, upDiff = 20;
@@ -58,21 +76,10 @@ int main( int argc, char** argv )
     
     if( image0.empty() )
     {
-        cout << "Usage: ffilldemo <image_name>\n";
+        cout << "Image empty. Usage: ffilldemo <image_name>\n";
         return 0;
     }
-
-    cout << "Hot keys: \n"
-            "\tESC - quit the program\n"
-            "\tc - switch color/grayscale mode\n"
-            "\tm - switch mask mode\n"
-            "\tr - restore the original image\n"
-            "\ts - use null-range floodfill\n"
-            "\tf - use gradient floodfill with fixed(absolute) range\n"
-            "\tg - use gradient floodfill with floating(relative) range\n"
-            "\t4 - use 4-connectivity mode\n"
-            "\t8 - use 8-connectivity mode\n";
-
+    help();
     image0.copyTo(image);
     cvtColor(image0, gray, CV_BGR2GRAY);
     mask.create(image0.rows+2, image0.cols+2, CV_8UC1);