Fix build of samples

This commit is contained in:
Andrey Kamaev
2012-10-16 20:03:07 +04:00
parent 7225f89ea2
commit f4e33ea0ba
5 changed files with 53 additions and 186 deletions

View File

@@ -26,41 +26,41 @@ static Mat loadImage(const string& name)
int main(int argc, const char* argv[])
{
CommandLineParser cmd(argc, argv,
"{ image i | pic1.png | input image }"
"{ template t | templ.png | template image }"
"{ scale s | | estimate scale }"
"{ rotation r | | estimate rotation }"
"{ gpu | | use gpu version }"
"{ minDist | 100 | minimum distance between the centers of the detected objects }"
"{ levels | 360 | R-Table levels }"
"{ votesThreshold | 30 | the accumulator threshold for the template centers at the detection stage. The smaller it is, the more false positions may be detected }"
"{ angleThresh | 10000 | angle votes treshold }"
"{ scaleThresh | 1000 | scale votes treshold }"
"{ posThresh | 100 | position votes threshold }"
"{ dp | 2 | inverse ratio of the accumulator resolution to the image resolution }"
"{ minScale | 0.5 | minimal scale to detect }"
"{ maxScale | 2 | maximal scale to detect }"
"{ scaleStep | 0.05 | scale step }"
"{ minAngle | 0 | minimal rotation angle to detect in degrees }"
"{ maxAngle | 360 | maximal rotation angle to detect in degrees }"
"{ angleStep | 1 | angle step in degrees }"
"{ maxSize | 1000 | maximal size of inner buffers }"
"{ help h ? | | print help message }"
"{ i | image | pic1.png | input image }"
"{ t | template | templ.png | template image }"
"{ s | scale | | estimate scale }"
"{ r | rotation | | estimate rotation }"
"{ | gpu | | use gpu version }"
"{ | minDist | 100 | minimum distance between the centers of the detected objects }"
"{ | levels | 360 | R-Table levels }"
"{ | votesThreshold | 30 | the accumulator threshold for the template centers at the detection stage. The smaller it is, the more false positions may be detected }"
"{ | angleThresh | 10000 | angle votes treshold }"
"{ | scaleThresh | 1000 | scale votes treshold }"
"{ | posThresh | 100 | position votes threshold }"
"{ | dp | 2 | inverse ratio of the accumulator resolution to the image resolution }"
"{ | minScale | 0.5 | minimal scale to detect }"
"{ | maxScale | 2 | maximal scale to detect }"
"{ | scaleStep | 0.05 | scale step }"
"{ | minAngle | 0 | minimal rotation angle to detect in degrees }"
"{ | maxAngle | 360 | maximal rotation angle to detect in degrees }"
"{ | angleStep | 1 | angle step in degrees }"
"{ | maxSize | 1000 | maximal size of inner buffers }"
"{ h | help | | print help message }"
);
cmd.about("This program demonstrates arbitary object finding with the Generalized Hough transform.");
//cmd.about("This program demonstrates arbitary object finding with the Generalized Hough transform.");
if (cmd.has("help"))
if (cmd.get<bool>("help"))
{
cmd.printMessage();
cmd.printParams();
return 0;
}
const string templName = cmd.get<string>("template");
const string imageName = cmd.get<string>("image");
const bool estimateScale = cmd.has("scale");
const bool estimateRotation = cmd.has("rotation");
const bool useGpu = cmd.has("gpu");
const bool estimateScale = cmd.get<bool>("scale");
const bool estimateRotation = cmd.get<bool>("rotation");
const bool useGpu = cmd.get<bool>("gpu");
const double minDist = cmd.get<double>("minDist");
const int levels = cmd.get<int>("levels");
const int votesThreshold = cmd.get<int>("votesThreshold");
@@ -76,12 +76,6 @@ int main(int argc, const char* argv[])
const double angleStep = cmd.get<double>("angleStep");
const int maxSize = cmd.get<int>("maxSize");
if (!cmd.check())
{
cmd.printErrors();
return -1;
}
Mat templ = loadImage(templName);
Mat image = loadImage(imageName);