Skip to content

Commit

Permalink
Parameters added to console app
Browse files Browse the repository at this point in the history
  • Loading branch information
vackup committed Jun 11, 2018
1 parent 7c0a298 commit e6276cb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
5 changes: 3 additions & 2 deletions CoreXimgprocSeg/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ namespace CoreXimgprocSeg
for (std::vector<cv::Rect>::iterator it = rects.begin(); it != rects.end(); ++it) {

rectsCLR.push_back(RectCLR((*it).x, (*it).y, (*it).width, (*it).height));
}
}

return rectsCLR;

/*int nb_rects = 10;
Expand Down Expand Up @@ -80,5 +79,7 @@ namespace CoreXimgprocSeg
nb_rects -= 10;
}
}*/

return rectsCLR;
}
}
26 changes: 22 additions & 4 deletions CoreXimgprocSegConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,34 @@ static void Main(string[] args)
{
try
{
var fileName = "deer.jpg";
if (args.Length < 3)
{
Console.WriteLine("Must specify fileName and strategyType and if you want to display results. EG: deer.jpg f y");
return;
}

var watch = System.Diagnostics.Stopwatch.StartNew();

var fileName = args[0];
var strategyType = args[1];
var displayResult = args[2].ToLower() == "y";

var selectiveSearch = new SelectiveSearch();

var rects = selectiveSearch.GetRectangles(fileName, "f");
var rects = selectiveSearch.GetRectangles(fileName, strategyType);

watch.Stop();
var elapsedMs = watch.ElapsedMilliseconds;

foreach (var r in rects.ToList())
if (displayResult)
{
Console.WriteLine($"X {r.X} Y {r.Y} Width {r.Width} Height {r.Height}");
foreach (var r in rects.ToList())
{
Console.WriteLine($"X {r.X} Y {r.Y} Width {r.Width} Height {r.Height}");
}
}

Console.WriteLine($"Total time {elapsedMs} milliseconds");
}
catch (Exception e)
{
Expand Down

0 comments on commit e6276cb

Please sign in to comment.