示例#1
0
文件: opencv_menu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_new_cascade )
{
	const char * s;
	const char *cascade_name;
	OpenCV_Cascade *casc_p;

	s=NAMEOF("classifier cascade");
	cascade_name = NAMEOF("classifier specification file");

	casc_p = ocv_ccasc_of(QSP_ARG  s);
	if( casc_p != NO_CASCADE ){
		sprintf(ERROR_STRING,"Classifier cascade %s already exists!?",s);
		WARN(ERROR_STRING);
		return;
	}

	casc_p = new_ocv_ccasc(QSP_ARG  s);
	if( casc_p == NO_CASCADE ){
		sprintf(ERROR_STRING,"Error creating classifier cascade %s",s);
		WARN(ERROR_STRING);
		return;
	}

	casc_p->ocv_cascade = (CvHaarClassifierCascade*)cvLoad(cascade_name, 0,0,0);
	if(casc_p->ocv_cascade == NULL) {
		sprintf(ERROR_STRING,"Error loading cascade from file %s",cascade_name);
		WARN(ERROR_STRING);
		return;
		/* BUG release struct here */
	}
}
示例#2
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( do_tellprec )
{
	Data_Obj *dp;
	const char *s;

	dp = get_obj( QSP_ARG NAMEOF("data object") );
	s = NAMEOF("variable name");
	if( dp == NULL ) return;
	assign_var(s,OBJ_PREC_NAME(dp));
}
示例#3
0
文件: settings.c 项目: baloo79/uTox
static void parse_notifications_section(UTOX_SAVE *config, const char* key, const char* value) {
    if (MATCH(NAMEOF(config->audible_notifications_enabled), key)) {
        config->audible_notifications_enabled = STR_TO_BOOL(value);
    } else if (MATCH(NAMEOF(config->status_notifications), key)) {
        config->status_notifications = STR_TO_BOOL(value);
    } else if (MATCH(NAMEOF(config->no_typing_notifications), key)) {
        config->no_typing_notifications = STR_TO_BOOL(value);
    } else if (MATCH(NAMEOF(config->group_notifications), key)) {
        config->group_notifications = atoi(value);
    }
}
示例#4
0
文件: settings.c 项目: baloo79/uTox
static void parse_general_section(UTOX_SAVE *config, const char* key, const char* value) {
    if (MATCH(NAMEOF(config->save_version), key)) {
        config->save_version = atoi(value);
    } else if (MATCH(NAMEOF(config->utox_last_version), key)) {
        config->utox_last_version = atoi(value);
    } else if (MATCH(NAMEOF(config->send_version), key)) {
        config->send_version = STR_TO_BOOL(value);
    } else if (MATCH(NAMEOF(config->update_to_develop), key)) {
        config->update_to_develop = STR_TO_BOOL(value);
    }
}
示例#5
0
文件: seqmenu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_def_seq )
{
	const char *s;
	char nmbuf[LLEN];

	s = NAMEOF("sequence name");
	strcpy(nmbuf,s);
	s=NAMEOF("sequence (quote if includes spaces)");

	if( defseq(QSP_ARG  nmbuf,s) == NO_SEQ )
		WARN("couldn't create new sequence");
}
示例#6
0
文件: settings.c 项目: baloo79/uTox
static void parse_av_section(UTOX_SAVE *config, const char* key, const char* value) {
    if (MATCH(NAMEOF(config->push_to_talk), key)) {
        config->push_to_talk = STR_TO_BOOL(value);
    } else if (MATCH(NAMEOF(config->audio_filtering_enabled), key)) {
        config->audio_filtering_enabled = STR_TO_BOOL(value);
    } else if (MATCH(NAMEOF(config->audio_device_in), key)) {
        config->audio_device_in = atoi(value);
    } else if (MATCH(NAMEOF(config->audio_device_out), key)) {
        config->audio_device_out = atoi(value);
    } else if (MATCH(NAMEOF(config->video_fps), key)) {
        config->video_fps = atoi(value);
    }
}
示例#7
0
文件: glmenu.c 项目: nasa/QuIP
static COMMAND_FUNC( set_poly_mode )
{

#ifdef FOOBAR
	char *face = NAMEOF("face");
	char *mode = NAMEOF("polygon mode");
	if((strcmp(face,"frontNback"))&&(strcmp(face,"front"))&&(strcmp(face,"back"))){
		advise("Valid types of faces are:	'frontNback'	'front'	'back'");
		return;
	}

	if((strcmp(mode,"point"))&&(strcmp(mode,"line"))&&(strcmp(mode,"fill"))){
		advise("Valid types of modes are:	'point'	'line'	'fill'");
		return;
	}

	if( debug & gl_debug ) advise("glPolygonMode");
	/* could be more elegant ... */
	if (!((strcmp(face, "frontNback"))||(strcmp(mode, "point"))))
		glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
	if (!((strcmp(face, "frontNback"))||(strcmp(mode, "line"))))
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	if (!((strcmp(face, "frontNback"))||(strcmp(mode, "fill"))))
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	if((!strcmp(face, "front"))&&(!strcmp(mode, "point")))
		glPolygonMode(GL_FRONT, GL_POINT);
	if((!strcmp(face, "front"))&&(!strcmp(mode, "line")))
		glPolygonMode(GL_FRONT, GL_LINE);
	if((!strcmp(face, "front"))&&(!strcmp(mode, "fill")))
		glPolygonMode(GL_FRONT, GL_FILL);
	if((!strcmp(face, "back"))&&(!strcmp(mode, "point")))
		glPolygonMode(GL_BACK, GL_POINT);
	if((!strcmp(face, "back"))&&(!strcmp(mode, "line")))
		glPolygonMode(GL_BACK, GL_LINE);
	if((!strcmp(face, "back"))&&(!strcmp(mode, "fill")))
		glPolygonMode(GL_BACK, GL_FILL);
#endif /* FOOBAR */

	GLenum face_dir;
	GLenum polygon_mode;

	face_dir = CHOOSE_FACING_DIR("faces to render");
	polygon_mode = CHOOSE_POLYGON_MODE("rendering mode for polygons");

	if( face_dir == INVALID_CONSTANT || polygon_mode == INVALID_CONSTANT )
		return;

	if( debug & gl_debug ) advise("glPolygonMode");

	glPolygonMode(face_dir,polygon_mode);
}
示例#8
0
文件: opencv_menu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_load_img )
{
	const char *object_name;
	const char *filename;
	long is_color;
	OpenCV_Image *ocvi_p;

	object_name=NAMEOF("object name");
	filename=NAMEOF("image filename");
	is_color=HOW_MANY("is color? (boolean)");
	ocvi_p = load_ocv_image(QSP_ARG  object_name, filename);

	if( ocvi_p == NULL ) WARN("Error loading openCV image!?");
}
示例#9
0
文件: canmenu.c 项目: E-LLP/QuIP
static Viewer * mk_new_viewer(QSP_ARG_DECL int viewer_type)
{
	const char *s;
	char name[256];
	int dx,dy;
	Viewer *vp;

	s=NAMEOF("viewer name");
	strcpy(name,s);
	dx=(int)HOW_MANY("width");
	dy=(int)HOW_MANY("height");
	if( viewer_name_in_use(QSP_ARG name) ) return NO_VIEWER;
	if( dx <= 0 || dy <= 0 ){
		WARN("viewer sizes must be positive");
		return NO_VIEWER;
	}
	vp = viewer_init(QSP_ARG  name,dx,dy,viewer_type);

	if( vp == NO_VIEWER ) return NO_VIEWER;
#ifdef HAVE_X11
	default_cmap(QSP_ARG  VW_DPYABLE(vp) );
#endif /* HAVE_X11 */
#ifndef BUILD_FOR_IOS
	/* default state is to be shown,
	 * but in IOS we can only see one at a time, so
	 * we leave them on the bottom until we ask.
	 */
	show_viewer(QSP_ARG  vp);
#endif /* ! BUILD_FOR_IOS */
	select_viewer(QSP_ARG  vp);
	return vp;
}
示例#10
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( mkcast )
{
	const char *obj_name;
	Data_Obj *dp, *newdp;
	long rows, cols, tdim;
	long xos, yos;

	obj_name=NAMEOF("name for cast");

	dp=pick_obj(PARENT_PROMPT);
	if( dp==NULL ) return;

	cols=(long) how_many("number of columns");
	rows=(long) how_many("number of rows");
	xos=(long) how_many("x offset");
	yos=(long) how_many("y offset");
	tdim=(long) how_many("type dimension");

	INSIST_POSITIVE_DIM(cols,"column","mkcast")
	INSIST_POSITIVE_DIM(rows,"row","mkcast")
	INSIST_POSITIVE_DIM(tdim,"component","mkcast")

	INSIST_NONNEGATIVE(xos,"x offset","mkcast")
	INSIST_NONNEGATIVE(yos,"y offset","mkcast")

	newdp=nmk_subimg(dp,(index_t)xos,(index_t)yos,obj_name,(dimension_t)rows,(dimension_t)cols,(dimension_t)tdim);
	if( newdp == NULL )
		warn("couldn't create subimage");
}
示例#11
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( new_obj_list )
{
	int n;
	const char *s;
	List *lp;
	Node *np;

	s=NAMEOF("object name");

	n=how_many("number of objects in this list");
	lp=new_list();
	while(n--){
		Data_Obj *dp;

		dp = pick_obj("");
		if( dp != NULL ){
			np=mk_node(dp);
			addTail(lp,np);
		}
	}

	if( make_obj_list(s,lp) == NULL ){
		sprintf(ERROR_STRING,"error making object list %s");
		warn(ERROR_STRING);
	}
}
示例#12
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( new_frame )
{
	Dimension_Set ds1;
	Dimension_Set *dsp=(&ds1);
	const char *obj_name;
	long nr, nc, ncomps;
	Precision *prec_p;

	obj_name=NAMEOF("object name");

	nr = (long) how_many("number of rows");
	nc = (long) how_many("number of columns");
	ncomps = (long) how_many("number of components");

	prec_p = get_precision(SINGLE_QSP_ARG);

	if( prec_p == NULL ) return;
	INSIST_POSITIVE_DIM(nr,"row","new_frame");
	INSIST_POSITIVE_DIM(nc,"column","new_frame");
	INSIST_POSITIVE_DIM(ncomps,"component","new_frame");

	SET_DIMENSION(dsp,4,1);
	SET_DIMENSION(dsp,3,1);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,0,ncomps);

	finish_obj(obj_name,dsp,prec_p,DT_IMAGE);
}
示例#13
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( new_hyperseq )
{
	Dimension_Set ds1, *dsp=(&ds1);
	const char *obj_name;
	long ns, nf, nr, nc, ncomps;
	Precision *prec_p;

	obj_name=NAMEOF("object name");

	ns = (long) how_many("number of sequences");
	nf = (long) how_many("number of frames");
	nr = (long) how_many("number of rows");
	nc = (long) how_many("number of columns");
	ncomps = (long) how_many("number of components");
	prec_p = get_precision(SINGLE_QSP_ARG);

	if( prec_p == NULL ) return;

	INSIST_POSITIVE_DIM(ns,"sequence","new_hyperseq");

	SET_DIMENSION(dsp,4,ns);
	SET_DIMENSION(dsp,3,nf);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,0,ncomps);

	finish_obj(obj_name,dsp,prec_p,DT_HYPER_SEQ);
}
示例#14
0
文件: plotmenu.c 项目: RyanHun/QuIP
static COMMAND_FUNC( do_plot_string )
{
    const char *s;

    s=NAMEOF("string");
    xp_text(s);
}
示例#15
0
文件: pgr.c 项目: jbmulligan/quip
int pick_framerate(QSP_ARG_DECL  PGR_Cam *pgcp,const char *pmpt)
{
	int i;
	int j;
	dc1394framerates_t	framerates;
	const char **choices;
	const char *s;

	if( pgcp == NULL ) return -1;

	// format7 doesn't have a framerate!?
	if( mode_is_format7(pgcp) ){
		WARN("Can't specify framerate for format7 video mode...");
		// eat the argument
		s = NAMEOF("dummy argument");
		return -1;
	}

	if ( dc1394_video_get_supported_framerates( pgcp->pc_cam_p, pgcp->pc_video_mode, &framerates )
			!= DC1394_SUCCESS )
		return -1;

	choices = (const char **) getbuf( framerates.num * sizeof(char *) );
	j=0;
	for(i=0;i<framerates.num;i++){
		s=name_for_framerate(framerates.framerates[i]);
		if( s != NULL ){
			choices[j] = s;
			j++;
		}
	}
	i=WHICH_ONE(pmpt,j,choices);
	givbuf(choices);
	return(i);
}
示例#16
0
文件: ascmenu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_set_in_fmt )
{
	const char *s;

	s=NAMEOF("input line format string");
	set_input_format_string(QSP_ARG  s);
}
示例#17
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( new_col )
{
	Dimension_Set ds1, *dsp=(&ds1);
	const char *obj_name;
	long nr, ncomps;
	Precision *prec_p;

	obj_name=NAMEOF("object name");

	nr = (long) how_many("number of elements");
	ncomps = (long) how_many("number of components");

	prec_p = get_precision(SINGLE_QSP_ARG);

	if( prec_p == NULL ) return;
	INSIST_POSITIVE_DIM(nr,"element","new_col")
	INSIST_POSITIVE_DIM(ncomps,"component","new_col")

	SET_DIMENSION(dsp,4,1);
	SET_DIMENSION(dsp,3,1);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,1);
	SET_DIMENSION(dsp,0,ncomps);

	finish_obj(obj_name,dsp,prec_p,DT_COLVEC);
}
示例#18
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( mksubvector )
{
	const char *obj_name;
	Data_Obj *dp, *newdp;
	dimension_t rows;
	index_t yos;
	long cols;
	long xos;

	obj_name=NAMEOF("name for subvector");

	dp=pick_obj(PARENT_PROMPT);

	cols=(long) how_many("number of elements");
	rows=1;

	xos=(index_t)how_many("offset");
	yos=0;

	if( dp==NULL ) return;

	INSIST_POSITIVE_DIM(cols,"element","mksubvector")
	INSIST_NONNEGATIVE(xos,"x offset","mksubvector")

	newdp=mk_subimg(dp,(index_t)xos,yos,obj_name,rows,(dimension_t)cols);
	if( newdp == NULL )
		warn("couldn't create subvector");
}
示例#19
0
文件: ascmenu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_read_obj )
{
	Data_Obj *dp;
	FILE *fp;
	const char *s;

	dp=PICK_OBJ("");
	s=NAMEOF("input file");

	if( dp == NO_OBJ ) return;

#ifdef QUIP_DEBUG
//if( debug ) dptrace(dp);
#endif /* QUIP_DEBUG */

	// reading is tricker for non-ram, because
	// we must create the copy, then read into
	// the copy, then xfer to the device...

	INSIST_RAM_OBJ(dp,"do_read_obj")

	if( strcmp(s,"-") && strcmp(s,"stdin") ){
		fp=TRY_OPEN( s, "r" );
		if( !fp ) return;

		read_ascii_data(QSP_ARG  dp,fp,s,expect_exact_count);
	} else {
		/* read from stdin, no problem... */

		read_obj(QSP_ARG  dp);
	}
}
示例#20
0
文件: lookmenu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_xv_xform )
{
	const char *s;

	s=NAMEOF("dm expression string for x-value transformation");
	set_xval_xform(s);
}
示例#21
0
文件: fio_menu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_set_iofdir )
{
	const char *s;

	s=NAMEOF("directory for image/data files");
	set_iofile_directory(QSP_ARG  s);
}
示例#22
0
文件: fio_menu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_read_image_file )	/** open file for reading */
{
	char prompt[256];
	const char *s;
	Image_File *ifp;
	Filetype *ftp;

	ftp = current_filetype();
	sprintf(prompt,"input %s file",FT_NAME(ftp));
	s = NAMEOF(prompt);

	if( s == NULL || *s == 0 ){
		WARN("Null filename!?");
		return;
	}

	ifp = img_file_of(QSP_ARG  s);
	if( ifp != NO_IMAGE_FILE ){
		sprintf(ERROR_STRING,"do_read_image_file:  file %s is already open",ifp->if_name);
		WARN(ERROR_STRING);
		return;
	}

	if(  read_image_file(QSP_ARG  s) == NO_IMAGE_FILE )
		WARN("error reading image file");
}
示例#23
0
文件: opencv_menu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_convert_color )
{
	OpenCV_Image *src, *dst;
	const char * s;

	dst = PICK_OCVI("destination image");
	src = PICK_OCVI("source image");
	s = NAMEOF("OpenCV conversion code");

	if( dst == NO_OPENCV_IMAGE || src == NO_OPENCV_IMAGE ) return;

	int code;
	if (strcmp(s, "CV_RGB2GRAY") == 0) {
		code = CV_RGB2GRAY;
	} else if (strcmp(s, "CV_GRAY2RGB") == 0) {
		code = CV_GRAY2RGB;
	} else if (strcmp(s, "CV_BGR2GRAY") == 0) {
		code = CV_BGR2GRAY;
	} else if (strcmp(s, "CV_GRAY2BGR") == 0) {
		code = CV_GRAY2BGR;
	} else {
		code = -1;
		sprintf(ERROR_STRING,"Error (do_convert_color): No such OpenCV conversion code: %s\n",s);
		//WARN(ERROR_STRING);
		return;
	}
	cvCvtColor(src->ocv_image, dst->ocv_image, code);
}
示例#24
0
文件: param.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_prm_wt )
{
	FILE *fp;
	fp=TRYNICE(NAMEOF(pfstr),"w");
	if( fp== NULL ) return;
	wtprms(QSP_ARG  fp,theptbl);
}
示例#25
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( equivalence )
{
	const char *obj_name;
	Data_Obj *dp;
	Precision * prec_p;
	Dimension_Set ds1, *dsp=(&ds1);
	long ns,nf,nr,nc,nd;

	obj_name=NAMEOF("name for equivalent image");

	dp=pick_obj(PARENT_PROMPT);

	ns=(long) how_many("number of sequences");
	nf=(long) how_many("number of frames");
	nr=(long) how_many("number of rows");
	nc=(long) how_many("number of columns");
	nd=(long) how_many("number of components");

	prec_p = get_precision(SINGLE_QSP_ARG);

	if( dp==NULL ) return;
	if( prec_p == NULL ) return;

	INSIST_POSITIVE_DIM(ns,"sequence","equivalence")
	INSIST_POSITIVE_DIM(nf,"frame","equivalence")
	INSIST_POSITIVE_DIM(nr,"row","equivalence")
	INSIST_POSITIVE_DIM(nc,"column","equivalence")
	INSIST_POSITIVE_DIM(nd,"component","equivalence")

	SET_DIMENSION(dsp,4,ns);
	SET_DIMENSION(dsp,3,nf);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,0,nd);

	if( COMPLEX_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 complex component");
			return;
		}
		//SET_DIMENSION(dsp,0,2);
	} else if( QUAT_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 quaternion component");
			return;
		}
		//SET_DIMENSION(dsp,0,2);
	} else if( COLOR_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 color triple per pixel");
			return;
		}
advise("component dim 3 for color");
		//SET_DIMENSION(dsp,0,3);
	}

	if( make_equivalence(obj_name,dp,dsp,prec_p) == NULL )
		warn("error making equivalence");
}
示例#26
0
文件: lutmenu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_newlut )
{
	const char *name;

	name = NAMEOF("Name of new colormap");
	if( new_colormap(QSP_ARG  name) == NO_OBJ )
		WARN("error making new colormap");
}
示例#27
0
文件: plotmenu.c 项目: RyanHun/QuIP
static COMMAND_FUNC( do_rdplot )
{
    FILE *fp;

    fp=TRY_OPEN( NAMEOF("filename"), "r") ;
    if( !fp ) return;
    rdplot(QSP_ARG  fp);
}
示例#28
0
文件: oostruct.c 项目: barak/lush
static const char *generic_name(at *p)
{
   if (Class(p)->classname)
      sprintf(string_buffer, "::%s:%p", NAMEOF(Class(p)->classname),Mptr(p));
   else
      sprintf(string_buffer, "::%p:%p", Class(p), Mptr(p));
   
   return mm_strdup(string_buffer);
}
示例#29
0
文件: serial.c 项目: jbmulligan/quip
static COMMAND_FUNC( do_open )
{
	const char *s;

	s=NAMEOF("device file");

	if( open_serial_device(s) < 0 )
		warn("Error opening serial device");
}
示例#30
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( do_ilace )
{
	const char *obj_name;
	Data_Obj *dp, *newdp;
	int parity;

	obj_name=NAMEOF("name for subimage");

	dp=get_img( QSP_ARG  NAMEOF("name of parent image") );
	if( dp==NULL ) return;

	parity=WHICH_ONE("parity of selected lines",2,parlist);
	if( parity < 0 ) return;

	newdp=mk_ilace(dp,obj_name,parity);
	if( newdp == NULL )
		warn("couldn't create interlaced subimage");
}