本文整理汇总了C++中AppConfig::getIsHeadless方法的典型用法代码示例。如果您正苦于以下问题:C++ AppConfig::getIsHeadless方法的具体用法?C++ AppConfig::getIsHeadless怎么用?C++ AppConfig::getIsHeadless使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppConfig
的用法示例。
在下文中一共展示了AppConfig::getIsHeadless方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
// Create all the necessary objects (calls the default constructor for each)
TargetDetector detector;
TargetProcessor processor;
NetworkController networkController;
VideoDevice camera;
CmdLineInterface interface(argc, argv);
AppConfig config = interface.getConfig();
GUIManager gui;
if(config.getIsDevice())
{
camera.startCapture(config.getDeviceID());
if(config.getIsDebug())
std::cout << "Camera ready!\n";
}
//init networking
if(config.getIsNetworking())
networkController.startServer();
if(!config.getIsHeadless())
gui.init();
if(config.getIsDebug())
std::cout << "Im debugging! :D\n";
while(true)
{
networkController.waitForPing();
cv::Mat image = camera.getImage();
Target* target = detector.processImage(image);
bool foundTarget = (target == NULL ? false : true);
if(foundTarget)
{
processor.loadTarget(target);
double distance = processor.calculateDistance();
networkController.sendMessage("true;" +
boost::lexical_cast<std::string> (distance));
std::cout << "Target Found! Distance: " << distance;
}
else
{
networkController.sendMessage("false;");
}
}
return 0;
}
示例2: main
int main(int argc, char* argv[])
{
// get command line interface config options
CmdLineInterface interface(argc, argv);
AppConfig config = interface.getConfig();
GUIManager gui;
VideoDevice camera;
LProcessor processor;
NetworkController networkController;
ArduinoController arduino;
//init camera
if(config.getIsDevice())
{
camera.startCapture(config.getDeviceID());
if(config.getIsDebug())
std::cout << "Camera ready!\n";
}
//init networking
if(config.getIsNetworking())
networkController.startServer();
if(!config.getIsHeadless())
gui.init();
if (config.getHasArduino())
{
//16 is /dev/ttyUSB0, 24 is /dev/ttyACM0
arduino.init(9600, 24); //baud rate, serial port
}
//continuous server loop
do
{
if(config.getIsNetworking())
networkController.waitForPing();
LDetector detector;
cv::Mat image;
if(config.getIsFile());
//image = cv::imread(config.getFileName());
//else
// image = camera.getImage(config.getIsDebug());
//detector.elLoad(image);
//detector.elSplit();
//detector.elThresh();
//detector.elContours(); detector.elFilter();
bool foundL = true;
if (detector.getLs().size() > 0)
detector.largest2();
else
foundL = false;
if (detector.getLs().size() == 0)
foundL = false;
if (foundL)
{
processor.determineL(detector.getLs());
processor.determineAzimuth();
processor.determineDistance();
double azimuth = processor.getAzimuth();
double distance = processor.getDistance();
if(config.getIsDebug())
{
processor.outputData();
std::cout << "Final distance (m): " << processor.getDistance() << std::endl;
}
if(!config.getIsHeadless())
{
int i_dist = (int) (distance * 1000.0);
int dist_left = i_dist / 1000;
int dist_right = i_dist % 1000;
std::string dist_str = boost::lexical_cast<std::string>(dist_left) + "." + boost::lexical_cast<std::string>(dist_right);
gui.setImage(detector.show());
gui.setImageText("Distance: " + dist_str + " m");
gui.show(config.getIsFile());
}
if(config.getIsNetworking())
{
networkController.sendMessage(boost::lexical_cast<std::string> ("true") + std::string(";")
+ boost::lexical_cast<std::string> (distance) + std::string(";")
+ boost::lexical_cast<std::string> (azimuth));
}
}
else
{
if(config.getIsNetworking())
networkController.sendMessage(boost::lexical_cast<std::string> ("false") + std::string(";"));
if(!config.getIsHeadless())
{
gui.setImage(detector.show());
gui.setImageText("No L's Found");
//.........这里部分代码省略.........