CalibrationDialog::CalibrationDialog(QWidget *parent, Qt::WindowFlags flags):
    QDialog(parent, flags),
    _projector(),
    _cancel(false),
    _video_toget(this),
    _i(0),//可删
    timer(),//可删
    _success_open_camera(false),
    _success_read_pattern(false),
    _patterns_to_corner(),
    _num_pictrue(0),//第几张拍下的照片,第一张需要剔除
    _num_position(0),//一共多少个摆姿
    _current_positon(0),//初始化为第一个摆放位置
    _sum_pattern_to_corner(0)//存储所有摆放位置的图
{
    setupUi(this);
    //_patterns_to_corner.resize(42);//设置容器大小为42
    update_screen_combo();//更新所用的屏幕为哪一个,是配置文件保存的,还是所选的
    //update projector view
    _projector.set_screen(screen_combo->currentIndex());//设置要投影在第几屏幕,设置_screen变量的值(索引值:0 or 1 or 2 ...)
    position_spinBox->setValue(1);
    //初始化buf对应的image大小;可修改#######这里采集图片的大小是768*576
    _buf_image=cv::Mat(576,768,CV_8UC3);



    //start video preview
    _success_read_pattern=read_pattern();

     _projector.start();//将widget全屏显示,并且根据此时的屏幕设置bit数###################关键
     _success_open_camera=start_camera();//开启相机预览#####改写//可删


}
Example #2
0
 //TODO This is a f*****g bug! Cannot initialize ngpt::antenna_pcv<pcv_type>(0, 0, 0, 0, 0)
 //     an asesertion will fail; check the constructor.
 //     Also, since we may know where the f**k the antenna is inside the file,
 //     i should overload a version which accepts a pos_type as input argument
 //     (see get_antenna_list())
 ngpt::antenna_pcv<pcv_type> 
 get_antenna_pattern(const antenna& ant)
 {
     int status = find_antenna(ant);
     if ( status ) {
         return ngpt::antenna_pcv<pcv_type>(0, 0, 0, 0, 0);
     }
     return read_pattern();
 }
Example #3
0
/*
 * mode_check_license -- 'check_license' mode function
 */
static int
mode_check_license(const char *path_pattern, const char *path_to_check,
		const char *filename)
{
	char pattern[LICENSE_MAX_LEN];

	if (read_pattern(path_pattern, pattern) == -1)
		return -1;

	return verify_license(path_to_check, pattern, filename);
}
Example #4
0
static int io_read (lua_State *L) {
  IOCtrl *ctrl = (IOCtrl *)lua_touserdata(L, -1);
  int lastarg = lua_gettop(L) - 1;
  int firstarg = 1;
  FILE *f = gethandle(L, ctrl, firstarg);
  int n;
  if (f) firstarg++;
  else f = getfilebyref(L, ctrl, INFILE);  /* get _INPUT */
  lua_pop(L, 1);
  if (firstarg > lastarg) {  /* no arguments? */
    lua_settop(L, 0);  /* erase upvalue and other eventual garbage */
    firstarg = lastarg = 1;  /* correct indices */
    lua_pushstring(L, "*l");  /* push default argument */
  }
  else  /* ensure stack space for all results and for auxlib's buffer */
    luaL_checkstack(L, lastarg-firstarg+1+LUA_MINSTACK, "too many arguments");
  for (n = firstarg; n<=lastarg; n++) {
    int success;
    if (lua_isnumber(L, n))
      success = read_chars(L, f, (size_t)Re(lua_tonumber(L, n)));
    else {
      const char *p = luaL_check_string(L, n);
      if (p[0] != '*')
        success = read_pattern(L, f, p);  /* deprecated! */
      else {
        switch (p[1]) {
          case 'n':  /* number */
            if (!read_number(L, f)) goto endloop;  /* read fails */
            continue;  /* number is already pushed; avoid the "pushstring" */
          case 'l':  /* line */
            success = read_line(L, f);
            break;
          case 'a':  /* file */
            read_file(L, f);
            success = 1; /* always success */
            break;
          case 'w':  /* word */
            success = read_word(L, f);
            break;
          default:
            luaL_argerror(L, n, "invalid format");
            success = 0;  /* to avoid warnings */
        }
      }
    }
    if (!success) {
      lua_pop(L, 1);  /* remove last result */
      break;  /* read fails */
    }
  } endloop:
  return n - firstarg;
}
Example #5
0
int main(int argc, char **argv) {
    char *pattern          = NULL;
    int status             = 0;
    regex_t *preg          = malloc(sizeof(regex_t));
    int regcomp_flags      = REG_BASIC;
    int regex_errcode      = 0;
    gargs.is_invert        = 0;
    gargs.show_filename    = 0;
    gargs.show_line_number = 0;

    static const char *optstr = "Ee:Hhinv";
    int opt = 0;
    while ((opt = getopt(argc, argv, optstr)) != -1) {
        switch(opt) {
        case 'e':
            pattern = read_pattern(optarg);
            break;
        case 'E':
            regcomp_flags |= REG_EXTENDED;
            break;
        case 'H':
            gargs.show_filename = 1;
            break;
        case 'h':
            display_usage(EXIT_SUCCESS, NULL, EXIT_SUCCESS);
            break;
        case 'i':
            regcomp_flags |= REG_ICASE;
            break;
        case 'n':
            gargs.show_line_number = 1;
            break;
        case 'v':
            gargs.is_invert = 1;
            break;
        default: // shouldn't reach here
            break;
        }
    }
    if ( !pattern ) { // no -e option
        if (argc - optind < 1) {
            display_usage(EXIT_TROUBLE, "Please provide pattern.", -1);
        } else {
            pattern = read_pattern(argv[optind++]);
        }
    }

    if ( (regex_errcode = regcomp(preg, pattern, regcomp_flags)) != 0 ) {
        regfree(preg);
        display_usage(EXIT_TROUBLE, "Pattern invalid.", regex_errcode);
    }
        
    free(pattern);

    #ifdef DEBUG
    printf("optind:%d, argc:%d\n\n", optind, argc);
    #endif

    if (argc == optind) { // use stdin
        status = do_grep(preg, "-");
        regfree(preg);
        exit(status);
    }

    if (argc - optind > 1)
        gargs.show_filename = 1;

    while (optind < argc) {
        char *filename = argv[optind++];
        if (isdir(filename))
            fprintf(stderr, "[WARNING] %s is a directory.\n", filename);
            //display_usage(EXIT_TROUBLE, "Please provide a file instead of directory", -1);
        status = do_grep(preg, filename);
    }

    regfree(preg);
    exit(status);
}