本文整理汇总了C++中ModelManager::exportOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelManager::exportOptions方法的具体用法?C++ ModelManager::exportOptions怎么用?C++ ModelManager::exportOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelManager
的用法示例。
在下文中一共展示了ModelManager::exportOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(const int argc, const char **argv)
{
MYLOGVERB = LOG_INFO;
ModelManager *mgr = new ModelManager("Extract Patches for Hmax with Feature Learning");
mgr->exportOptions(MC_RECURSE);
// required arguments
// <c1patchesDir> <trainPosDir>
if (mgr->parseCommandLine(
(const int)argc, (const char**)argv, "<c1patchesDir> <trainPosDir>", 2, 2) == false)
return 1;
// Create a temp HmaxFL object to extract C1Patches
std::vector<int> c1ScaleSS(2);
c1ScaleSS[0] = 1; c1ScaleSS[1] = 3;
std::vector<int> c1SpaceSS(2);
c1SpaceSS[0] = 10; c1SpaceSS[1] = 11;
// desired frame sizes [11 and 13]
HmaxFL hmax(NORI,c1SpaceSS,c1ScaleSS,2,true,1.0F,1.0F,0.3F,4.05F,-0.05F,11,2);
std::string c1PatchesBaseDir;
std::string trainPosName; // Directory where positive images are
c1PatchesBaseDir = mgr->getExtraArg(0);
trainPosName = mgr->getExtraArg(1);
// Extract random patches from a set of images in a positive training directory
std::vector<std::string> trainPos = hmax.readDir(trainPosName);
int posTrainSize = trainPos.size();
//Image<byte> inputb;
Image<float> trainPosImage;
std::cout << "Scanned training and testing images" << std::endl;
std::vector<int> pS(4);
pS[0] = 4; pS[1] = 8, pS[2] = 12; pS[3] = 16;
std::srand(time(0));
for(int i=0;i<NUM_PATCHES_PER_SIZE;i++){
// Randomly select an image from the list
unsigned int imInd = static_cast<unsigned int>(floor((rand()-1.0F)/RAND_MAX*posTrainSize));
trainPosImage = Raster::ReadFloat(trainPos[imInd]);
// Learn the appropriate simple S2 patches from the C1 results
hmax.extractRandC1Patch(c1PatchesBaseDir,trainPosImage,i,pS);
}
std::cout << "Completed extraction of C1 Patches" << std::endl;
return 0;
}
示例2: main
int main(int argc, const char **argv)
{
// Instantiate a ModelManager:
ModelManager *manager = new ModelManager("Test wiimote");
nub::soft_ref<OutputFrameSeries> ofs(new OutputFrameSeries(*manager));
manager->addSubComponent(ofs);
//Create the GUI
nub::soft_ref<GeneralGUI> pwiiGUI(new GeneralGUI(*manager, "PWiiGUI", "PWiiGUI", Dims(700,512)));
manager->addSubComponent(pwiiGUI);
//Create the PWiiBot Controller
nub::soft_ref<PWiiController> controller(new PWiiController(*manager));
manager->addSubComponent(controller);
// Parse command-line:
if (manager->parseCommandLine(argc, argv, "", 0, 0) == false) return(1);
manager->exportOptions(MC_RECURSE);
manager->start();
sleep(1);
setupGUI(pwiiGUI, ofs, controller);
while(1) {
}
// sleep(1);
#ifdef HAVE_LIBWIIMOTE
/* wiimote_t wiimote = WIIMOTE_INIT;
//wiimote_report_t report = WIIMOTE_REPORT_INIT;
LINFO("Press buttons 1 and 2 on the wiimote now to connect.");
int nmotes = wiimote_discover(&wiimote, 1);
if (nmotes == 0)
LFATAL("no wiimotes were found");
LINFO("found: %s\n", wiimote.link.r_addr);
if (wiimote_connect(&wiimote, wiimote.link.r_addr) < 0) {
LFATAL("Unable to connect to wiimote");
Raster::waitForKey();
}
*/
/* Activate the first led on the wiimote. It will take effect on the
next call to wiimote_update. */
/*
wiimote.led.one = 1;
// let's get all our ModelComponent instances started:
LINFO("Open ");
LINFO("Status %i", wiimote_is_open(&wiimote));
int speed = 100;
int motor1_dir = 0;
int motor1_vel = 0;
int motor2_dir = 0;
int motor2_vel = 0;
Point2D<int> loc(128,128);
*/
// while(wiimote_is_open(&wiimote))
// {
/* The wiimote_update function is used to synchronize the wiimote
object with the real wiimote. It should be called as often as
possible in order to minimize latency. */
/* if (wiimote_update(&wiimote) < 0) {
wiimote_disconnect(&wiimote);
break;
}*/
/* The wiimote object has member 'keys' which keep track of the
current key state. */
/*
if (wiimote.keys.home) { //press home to exit
wiimote_write_byte(&wiimote, 0x04a40001, motor1_dir);
wiimote_write_byte(&wiimote, 0x04a40002, 0);
wiimote_write_byte(&wiimote, 0x04a40003, motor2_dir);
wiimote_write_byte(&wiimote, 0x04a40004, 0);
LINFO("Shutting Down Motors and Gracefully Disconnecting...");
wiimote_disconnect(&wiimote);
LINFO("Disconnected, Goodbye!");
}
*/
//.........这里部分代码省略.........
示例3: main
int main(const int argc, const char **argv)
{
MYLOGVERB = LOG_INFO;
ModelManager *mgr = new ModelManager("Test ObjRec");
nub::ref<OutputFrameSeries> ofs(new OutputFrameSeries(*mgr));
mgr->addSubComponent(ofs);
nub::ref<InputFrameSeries> ifs(new InputFrameSeries(*mgr));
mgr->addSubComponent(ifs);
nub::ref<EnvSegmenterCannyContour> seg(new EnvSegmenterCannyContour(*mgr));
mgr->addSubComponent(seg);
mgr->exportOptions(MC_RECURSE);
if (mgr->parseCommandLine(
(const int)argc, (const char**)argv, "", 0, 0) == false)
return 1;
mgr->start();
seg->setModelParamVal("CannyMinCos", 1.0);
seg->setModelParamVal("CannyMaxArea", 6000);
seg->setModelParamVal("CannyMaxArea", 12000);
itsObjectDB.loadFrom("cards.vdb");
while(1)
{
Image< PixRGB<byte> > inputImg;
const FrameState is = ifs->updateNext();
if (is == FRAME_COMPLETE)
break;
//grab the images
GenericFrame input = ifs->readFrame();
if (!input.initialized())
break;
inputImg = input.asRgb();
Image<PixRGB<byte> > out;
const Rectangle cardbox = seg->getFoa(inputImg, Point2D<int>(), NULL, &out);
ofs->writeRGB(out, "input", FrameInfo("input", SRC_POS));
if (cardbox.isValid())
{
Image<PixRGB<byte> > card =
crop(inputImg, cardbox.getOverlap(inputImg.getBounds()));
std::string cardName = recCard(card);
if (cardName.length() == 0)
{
LINFO("Enter name for card:");
std::getline(std::cin, cardName, '\n');
if (cardName.length() > 0)
trainCard(card, cardName);
}
writeText(card, Point2D<int>(0,0), cardName.c_str(),
PixRGB<byte>(255), PixRGB<byte>(127));
ofs->writeRGB(card, "card", FrameInfo("card", SRC_POS));
}
ofs->updateNext();
}
mgr->stop();
return 0;
}