Skip to content

Commit

Permalink
Added selection of the video device by the index (web cam).
Browse files Browse the repository at this point in the history
  • Loading branch information
MPGek committed Apr 26, 2016
1 parent 55a9299 commit 3b6ac06
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions Chapter3_MarkerlessAR/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,33 @@ int main(int argc, const char * argv[])
else
{
cv::VideoCapture cap;
if (cap.open(input))
{
processVideo(patternImage, calibration, cap);
}
}
if (cap.open(input))
{
processVideo(patternImage, calibration, cap);
}
if (cap.open(input))
{
processVideo(patternImage, calibration, cap);
}
else
{
int deviceIndex;
try
{
deviceIndex = std::stoi(input);
}
catch (std::invalid_argument e)
{
std::cerr << "Can't parse device index \"" << input << "\" as an integer value!" << std::endl;
return 1;
}

if (cap.open(deviceIndex))
{
processVideo(patternImage, calibration, cap);
}
}
}
}
else
{
Expand Down

0 comments on commit 3b6ac06

Please sign in to comment.