The samples were updated corresponding a single standart for <help>

pull/13383/head
Kirill Kornyakov 14 years ago
parent 262fc33024
commit 09a7a40478
  1. 12
      samples/c/convert_cascade.c
  2. 4
      samples/c/delaunay.c
  3. 6
      samples/c/fback_c.c
  4. 8
      samples/c/find_obj.cpp
  5. 6
      samples/c/find_obj_ferns.cpp
  6. 6
      samples/c/latentsvmdetect.cpp
  7. 24
      samples/c/morphology.c
  8. 4
      samples/c/motempl.c
  9. 4
      samples/c/mser_sample.cpp
  10. 30
      samples/c/mushroom.cpp
  11. 6
      samples/c/polar_transforms.c
  12. 28
      samples/c/pyramid_segmentation.c

@ -6,8 +6,14 @@
void help() void help()
{ {
printf( "Usage:\n" "" printf("\n This sample demonstrates cascade's convertation \n"
"./convert_cascade --size=\"<width>x<height>\" input_cascade_path output_cascade_filename\n" ); "Usage:\n"
"./convert_cascade --size=\"<width>x<height>\"<convertation size> \n"
" input_cascade_path \n"
" output_cascade_filename\n"
"Example: \n"
"./convert_cascade --size=640x480 ../../opencv/data/haarcascades/haarcascade_eye.xml ../../opencv/data/haarcascades/test_cascade.xml \n"
);
} }
int main( int argc, char** argv ) int main( int argc, char** argv )
@ -17,6 +23,8 @@ int main( int argc, char** argv )
CvHaarClassifierCascade* cascade = 0; CvHaarClassifierCascade* cascade = 0;
CvSize size; CvSize size;
help();
if( argc != 4 || strncmp( argv[1], size_opt, strlen(size_opt) ) != 0 ) if( argc != 4 || strncmp( argv[1], size_opt, strlen(size_opt) ) != 0 )
{ {
help(); help();

@ -7,8 +7,8 @@ void help()
printf("\nThis program demostrates iterative construction of\n" printf("\nThis program demostrates iterative construction of\n"
"delaunay triangulation and voronoi tesselation.\n" "delaunay triangulation and voronoi tesselation.\n"
"It draws a random set of points in an image and then delaunay triangulates them.\n" "It draws a random set of points in an image and then delaunay triangulates them.\n"
"Call:\n" "Usage: \n"
"./delaunay\n" "./delaunay \n"
"\nThis program builds the traingulation interactively, you may stop this process by\n" "\nThis program builds the traingulation interactively, you may stop this process by\n"
"hitting any key.\n"); "hitting any key.\n");
} }

@ -4,10 +4,10 @@
void help() void help()
{ {
printf( printf(
"This program demonstrate dense \"Farneback\n optical flow\n" "\n This program demonstrate dense \"Farneback\n optical flow\n"
"It read from camera 0, and shows how to use and display dense Franeback optical flow\n" "It read from camera 0, and shows how to use and display dense Franeback optical flow\n"
"Call:\n" "Usage: \n"
"./fback_c\n\n"); "./fback_c \n");
} }
void drawOptFlowMap(const CvMat* flow, CvMat* cflowmap, int step, void drawOptFlowMap(const CvMat* flow, CvMat* cflowmap, int step,

@ -19,12 +19,14 @@ using namespace cv;
void help() void help()
{ {
printf( "This program demonstrated the use of the SURF Detector and Descriptor using\n" printf( "\n This program demonstrated the use of the SURF Detector and Descriptor using\n"
"either FLANN (fast approx nearst neighbor classification) or brute force matching\n" "either FLANN (fast approx nearst neighbor classification) or brute force matching\n"
"on planar objects.\n" "on planar objects.\n"
"Usage :\n" "Usage: \n"
"./find_obj [--object_filename]=<object_filename, box.png as default> \n" "./find_obj [--object_filename]=<object_filename, box.png as default> \n"
" [--scene_filename]=<scene_filename box_in_scene.png as default>]\n\n" " [--scene_filename]=<scene_filename box_in_scene.png as default>] \n"
"Example: \n"
"./find_obj --object_filename =box.png --scene_filename = box_in_scene.png \n\n"
); );
} }

@ -14,9 +14,11 @@ void help()
{ {
printf( "This program shows the use of the \"fern\" plannar PlanarObjectDetector point\n" printf( "This program shows the use of the \"fern\" plannar PlanarObjectDetector point\n"
"descriptor classifier" "descriptor classifier"
"Usage:\n" "Usage: \n"
"./find_obj_ferns [--object_filename]=<object_filename, box.png as default> \n" "./find_obj_ferns [--object_filename]=<object_filename, box.png as default> \n"
" [--scene_filename]=<scene_filename box_in_scene.png as default>] \n"); " [--scene_filename]=<scene_filename box_in_scene.png as default>] \n"
"Example: \n"
"./find_obj_ferns --object_filename=box.png --scene_filename=box_in_scene.png \n");
} }
int main(int argc, const char** argv) int main(int argc, const char** argv)

@ -19,8 +19,10 @@ void help()
"It reads in a trained object model and then uses that to detect the object in an image\n" "It reads in a trained object model and then uses that to detect the object in an image\n"
"Usage: \n" "Usage: \n"
"./latentsvmdetect [--image_filename]=<image_filename, cat.jpg as default> \n" "./latentsvmdetect [--image_filename]=<image_filename, cat.jpg as default> \n"
" [--model_filename] = <model_filename, cat.xml as default> \n" " [--model_filename]=<model_filename, cat.xml as default> \n"
" [--threads_number] = <number of threads, -1 as default>\n" " [--threads_number]=<number of threads, -1 as default>\n"
"Example: \n"
"./latentsvmdetect --image_filename=cat.jpg --model_filename=cat.xml --threads_number=7 \n"
" Press any key to quit.\n"); " Press any key to quit.\n");
} }

@ -58,23 +58,31 @@ void help()
"Morphology operators are built on max (close) and min (open) operators as measured by pixels covered by small structuring elements.\n" "Morphology operators are built on max (close) and min (open) operators as measured by pixels covered by small structuring elements.\n"
"These operators are very efficient.\n" "These operators are very efficient.\n"
"This program also allows you to play with elliptical, rectangluar and cross structure elements\n" "This program also allows you to play with elliptical, rectangluar and cross structure elements\n"
"Call:\n" "Usage: \n"
"./morphologyc [image_name -- Default baboon.jpg]\n" "./morphologyc [image_name -- Default baboon.jpg]\n"
"\nHot keys: \n" "\nHot keys: \n"
"\tESC - quit the program\n" "\tESC - quit the program\n"
"\tr - use rectangle structuring element\n" "\tr - use rectangle structuring element\n"
"\te - use elliptic structuring element\n" "\te - use elliptic structuring element\n"
"\tc - use cross-shaped structuring element\n" "\tc - use cross-shaped structuring element\n"
"\tSPACE - loop through all the options\n" ); "\tSPACE - loop through all the options\n" );
} }
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
char* filename = argc == 2 ? argv[1] : (char*)"baboon.jpg"; char* filename = 0;
help();
filename = argc == 2 ? argv[1] : (char*)"baboon.jpg";
if( (src = cvLoadImage(filename,1)) == 0 ) if( (src = cvLoadImage(filename,1)) == 0 )
{
printf("Cannot load file image %s\n", filename);
help();
return -1; return -1;
}
help();
dst = cvCloneImage(src); dst = cvCloneImage(src);

@ -12,7 +12,7 @@ void help()
"of thresholded layers of decaying frame differencing. New movements are stamped on top with floating system\n" "of thresholded layers of decaying frame differencing. New movements are stamped on top with floating system\n"
"time code and motions too old are thresholded away. This is the 'motion history file'. The program reads from the camera of your choice or from\n" "time code and motions too old are thresholded away. This is the 'motion history file'. The program reads from the camera of your choice or from\n"
"a file. Gradients of motion history are used to detect direction of motoin etc\n" "a file. Gradients of motion history are used to detect direction of motoin etc\n"
"Call:\n" "Usage :\n"
"./motempl [camera number 0-n or file name, default is camera 0]\n" "./motempl [camera number 0-n or file name, default is camera 0]\n"
); );
} }
@ -160,7 +160,9 @@ int main(int argc, char** argv)
{ {
IplImage* motion = 0; IplImage* motion = 0;
CvCapture* capture = 0; CvCapture* capture = 0;
help(); help();
if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0]))) if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0])))
capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] - '0' : 0 ); capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] - '0' : 0 );
else if( argc == 2 ) else if( argc == 2 )

@ -17,7 +17,9 @@ void help()
printf("\nThis program demonstrates the Maximal Extremal Region interest point detector.\n" printf("\nThis program demonstrates the Maximal Extremal Region interest point detector.\n"
"It finds the most stable (in size) dark and white regions as a threshold is increased.\n" "It finds the most stable (in size) dark and white regions as a threshold is increased.\n"
"\n Usage: \n" "\n Usage: \n"
"./mser_sample [--image_filename] <path_and_image_filename, default is 'puzzle.png'> \n"); "./mser_sample [--image_filename] <path_and_image_filename, default is 'puzzle.png'> \n"
"Example: \n"
"./mser_sample --image_filename=puzzle.png \n");
} }
static CvScalar colors[] = static CvScalar colors[] =

@ -5,20 +5,20 @@
void help() void help()
{ {
printf("\nThis program demonstrated the use of OpenCV's decision tree function for learning and predicting data\n" printf("\nThis program demonstrated the use of OpenCV's decision tree function for learning and predicting data\n"
"Call:\n" "Usage :\n"
"./mushroom <path to agaricus-lepiota.data>\n"); "./mushroom <path to agaricus-lepiota.data>\n"
printf("\n" "\n"
"The sample demonstrates how to build a decision tree for classifying mushrooms.\n" "The sample demonstrates how to build a decision tree for classifying mushrooms.\n"
"It uses the sample base agaricus-lepiota.data from UCI Repository, here is the link:\n" "It uses the sample base agaricus-lepiota.data from UCI Repository, here is the link:\n"
"\n" "\n"
"Newman, D.J. & Hettich, S. & Blake, C.L. & Merz, C.J. (1998).\n" "Newman, D.J. & Hettich, S. & Blake, C.L. & Merz, C.J. (1998).\n"
"UCI Repository of machine learning databases\n" "UCI Repository of machine learning databases\n"
"[http://www.ics.uci.edu/~mlearn/MLRepository.html].\n" "[http://www.ics.uci.edu/~mlearn/MLRepository.html].\n"
"Irvine, CA: University of California, Department of Information and Computer Science.\n" "Irvine, CA: University of California, Department of Information and Computer Science.\n"
"\n" "\n"
"// loads the mushroom database, which is a text file, containing\n" "// loads the mushroom database, which is a text file, containing\n"
"// one training sample per row, all the input variables and the output variable are categorical,\n" "// one training sample per row, all the input variables and the output variable are categorical,\n"
"// the values are encoded by characters.\n\n"); "// the values are encoded by characters.\n\n");
} }
int mushroom_read_database( const char* filename, CvMat** data, CvMat** missing, CvMat** responses ) int mushroom_read_database( const char* filename, CvMat** data, CvMat** missing, CvMat** responses )
@ -298,6 +298,8 @@ int main( int argc, char** argv )
CvDTree* dtree; CvDTree* dtree;
const char* base_path = argc >= 2 ? argv[1] : "agaricus-lepiota.data"; const char* base_path = argc >= 2 ? argv[1] : "agaricus-lepiota.data";
help();
if( !mushroom_read_database( base_path, &data, &missing, &responses ) ) if( !mushroom_read_database( base_path, &data, &missing, &responses ) )
{ {
printf( "\nUnable to load the training database\n\n"); printf( "\nUnable to load the training database\n\n");

@ -9,7 +9,7 @@
void help() void help()
{ {
printf("\nThis program illustrates Linear-Polar and Log-Polar image transforms\n" printf("\nThis program illustrates Linear-Polar and Log-Polar image transforms\n"
"Call:\n" "Usage :\n"
"./polar_transforms [[camera number -- Default 0],[AVI path_filename]]\n\n" "./polar_transforms [[camera number -- Default 0],[AVI path_filename]]\n\n"
); );
} }
@ -20,15 +20,17 @@ int main( int argc, char** argv )
IplImage* lin_polar_img = 0; IplImage* lin_polar_img = 0;
IplImage* recovered_img = 0; IplImage* recovered_img = 0;
help();
if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0]))) if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0])))
capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] - '0' : 0 ); capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] - '0' : 0 );
else if( argc == 2 ) else if( argc == 2 )
capture = cvCaptureFromAVI( argv[1] ); capture = cvCaptureFromAVI( argv[1] );
help();
if( !capture ) if( !capture )
{ {
fprintf(stderr,"Could not initialize capturing...\n"); fprintf(stderr,"Could not initialize capturing...\n");
fprintf(stderr,"Usage: %s <CAMERA_NUMBER> , or \n %s <VIDEO_FILE>\n",argv[0],argv[0]); fprintf(stderr,"Usage: %s <CAMERA_NUMBER> , or \n %s <VIDEO_FILE>\n",argv[0],argv[0]);
help();
return -1; return -1;
} }

@ -7,7 +7,7 @@ void help()
{ {
printf("\nThis program demonstrated color pyramid segmentation cvcvPyrSegmentation() which is controlled\n" printf("\nThis program demonstrated color pyramid segmentation cvcvPyrSegmentation() which is controlled\n"
"by two trhesholds which can be manipulated by a trackbar. It can take an image file name or defaults to 'fruits.jpg'\n" "by two trhesholds which can be manipulated by a trackbar. It can take an image file name or defaults to 'fruits.jpg'\n"
"Call:\n" "Usage :\n"
"./pyaramid_segmentation [image_path_filename -- Defaults to fruits.jpg]\n\n" "./pyaramid_segmentation [image_path_filename -- Defaults to fruits.jpg]\n\n"
); );
} }
@ -36,32 +36,24 @@ void ON_SEGMENT(int a)
cvPyrSegmentation(image0, image1, storage, &comp, cvPyrSegmentation(image0, image1, storage, &comp,
level, threshold1+1, threshold2+1); level, threshold1+1, threshold2+1);
/*l_comp = comp->total;
i = 0;
min_comp.value = cvScalarAll(0);
while(i<l_comp)
{
cur_comp = (CvConnectedComp*)cvGetSeqElem ( comp, i );
if(fabs(255- min_comp.value.val[0])>
fabs(255- cur_comp->value.val[0]) &&
fabs(min_comp.value.val[1])>
fabs(cur_comp->value.val[1]) &&
fabs(min_comp.value.val[2])>
fabs(cur_comp->value.val[2]) )
min_comp = *cur_comp;
i++;
}*/
cvShowImage("Segmentation", image1); cvShowImage("Segmentation", image1);
} }
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
char* filename = argc == 2 ? argv[1] : (char*)"fruits.jpg"; char* filename;
help();
filename = argc == 2 ? argv[1] : (char*)"fruits.jpg";
if( (image[0] = cvLoadImage( filename, 1)) == 0 ) if( (image[0] = cvLoadImage( filename, 1)) == 0 )
{
help();
printf("Cannot load fileimage - %s\n", filename);
return -1; return -1;
}
cvNamedWindow("Source", 0); cvNamedWindow("Source", 0);
cvShowImage("Source", image[0]); cvShowImage("Source", image[0]);

Loading…
Cancel
Save