本文整理汇总了C++中demo函数的典型用法代码示例。如果您正苦于以下问题:C++ demo函数的具体用法?C++ demo怎么用?C++ demo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了demo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int ac, const char *av[])
{
if (ac == 2) {
const cv::Mat image = cv::imread(av[1]);
if (image.data) {
std::cout << "Press a key to quit." << std::endl;
DemoDisplay demo(image); demo();
std::cout << "Initial threshold is: " << demo.threshold()
<< std::endl;
cv::waitKey(0);
std::cout << "Final threshold was: " << demo.threshold()
<< std::endl;
return 0;
}
}
std::cerr << av[0] << ": Demonstrate bounding polygonal contours."
<< std::endl << std::endl
<< "Usage: " << av[0] << " <image-file>" << std::endl
<< std::endl
<< "Where: <image-file> is the name of an image file."
<< std::endl << std::endl
<< "Example: " << av[0] << " ../resources/jets.jpg"
<< std::endl << std::endl;
return 1;
}
示例2: main
int main(int ac, const char *av[])
{
if (ac == 2) {
const cv::Mat image = cv::imread(av[1]);
if (image.data) {
std::cout << std::endl << av[0] << ": Press any key to quit."
<< std::endl << std::endl;
DemoDisplay demo(image); demo();
std::cout << av[0] << ": Initial maximum Corners is: "
<< demo.maxCorners()<< std::endl << std::endl;
cv::waitKey(0);
std::cout << av[0] << ": Final maximum Corners was: "
<< demo.maxCorners() << std::endl << std::endl;
return 0;
}
}
std::cerr << av[0] << ": Demonstrate Shi-Tomasi corner finding."
<< std::endl << std::endl
<< "Usage: " << av[0] << " <image-file>" << std::endl
<< std::endl
<< "Where: <image-file> has an image with some corners in it."
<< std::endl << std::endl
<< "Example: " << av[0] << " ../resources/building.jpg"
<< std::endl << std::endl;
return 1;
}
示例3: main
int main() {
test();
demo(32);
demo(80);
demo(512);
printf("We are feeding ascii so it is always going to be ok.\n");
}
示例4: main
int main() {
demo(31);
demo(1500);
demo(15000);
demopoweroftwo(32);
demopoweroftwo(4096);
demopoweroftwo(65536);
}
示例5: main
int main() {
size_t x ;
for(x=6; x<2048; x*=2 ) {
printf("checking input size = %zu \n ",x);
if(check(x,1024 * 1024)) return -1;
printf("Ok!\n ");
}
demo(1024,1024 * 1024);
demo(1024 * 1024,1024 * 1024);
demo(32 * 1024 * 1024,1024 * 1024);
return 0;
}
示例6: main
int main()
{
float p = 0.5F, i = 0.0F, d = 0.0F;
PIDDemo demo(p, i, d);
demo.SetPosition(140);
demo.SetSetPoint(355);
for (int i = 0; i < 40; i++)
{
if (demo.OnTarget())
break;
printf("%2d: Output: %.3f Position: %.3f (error: %.3f, goal: %.3f)\n",
i,
demo.GetOutput(), demo.GetPosition(),
demo.m_controller.GetError(),
demo.m_controller.GetSetpoint());
Notifier::Pulse();
}
return 0;
}
示例7: main
int main( int argc, char *argv[])
{
const char *libdatadir;
char conjFN[512], verbsFN[512];
int exit_status;
if (argc < 2)
{
printf("conjugator.c: demo of the C API of Verbiste\n");
printf("Usage: conjugator VERB\n");
printf("Note: this program expects Latin-1 and writes Latin-1.\n");
return EXIT_FAILURE;
}
setlocale(LC_CTYPE, ""); // necessary on Solaris
libdatadir = getenv("LIBDATADIR");
if (libdatadir == NULL)
libdatadir = LIBDATADIR;
snprintf(conjFN, sizeof(conjFN), "%s/conjugation-fr.xml", libdatadir);
snprintf(verbsFN, sizeof(verbsFN), "%s/verbs-fr.xml", libdatadir);
if (verbiste_init(conjFN, verbsFN, "fr") != 0)
{
printf("conjugator.c: failed to initialize Verbiste.\n");
return EXIT_FAILURE;
}
exit_status = demo(argv[1]);
verbiste_close();
return exit_status;
}
示例8: main
int main(const int argc, const char* args[])
{
gamePtr demo(new Pacman());
demo->start();
return 0;
}
示例9: main
int main(void)
{
configure_teensy();
configure_LEDs();
configure_usb();
int16_t lastcmd = '\0', cmd = '\0';
while (1)
{
wait_for_usb_connection();
while (1)
{
cmd = usb_serial_getchar();
if(is_valid_control_key(cmd))
{
if(cmd == '+') adjust_speed(-10); // Speed up == less time.
else if(cmd == '-') adjust_speed(10);
}
if( is_valid_cmd(cmd) )
{
lastcmd = cmd;
}
if(lastcmd == 'k') knight_rider();
else if(lastcmd == 's') step();
else if(lastcmd == 'f') follow();
else if(lastcmd == '0') nop();
else demo();
}
}
}
示例10: run_yolo
void run_yolo(int argc, char **argv)
{
int dont_show = find_arg(argc, argv, "-dont_show");
int http_stream_port = find_int_arg(argc, argv, "-http_port", -1);
char *out_filename = find_char_arg(argc, argv, "-out_filename", 0);
char *prefix = find_char_arg(argc, argv, "-prefix", 0);
float thresh = find_float_arg(argc, argv, "-thresh", .2);
float hier_thresh = find_float_arg(argc, argv, "-hier", .5);
int cam_index = find_int_arg(argc, argv, "-c", 0);
int frame_skip = find_int_arg(argc, argv, "-s", 0);
int ext_output = find_arg(argc, argv, "-ext_output");
if(argc < 4){
fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
return;
}
char *cfg = argv[3];
char *weights = (argc > 4) ? argv[4] : 0;
char *filename = (argc > 5) ? argv[5]: 0;
if(0==strcmp(argv[2], "test")) test_yolo(cfg, weights, filename, thresh);
else if(0==strcmp(argv[2], "train")) train_yolo(cfg, weights);
else if(0==strcmp(argv[2], "valid")) validate_yolo(cfg, weights);
else if(0==strcmp(argv[2], "recall")) validate_yolo_recall(cfg, weights);
else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, hier_thresh, cam_index, filename, voc_names, 20, frame_skip,
prefix, out_filename, http_stream_port, dont_show, ext_output);
}
示例11: main
int main() {
info = carp_connect();
carp_reset();
demo();
carp_disconnect();
return 0;
}
示例12: run_coco
void run_coco(int argc, char **argv)
{
int i;
for(i = 0; i < 80; ++i){
char buff[256];
sprintf(buff, "data/labels/%s.png", coco_classes[i]);
coco_labels[i] = load_image_color(buff, 0, 0);
}
float thresh = find_float_arg(argc, argv, "-thresh", .2);
int cam_index = find_int_arg(argc, argv, "-c", 0);
int frame_skip = find_int_arg(argc, argv, "-s", 0);
if(argc < 4){
fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
return;
}
char *cfg = argv[3];
char *weights = (argc > 4) ? argv[4] : 0;
char *filename = (argc > 5) ? argv[5]: 0;
if(0==strcmp(argv[2], "test")) test_coco(cfg, weights, filename, thresh);
else if(0==strcmp(argv[2], "train")) train_coco(cfg, weights);
else if(0==strcmp(argv[2], "valid")) validate_coco(cfg, weights);
else if(0==strcmp(argv[2], "recall")) validate_coco_recall(cfg, weights);
else if(0==strcmp(argv[2], "demo")) demo(cfg, weights, thresh, cam_index, filename, coco_classes, coco_labels, 80, frame_skip);
}
示例13: main
int main(){
int converge = 0;
int k = 0;
while(!converge){
printf("Value Iteration %d ...", k++);
converge = 1;
for(unsigned i = 0; i < STATE_SPACE; i++){
state_t state;
state.key = i;
if(!validate_state(state)) continue;
value_update(state, k);
if(vnext[state.key] - v[state.key] > error_tolerance || vnext[state.key] - v[state.key] < -error_tolerance) converge = 0;
}
printf("\b\b\b\n");
memcpy(v, vnext, sizeof(v));
}
FILE* f = fopen("output.txt", "wb");
const char* action_name[] = {
"wait", "bt ", "rb ", "ws ",
};
for(unsigned k = 0; k < STATE_SPACE; k++){
state_t state;
state.key = k;
if(!validate_state(state)) continue;
if(!state.state.gcd)
fprintf(f, "RBST %d, BSST %d, ERRM %d, BTCD %d, RAGE %d - %s %.3f\r\n",
state.state.rb_st, state.state.bs_st, state.state.er_rm, state.state.bt_cd, state.state.rage,
action_name[pi[state.key]], v[state.key]);
}
demo();
}
示例14: main
int main( void )
{
srand( time( NULL ) );
setup_screen();
demo();
cleanup_screen();
return 0;
}
示例15: main
int main(void)
{
printf("\nBefore calling demo(), x = %d and y = %d.", x, y);
demo();
printf("\nAfter calling demo(), x = %d and y = %d.\n", x, y);
return 0;
}