mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Added command line option to select VideoCapture backend.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "parametersController.hpp"
|
||||
#include <opencv2/objdetect/aruco_dictionary.hpp>
|
||||
|
||||
#include <opencv2/videoio/registry.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <typename T>
|
||||
@@ -106,6 +106,27 @@ bool calib::parametersController::loadFromParser(cv::CommandLineParser &parser)
|
||||
mCapParams.camID = parser.get<int>("ci");
|
||||
}
|
||||
|
||||
mCapParams.camBackend = cv::CAP_ANY;
|
||||
if (parser.has("vb"))
|
||||
{
|
||||
std::string backendName = parser.get<std::string>("vb");
|
||||
auto backs = cv::videoio_registry::getBackends();
|
||||
bool backendSet = false;
|
||||
for (const auto& b: backs)
|
||||
{
|
||||
if (backendName == cv::videoio_registry::getBackendName(b))
|
||||
{
|
||||
mCapParams.camBackend = b;
|
||||
backendSet = true;
|
||||
}
|
||||
}
|
||||
if (!backendSet)
|
||||
{
|
||||
std::cout << "Unknown or unsupported backend " << backendName << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::string templateType = parser.get<std::string>("t");
|
||||
|
||||
if(templateType.find("symcircles", 0) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user