コード例 #1
0
ファイル: cv.jit.LKflow.c プロジェクト: smokhov/cv.jit-source
t_jit_err cv_jit_LKflow_init(void) 
{
	long 			attrflags=0;
	t_jit_object 	*attr,*mop;
	
	_cv_jit_LKflow_class = jit_class_new("cv_jit_LKflow",(method)cv_jit_LKflow_new,(method)cv_jit_LKflow_free,sizeof(t_cv_jit_LKflow),A_CANT,0L); //A_CANT = untyped

	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,1);
	jit_mop_single_type(mop,_jit_sym_float32);	
	jit_mop_single_planecount(mop,2);	
	jit_class_addadornment(_cv_jit_LKflow_class,mop);
	
	//add methods
	jit_class_addmethod(_cv_jit_LKflow_class, (method)cv_jit_LKflow_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);
	
	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"radius",_jit_sym_long,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_LKflow,radius));
	jit_attr_addfilterset_clip(attr,1,7,TRUE,TRUE);	//clip to 1-7
	jit_class_addattr(_cv_jit_LKflow_class,attr);
	
	jit_class_register(_cv_jit_LKflow_class);

	return JIT_ERR_NONE;
}
コード例 #2
0
t_jit_err jit_fluoride_init(void)
{
	long attrflags=0;
	t_jit_object *attr, *mop;

	_jit_fluoride_class = jit_class_new("jit_fluoride",(method)jit_fluoride_new,(method)jit_fluoride_free,
										sizeof(t_jit_fluoride),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1); //#inputs,#outputs
	jit_mop_single_type(mop,_jit_sym_char);
	jit_mop_single_planecount(mop,4);
	jit_class_addadornment(_jit_fluoride_class,mop);

	//add methods
	jit_class_addmethod(_jit_fluoride_class, (method)jit_fluoride_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);

	//add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;

	CLASS_STICKY_CATEGORY(_jit_fluoride_class,0,"Behavior");
	CLASS_STICKY_ATTR(_jit_fluoride_class,"basic",0,"1");

	// glow -- sets color for neon effect
	attr = jit_object_new(_jit_sym_jit_attr_offset_array, "glow", _jit_sym_float64, 3,
						  attrflags, (method)0L, (method)0L, calcoffset(t_jit_fluoride, glowcount),
						  calcoffset(t_jit_fluoride,glow));
	jit_class_addattr(_jit_fluoride_class,attr);
	CLASS_ATTR_STYLE_LABEL(_jit_fluoride_class,"glow",0,"rgb","Glow Color");

	// lum -- moves center luminosity
	attr = jit_object_new(_jit_sym_jit_attr_offset,"lum",_jit_sym_float64,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_fluoride,lum));
	jit_class_addattr(_jit_fluoride_class,attr);
	CLASS_ATTR_LABEL(_jit_fluoride_class,"lum",0,"Luminosity");

	// tol -- width of neon tolerance
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tol",_jit_sym_float64,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_fluoride,tol));
	jit_class_addattr(_jit_fluoride_class,attr);
	CLASS_ATTR_LABEL(_jit_fluoride_class,"tol",0,"Tolerance");

	// mode -- b/w (0) or color (1)
	attr = jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_fluoride,mode));
	jit_class_addattr(_jit_fluoride_class,attr);
	CLASS_ATTR_LABEL(_jit_fluoride_class,"mode",0,"Color Mode");
	CLASS_ATTR_ENUMINDEX(_jit_fluoride_class, "mode", 0, "\"Black and White\" Color");

	CLASS_STICKY_CATEGORY_CLEAR(_jit_fluoride_class);
	CLASS_STICKY_ATTR_CLEAR(_jit_fluoride_class, "basic");

	jit_class_register(_jit_fluoride_class);

	return JIT_ERR_NONE;
}
コード例 #3
0
ファイル: cv.jit.lines.c プロジェクト: fourks/cv.jit
t_jit_err cv_jit_lines_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop,*output;
	
	_cv_jit_lines_class = jit_class_new("cv_jit_lines",(method)cv_jit_lines_new,(method)cv_jit_lines_free,
		sizeof(t_cv_jit_lines),0L);

	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,1);  //Object has one input and one output

   	jit_mop_single_type(mop,_jit_sym_char);   //Set input type and planecount
   	jit_mop_single_planecount(mop,1);  
   	jit_mop_output_nolink(mop,1); //Turn off output linking so that output matrix does not adapt to input
   	
   	output = (t_jit_object *)jit_object_method(mop,_jit_sym_getoutput,1); //Get a pointer to the output matrix
   	jit_attr_setlong(output,_jit_sym_minplanecount,4);  //Set output plane count
  	jit_attr_setlong(output,_jit_sym_maxplanecount,4); //4 -> Coordinates of start and end points for each line
  	jit_attr_setlong(output,_jit_sym_mindim,1);  //Only one dimension
  	jit_attr_setlong(output,_jit_sym_maxdim,1);
  	jit_attr_setsym(output,_jit_sym_types,_jit_sym_long);
  	
  	jit_class_addadornment(_cv_jit_lines_class,mop);
  	
	//add methods
	jit_class_addmethod(_cv_jit_lines_class, (method)cv_jit_lines_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);
	
	//add attributes	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"threshold",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,threshold));
	jit_attr_addfilterset_clip(attr,1,255,TRUE,TRUE);	//clip to 1-255
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"resolution",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,resolution));
	jit_attr_addfilterset_clip(attr,1,10,TRUE,TRUE);	//clip to 1-10
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"gap",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,gap));
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"length",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,length));
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"sensitivity",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,sensitivity));
	jit_attr_addfilterset_clip(attr,1,255,TRUE,TRUE);	//clip to 1-255
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	jit_class_register(_cv_jit_lines_class);

	return JIT_ERR_NONE;
}
コード例 #4
0
ファイル: xray.jit.fdm.c プロジェクト: ramagottfried/xray.jit
t_jit_err xray_jit_fdm_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop,*o;
	t_symbol *atsym;
	t_atom a[1];
	
	atsym = gensym("jit_attr_offset");
	
	_xray_jit_fdm_class = jit_class_new("xray_jit_fdm",(method)xray_jit_fdm_new,(method)xray_jit_fdm_free,
		sizeof(t_xray_jit_fdm),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1);
	jit_mop_single_planecount(mop,1);	
	jit_atom_setsym(a,_jit_sym_float32);
	
	o = jit_object_method(mop,_jit_sym_getoutput,1);
	jit_object_method(o,_jit_sym_types,1,a);
	
	jit_class_addadornment(_xray_jit_fdm_class,mop);
	
	//add methods
	jit_class_addmethod(_xray_jit_fdm_class, (method)xray_jit_fdm_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);
	
	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	
	//spacestep
	attr = jit_object_new(atsym,"spacestep",_jit_sym_float32,attrflags,
		(method)0L,(method)0L,calcoffset(t_xray_jit_fdm,spacestep));
	jit_class_addattr(_xray_jit_fdm_class,attr);
	
	//direction
	attr = jit_object_new(_jit_sym_jit_attr_offset,"direction",_jit_sym_symbol,attrflags,
		(method)0L,(method)0L,calcoffset(t_xray_jit_fdm, direction));	
	jit_class_addattr(_xray_jit_fdm_class,attr);
	
	//generate symbols
	ps_x 	= gensym("x");
	ps_y 	= gensym("y");
	ps_xx	= gensym("xx");
	ps_xy 	= gensym("xy");
	ps_yx 	= gensym("yx");
	ps_yy 	= gensym("yy");

	jit_class_register(_xray_jit_fdm_class);
	
	return JIT_ERR_NONE;
}
コード例 #5
0
ファイル: jit.gradient.c プロジェクト: CICM/max6-sdk
t_jit_err jit_gradient_init(void) 
{
	long attrflags=0;
	t_jit_object *attr;
	t_jit_object *mop;
	
	_jit_gradient_class = jit_class_new("jit_gradient",(method)jit_gradient_new,(method)jit_gradient_free,
		sizeof(t_jit_gradient),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1);
	jit_mop_single_type(mop, _jit_sym_char);
	jit_mop_single_planecount(mop, 4);
	jit_class_addadornment(_jit_gradient_class,mop);
	//add methods
	jit_class_addmethod(_jit_gradient_class, (method)jit_gradient_matrix_calc, "matrix_calc", A_CANT, 0L);

	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;

	CLASS_STICKY_CATEGORY(_jit_gradient_class,0,"Behavior");
	CLASS_STICKY_ATTR(_jit_gradient_class,"basic",0,"1");

	// start - beginning gradient cell
	attr = jit_object_new(_jit_sym_jit_attr_offset_array, "start", _jit_sym_float64, 4, 
		attrflags, (method)0L, (method)0L, calcoffset(t_jit_gradient, startcount),
		calcoffset(t_jit_gradient,start));
	jit_class_addattr(_jit_gradient_class,attr);
	CLASS_ATTR_LABEL(_jit_gradient_class,"start",0,"Start");	
	
	attr = jit_object_new(_jit_sym_jit_attr_offset_array, "end", _jit_sym_float64, 4, 
		attrflags, (method)0L, (method)0L, calcoffset(t_jit_gradient, endcount),
		calcoffset(t_jit_gradient,end));
	jit_class_addattr(_jit_gradient_class,attr);
	CLASS_ATTR_LABEL(_jit_gradient_class,"end",0,"End");	

	attr = jit_object_new(_jit_sym_jit_attr_offset_array, "cheby", _jit_sym_float64, 64, 
		attrflags, (method)0L, (method)0L, calcoffset(t_jit_gradient, chebycount),
		calcoffset(t_jit_gradient,cheby));
	jit_class_addattr(_jit_gradient_class,attr);
	CLASS_ATTR_LABEL(_jit_gradient_class,"cheby",0,"Chebyshev Coefficients");	

	CLASS_STICKY_CATEGORY_CLEAR(_jit_gradient_class);
	CLASS_STICKY_ATTR_CLEAR(_jit_gradient_class, "basic");

	jit_class_register(_jit_gradient_class);

	return JIT_ERR_NONE;
}
コード例 #6
0
ファイル: cv.jit.blob.direction.c プロジェクト: fourks/cv.jit
t_jit_err cv_jit_blobs_direction_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop,*output;
	t_symbol *atsym;
	
	atsym = gensym("jit_attr_offset");
	
	_cv_jit_blobs_direction_class = jit_class_new("cv_jit_blobs_direction",(method)cv_jit_blobs_direction_new,(method)cv_jit_blobs_direction_free,
		sizeof(t_cv_jit_blobs_direction),0L); 

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1);  //Object has one input and one output

   	jit_mop_single_type(mop,_jit_sym_float32);   //Set input type and planecount
   	jit_mop_single_planecount(mop,17);  
   	jit_mop_output_nolink(mop,1); //Turn off output linking so that output matrix does not adapt to input
   	
   	output = jit_object_method(mop,_jit_sym_getoutput,1); //Get a pointer to the output matrix
   	jit_attr_setlong(output,_jit_sym_minplanecount,1);
  	jit_attr_setlong(output,_jit_sym_maxplanecount,1);
  	jit_attr_setlong(output,_jit_sym_mindim,1);
  	jit_attr_setlong(output,_jit_sym_maxdim,1);
  	jit_attr_setsym(output,_jit_sym_types,_jit_sym_float32);
   	   	
	jit_class_addadornment(_cv_jit_blobs_direction_class,mop);
	
	
	//add methods
	jit_class_addmethod(_cv_jit_blobs_direction_class, (method)cv_jit_blobs_direction_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);	

	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_blobs_direction,mode));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_cv_jit_blobs_direction_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"flip",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_blobs_direction,flip));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_cv_jit_blobs_direction_class,attr);
		
	jit_class_register(_cv_jit_blobs_direction_class);

	return JIT_ERR_NONE;
}
コード例 #7
0
t_jit_err jit_rgb2luma_init(void)
{
	long attrflags=0;
	t_jit_object *attr, *mop, *o;

	_jit_rgb2luma_class = jit_class_new("jit_rgb2luma",(method)jit_rgb2luma_new,(method)jit_rgb2luma_free,
										sizeof(t_jit_rgb2luma),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1); //#inputs,#outputs
	jit_mop_single_planecount(mop, 1);
	jit_mop_single_type(mop, _jit_sym_char);
	o=jit_object_method(mop,_jit_sym_getoutput,1);
	jit_attr_setlong(o,_jit_sym_planelink,0);
	jit_class_addadornment(_jit_rgb2luma_class,mop);

	//add methods
	jit_class_addmethod(_jit_rgb2luma_class, (method)jit_rgb2luma_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);

	//add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = jit_object_new(_jit_sym_jit_attr_offset,"ascale",_jit_sym_float64,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_rgb2luma,ascale));
	jit_class_addattr(_jit_rgb2luma_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Alpha Scale\"");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"rscale",_jit_sym_float64,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_rgb2luma,rscale));
	jit_class_addattr(_jit_rgb2luma_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Red Scale\"");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"gscale",_jit_sym_float64,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_rgb2luma,gscale));
	jit_class_addattr(_jit_rgb2luma_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Green Scale\"");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"bscale",_jit_sym_float64,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_rgb2luma,bscale));
	jit_class_addattr(_jit_rgb2luma_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Blue Scale\"");

	jit_class_register(_jit_rgb2luma_class);

	return JIT_ERR_NONE;
}
コード例 #8
0
ファイル: jit.fluoride.c プロジェクト: Cycling74/max5-sdk
t_jit_err jit_fluoride_init(void) 
{
	long attrflags=0;
	t_jit_object *attr, *mop;
	
	_jit_fluoride_class = jit_class_new("jit_fluoride",(method)jit_fluoride_new,(method)jit_fluoride_free,
		sizeof(t_jit_fluoride),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1); //#inputs,#outputs
	jit_mop_single_type(mop,_jit_sym_char);	
	jit_mop_single_planecount(mop,4);	
	jit_class_addadornment(_jit_fluoride_class,mop);

	//add methods
	jit_class_addmethod(_jit_fluoride_class, (method)jit_fluoride_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);

	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;

	// glow -- sets color for neon effect
	attr = jit_object_new(_jit_sym_jit_attr_offset_array, "glow", _jit_sym_float64, 3, 
		attrflags, (method)0L, (method)0L, calcoffset(t_jit_fluoride, glowcount),
		calcoffset(t_jit_fluoride,glow));
	jit_class_addattr(_jit_fluoride_class,attr);

	// lum -- moves center luminosity
	attr = jit_object_new(_jit_sym_jit_attr_offset,"lum",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_fluoride,lum));
	jit_class_addattr(_jit_fluoride_class,attr);

	// tol -- width of neon tolerance
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tol",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_fluoride,tol));
	jit_class_addattr(_jit_fluoride_class,attr);

	// mode -- b/w (0) or color (1)
	attr = jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_fluoride,mode));
	jit_class_addattr(_jit_fluoride_class,attr);

	jit_class_register(_jit_fluoride_class);

	return JIT_ERR_NONE;
}
コード例 #9
0
t_jit_err cv_jit_blobs_centroids_init(void) 
{
	t_jit_object *mop,*output;
	t_symbol *atsym;
	
	atsym = gensym("jit_attr_offset");
	
	_cv_jit_blobs_centroids_class = jit_class_new("cv_jit_blobs_centroids",(method)cv_jit_blobs_centroids_new,(method)cv_jit_blobs_centroids_free,
		sizeof(t_cv_jit_blobs_centroids),0L); 

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1);  //Object has one input and one output
	output = jit_object_method(mop,_jit_sym_getoutput,1); //Get a pointer to the output matrix

   	jit_mop_single_type(mop,_jit_sym_char);   //Set input type and planecount
   	jit_mop_single_planecount(mop,1);  
   	
   	jit_mop_output_nolink(mop,1); //Turn off output linking so that output matrix does not adapt to input
   	
   	jit_attr_setlong(output,_jit_sym_minplanecount,3); //Output has 3 planes: centroid coordinates + mass
  	jit_attr_setlong(output,_jit_sym_maxplanecount,3);
  	jit_attr_setlong(output,_jit_sym_mindim,1);
  	jit_attr_setlong(output,_jit_sym_maxdim,1);
  	jit_attr_setsym(output,_jit_sym_types,_jit_sym_float32);
   	   	
	jit_class_addadornment(_cv_jit_blobs_centroids_class,mop);
	
	
	//add methods
	jit_class_addmethod(_cv_jit_blobs_centroids_class, (method)cv_jit_blobs_centroids_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);	

	//add attributes	
	
	/*No attributes for this object*/
		
	jit_class_register(_cv_jit_blobs_centroids_class);

	return JIT_ERR_NONE;
}
コード例 #10
0
t_jit_err xray_jit_colormap_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop,*o;
	t_symbol *atsym;
	t_atom a[2];
	
	atsym = gensym("jit_attr_offset");
	
	_xray_jit_colormap_class = jit_class_new("xray_jit_colormap",(method)xray_jit_colormap_new,(method)xray_jit_colormap_free,
		sizeof(t_xray_jit_colormap),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1);
	jit_mop_single_planecount(mop,1);	
	jit_atom_setsym(a,_jit_sym_char);
	jit_atom_setsym(a+1,_jit_sym_long);
	
	o = jit_object_method(mop,_jit_sym_getoutput,1);
	jit_object_method(o,_jit_sym_types,2,a);
	
	jit_class_addadornment(_xray_jit_colormap_class,mop);
	
	//add methods
	jit_class_addmethod(_xray_jit_colormap_class, (method)xray_jit_colormap_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);
	
	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	
	//mode
	attr = jit_object_new(atsym,"mode",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_xray_jit_colormap,mode));
	jit_class_addattr(_xray_jit_colormap_class,attr);
	
	jit_class_register(_xray_jit_colormap_class);

	return JIT_ERR_NONE;
}
コード例 #11
0
ファイル: cv.jit.shift.c プロジェクト: fourks/cv.jit
t_jit_err cv_jit_shift_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop;
	t_symbol *atsym;
	
	atsym = gensym("jit_attr_offset");
	
	_cv_jit_shift_class = jit_class_new("cv_jit_shift",(method)cv_jit_shift_new,(method)cv_jit_shift_free,
		sizeof(t_cv_jit_shift),0L); 

	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,0);  //Object has one input and no Jitter output
	jit_mop_single_type(mop,_jit_sym_char);   //Set input type and planecount
   	jit_mop_single_planecount(mop,1);  
	jit_class_addadornment(_cv_jit_shift_class,mop);
	
	//add methods
	jit_class_addmethod(_cv_jit_shift_class, (method)cv_jit_shift_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);

	//add attributes	
	attrflags = JIT_ATTR_SET_OPAQUE_USER | JIT_ATTR_GET_OPAQUE_USER;
	//box: the resulting bounding rectangle, passed to the Max wrapper
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array,"box",_jit_sym_atom,4,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,boxcount),calcoffset(t_cv_jit_shift,box));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//vertices: the rotated frame that bounds the object
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array,"vertices",_jit_sym_atom,4,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,framecount),calcoffset(t_cv_jit_shift,frame));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//Mass: the area's mass
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"mass",_jit_sym_float32,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,mass));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	//rect: the start bounding rectangle
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array,"rect",_jit_sym_long,4,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,rectcount),calcoffset(t_cv_jit_shift,rect));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//Maximum number of iterations
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"maxiters",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,maxiters));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//The minimum displacement
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"distance",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,epsilon));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//The mode, 0: meanshift -- 1: camshift
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,mode));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);
	jit_class_addattr(_cv_jit_shift_class,attr);
			
	jit_class_register(_cv_jit_shift_class);

	return JIT_ERR_NONE;
}
コード例 #12
0
t_jit_err jit_keyscreen_init(void)
{
	long attrflags=0;
	t_jit_object *attr, *mop;

	_jit_keyscreen_class = jit_class_new("jit_keyscreen",(method)jit_keyscreen_new,(method)jit_keyscreen_free,
										 sizeof(t_jit_keyscreen),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,3,1);
	jit_mop_single_type(mop,_jit_sym_char);
	jit_mop_single_planecount(mop,4);
	jit_class_addadornment(_jit_keyscreen_class,mop);

	//add methods
	jit_class_addmethod(_jit_keyscreen_class, (method)jit_keyscreen_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);


	//add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;

	CLASS_STICKY_CATEGORY(_jit_keyscreen_class,0,"Behavior");
	CLASS_STICKY_ATTR(_jit_keyscreen_class,"basic",0,"1");

	// mode -- switches keying states
	attr = jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,mode));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"mode",0,"Keying Mode");
	CLASS_ATTR_ENUMINDEX3(_jit_keyscreen_class, "mode", 0, "Wrap", "Clip", "Fold");

	// key,target,mask -- switches who gets keyed with whom by whom
	attr = jit_object_new(_jit_sym_jit_attr_offset,"key",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,key));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"key",0,"Key Input");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"target",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,target));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"target",0,"Target Input");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"mask",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,mask));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"mask",0,"Mask Input");

	// red, green, blue, tols -- changes colors and tolerances of the key
	attr = jit_object_new(_jit_sym_jit_attr_offset,"alpha",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,alpha));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"alpha",0,"Alpha");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"red",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,red));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"red",0,"Red");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"green",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,green));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"green",0,"Green");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"blue",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,blue));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"blue",0,"Blue");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"alphatol",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,alphatol));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"alphatol",0,"Alpha Tolerance");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"redtol",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,redtol));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"redtol",0,"Red Tolerance");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"greentol",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,greentol));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"greentol",0,"Green Tolerance");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"bluetol",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,bluetol));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"bluetol",0,"Blue Tolerance");

	CLASS_STICKY_CATEGORY_CLEAR(_jit_keyscreen_class);
	CLASS_STICKY_ATTR_CLEAR(_jit_keyscreen_class, "basic");

	jit_class_register(_jit_keyscreen_class);

	return JIT_ERR_NONE;
}
コード例 #13
0
ファイル: cv.jit.opticalflow.cpp プロジェクト: fourks/cv.jit
t_jit_err cv_jit_opticalflow_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop;
	//t_symbol *atsym;
	
	//atsym = gensym("jit_attr_offset");
	
	_cv_jit_opticalflow_class = jit_class_new("cv_jit_opticalflow",(method)cv_jit_opticalflow_new,(method)cv_jit_opticalflow_free, sizeof(t_cv_jit_opticalflow),0L);
   	
	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,2);
	jit_mop_single_type(mop,_jit_sym_float32);	
	jit_mop_single_planecount(mop,2);
   	   	
	jit_class_addadornment(_cv_jit_opticalflow_class,mop);
	
	//add methods
	jit_class_addmethod(_cv_jit_opticalflow_class, (method)cv_jit_opticalflow_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);

	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"method",_jit_sym_atom,attrflags,(method)cv_jit_opticalflow_get_method,(method)cv_jit_opticalflow_set_method,calcoffset(t_cv_jit_opticalflow,method));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"use_previous",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_use_previous,calcoffset(t_cv_jit_opticalflow,use_previous));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"bm_max_range",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_bm_max_range,calcoffset(t_cv_jit_opticalflow,bm_max_range));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"bm_block_size",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_bm_block_size,calcoffset(t_cv_jit_opticalflow,bm_block_size));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"bm_shift_size",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_bm_shift_size,calcoffset(t_cv_jit_opticalflow,bm_shift_size));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"lk_window_size",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_lk_window_size,calcoffset(t_cv_jit_opticalflow,lk_window_size));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"hs_lambda",_jit_sym_float64,attrflags,(method)0L,(method)cv_jit_opticalflow_set_hs_lambda,calcoffset(t_cv_jit_opticalflow,hs_lambda));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"fb_window_size",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_fb_window_size,calcoffset(t_cv_jit_opticalflow,fb_window_size));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_OPAQUE; //Those parameters are better left to their default values
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"fb_poly_n",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_fb_poly_n,calcoffset(t_cv_jit_opticalflow,fb_poly_n));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"fb_iterations",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_fb_iterations,calcoffset(t_cv_jit_opticalflow,fb_iterations));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"fb_poly_sigma",_jit_sym_float64,attrflags,(method)0L,(method)cv_jit_opticalflow_set_fb_poly_sigma,calcoffset(t_cv_jit_opticalflow,fb_poly_sigma));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"fb_pyramid_scale",_jit_sym_float64,attrflags,(method)0L,(method)cv_jit_opticalflow_set_fb_pyramid_scale,calcoffset(t_cv_jit_opticalflow,fb_pyramid_scale));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"fb_levels",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_fb_levels,calcoffset(t_cv_jit_opticalflow,fb_levels));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"hs_epsilon",_jit_sym_float64,attrflags,(method)0L,(method)cv_jit_opticalflow_set_hs_epsilon,calcoffset(t_cv_jit_opticalflow,hs_epsilon));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"hs_max_iterations",_jit_sym_long,attrflags,(method)0L,(method)cv_jit_opticalflow_set_hs_max_iterations,calcoffset(t_cv_jit_opticalflow,hs_max_iterations));
	jit_class_addattr(_cv_jit_opticalflow_class,attr);
			
	jit_class_register(_cv_jit_opticalflow_class);

	return JIT_ERR_NONE;
}
コード例 #14
0
ファイル: cv.jit.features.c プロジェクト: fourks/cv.jit
t_jit_err cv_jit_features_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop,*output;
	t_symbol *atsym;
	
	atsym = gensym("jit_attr_offset");
	
	_cv_jit_features_class = jit_class_new("cv_jit_features",(method)cv_jit_features_new,(method)cv_jit_features_free,
		sizeof(t_cv_jit_features),A_CANT,0L); //A_CANT = untyped

	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,1);  //Object has one input and one output
	output = (t_jit_object *)jit_object_method(mop,_jit_sym_getoutput,1); //Get a pointer to the output matrix

   	jit_mop_single_type(mop,_jit_sym_char);   //Set input type and planecount
   	jit_mop_single_planecount(mop,1);  
   	
   	jit_mop_output_nolink(mop,1); //Turn off output linking so that output matrix does not adapt to input
   	
   	jit_attr_setlong(output,_jit_sym_minplanecount,2);  //Two planes, holding the feature's coordinates 
  	jit_attr_setlong(output,_jit_sym_maxplanecount,2);
  	jit_attr_setlong(output,_jit_sym_mindim,1); //Only one dimension
  	jit_attr_setlong(output,_jit_sym_maxdim,1);
  	jit_attr_setsym(output,_jit_sym_types,_jit_sym_float32); //Coordinates are returned with sub-pixel accuracy
   	   	
	jit_class_addadornment(_cv_jit_features_class,mop);
	
	
	//add methods
	jit_class_addmethod(_cv_jit_features_class, (method)cv_jit_features_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);	

	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	
	//threshold
	attr = (t_jit_object *)jit_object_new(	_jit_sym_jit_attr_offset,"threshold",_jit_sym_float64,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_features,threshold));			
	jit_attr_addfilterset_clip(attr,0.001,1,TRUE,TRUE);	//clip to 0.001-1
	jit_class_addattr(_cv_jit_features_class, attr);
	
	//minimum distance
	attr = (t_jit_object *)jit_object_new(	_jit_sym_jit_attr_offset,"distance",_jit_sym_float64,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_features,distance));			
	jit_attr_addfilterset_clip(attr,0,0,TRUE,FALSE);	//clip to 0
	jit_class_addattr(_cv_jit_features_class, attr);
	
	//roi
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array, "roi", _jit_sym_long, 4, attrflags, (method)0L, (method)0L, calcoffset(t_cv_jit_features, roicount),calcoffset(t_cv_jit_features,roi));
	jit_class_addattr(_cv_jit_features_class, attr);
	
	attr = (t_jit_object *)jit_object_new(	_jit_sym_jit_attr_offset,"useroi",_jit_sym_char,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_features,useroi));			
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_cv_jit_features_class, attr);
	
	//Precision
	attr = (t_jit_object *)jit_object_new(	_jit_sym_jit_attr_offset,"precision",_jit_sym_char,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_features,precision));			
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_cv_jit_features_class, attr);
			
	jit_class_register(_cv_jit_features_class);

	return JIT_ERR_NONE;
}