Example #1
0
t_cv_jit_opticalflow *cv_jit_opticalflow_new(void)
{
	t_cv_jit_opticalflow *x;

	if (x=(t_cv_jit_opticalflow *)jit_object_alloc(_cv_jit_opticalflow_class)) 
	{
		x->of = new OpticalFlow;
		
		//attribute initialization
		x->fb_poly_n = x->of->getFBpoly_n();
		x->fb_iterations = x->of->getFBiterations();
		x->fb_window_size = x->of->getFBwindowSize();
		x->fb_levels = x->of->getFBlevels();
		x->use_previous = x->of->getUsePrevious();
		x->bm_max_range = x->of->getBMmaxRange().width;
		x->bm_block_size = x->of->getBMblockSize().width;
		x->bm_shift_size = x->of->getBMshiftSize().width;
		x->lk_window_size = x->of->getLKwindowSize().width;
		x->hs_max_iterations = x->of->getHSmaxIterations();
		x->fb_poly_sigma = x->of->getFBpoly_sigma();
		x->fb_pyramid_scale = x->of->getFBpyramidScale();
		x->hs_epsilon = x->of->getHSepsilon();
		x->hs_lambda = x->of->getHSlambda();

	} else {
		x = NULL;
	}	
	return x;
}
t_jit_openlase_trace *jit_openlase_trace_new(void)
{
	t_jit_openlase_trace *x;
		
	if (x=(t_jit_openlase_trace *)jit_object_alloc(_jit_openlase_trace_class)) {
		x->planecount = 0;
				
		x->params.rate = 12000;
		x->params.on_speed = 2.0/100.0;
		x->params.off_speed = 2.0/20.0;
		x->params.snap = 1/120.0;
		x->params.render_flags = RENDER_GRAYSCALE;
		x->params.min_length = 20;
		x->params.start_wait = 15;
		x->params.end_wait = 3;
		x->params.start_dwell = 10;
		x->params.end_dwell = 10;
		x->params.corner_dwell = 12;
		x->overscan = 0.0;
		x->aspect = 0.0;
		x->decimate = 1;
		x->snap_pix = 3;
		
		systhread_mutex_new(&x->mutex,0);
	} else {
		x = NULL;
	}
	return x;
}
t_xray_jit_cellcoords *xray_jit_cellcoords_new(void)
{
	t_xray_jit_cellcoords *x;
	t_jit_matrix_info info;
	void *m;

	if (x=(t_xray_jit_cellcoords *)jit_object_alloc(_xray_jit_cellcoords_class)) {
		x->plane = 0;
		x->out_mode = 0;

		//initialize internal matrix
		jit_matrix_info_default(&info);
		info.type = _jit_sym_char;
		info.planecount = 2;
		x->temp_name = jit_symbol_unique();
		m = jit_object_new(_jit_sym_jit_matrix, &info);
		m = jit_object_method(m, _jit_sym_register, x->temp_name);

		//Register matrix name
		if(!m) error("could not allocate internal matrix!");
		jit_object_attach(x->temp_name, x);
		x->temp = m;
	} else {
		x = NULL;
	}
	return x;
}
Example #4
0
t_cv_jit_shift *cv_jit_shift_new(void)
{
	t_cv_jit_shift *x;

	if (x=(t_cv_jit_shift *)jit_object_alloc(_cv_jit_shift_class)) 
	{
		x->epsilon = 2;
		x->maxiters = 10;
		x->rect[0] = x->rect[1] = x->rect[2] = x->rect[3] = 0;
		x->boxcount = 4;
		x->rectcount = 4;
		x->mode = 0;
		jit_atom_setlong(&x->box[0],0);
		jit_atom_setlong(&x->box[1],0);
		jit_atom_setlong(&x->box[2],0);
		jit_atom_setlong(&x->box[3],0);
		x->framecount = 8;
		jit_atom_setlong(&x->frame[0],0);
		jit_atom_setlong(&x->frame[1],0);
		jit_atom_setlong(&x->frame[2],0);
		jit_atom_setlong(&x->frame[3],0);
		jit_atom_setlong(&x->frame[4],0);
		jit_atom_setlong(&x->frame[5],0);
		jit_atom_setlong(&x->frame[6],0);
		jit_atom_setlong(&x->frame[7],0);
		x->mass = 0;
		
	} else {
		x = NULL;
	}	
	return x;
}
Example #5
0
t_jit_print *jit_print_new(void)
{
	t_jit_print *x;
	char tmpstr[2] = "";
	char *tmpptr = tmpstr;

	if (x=(t_jit_print *)jit_object_alloc(_jit_print_class)) {
		x->write_cherry = true;
		tmpstr[0] = PLANE_DELIM;
		x->planedelim = gensym(tmpptr);
		tmpstr[0] = ROW_DELIM;
		x->rowdelim = gensym(tmpptr);
		tmpstr[0] = COL_DELIM;
		x->coldelim = gensym(tmpptr);
		tmpstr[0] = DIM_DELIM;
		x->dimdelim = gensym(tmpptr);

		x->precision = 3;
		x->fieldwidth = 3;
		x->mode = 0;
		x->zeropad = 0;

		x->info = 0;
		x->title = ps_null;

	} else {
		x = NULL;
	}
	return x;
}
Example #6
0
t_jit_tml_gl_videoplane *jit_gl_videoplane_new(t_symbol * dest_name)
{
	t_jit_tml_gl_videoplane *x;
	t_atom rav[4];
	t_atom *av=rav;
	
	// make jit object
	if (x = (t_jit_tml_gl_videoplane *)jit_object_alloc(_jit_tml_gl_videoplane_class)) 
	{
		// create and attach ob3d
		jit_ob3d_new(x, dest_name);
		
		// set instance variable defaults
		x->dim[0] = 20;
		x->dim[1] = 20;	
		x->chunk = jit_glchunk_grid_new(_jit_sym_gl_quad_grid, 12, x->dim[0], x->dim[1]);
		x->recalc = 1;
		x->displaylist = 0;
		x->dlref = 0;
		x->gridmode = 0;
		
		x->interp = 1;
		x->tex_offset_x = 0.;
		x->tex_offset_y = 0.;
		x->tex_scale_x = 1.;
		x->tex_scale_y = 1.;
		
		x->nudge = 0.0001;	// hack for edges
	 			
		x->rect_tex = 1;
		x->client_storage = PLATFORM_DYNAMIC_TEX;
		x->colormode = gensym("argb");

		jit_atom_setfloat(av,1.);
		jit_atom_setfloat(av+1,1.);
		jit_atom_setfloat(av+2,1.);
		jit_atom_setfloat(av+3,1.);
		
		jit_object_method(x,gensym("color"),4,av);

		x->texture = jit_object_new(ps_jit_gl_texture,jit_attr_getsym(x,ps_drawto));
		if (x->texture) {
			x->texturename = jit_symbol_unique();		
			jit_attr_setsym(x->texture,_jit_sym_name,x->texturename);
			jit_attr_setsym(x->texture,gensym("defaultimage"),gensym("black"));
			jit_attr_setlong(x->texture,ps_rectangle,x->rect_tex);
			jit_attr_setsym(x->texture,ps_mode,x->client_storage?ps_dynamic:ps_static);		
			jit_attr_setsym(x,ps_texture,x->texturename);
		} else {
			error("jit.tml.gl.videoplane: could not create texture");
			x->texturename = _jit_sym_nothing;		
		}
	} 
	else 
	{
		error("jit.tml.gl.videoplane: Failed at jit_object_alloc");
		x = NULL;
	}	
	return x;
}
Example #7
0
t_jit_gradient *jit_gradient_new(void)
{
	t_jit_gradient *x;
	short i;
		
	if (x=(t_jit_gradient *)jit_object_alloc(_jit_gradient_class)) {
			x->start[0] = 0.;
			x->start[1] = 0.;
			x->start[2] = 0.; 
			x->start[3] = 0.; // defaults to black
			x->startcount = 4;
			x->end[0] = 1.;
			x->end[1] = 1.;
			x->end[2] = 1.; 
			x->end[3] = 1.; // defaults to white
			x->endcount = 4;
			x->chebycount = 1;
			x->cheby[0] = 1.;
			for(i=1;i<64;i++) {
				x->cheby[i] = 0.;
			}
	} else {
		x = NULL;
	}	
	return x;
}
Example #8
0
t_xray_jit_fdm *xray_jit_fdm_new(void)
{
	t_xray_jit_fdm *x;
	void *m;
	t_jit_matrix_info info;
		
	if (x=(t_xray_jit_fdm *)jit_object_alloc(_xray_jit_fdm_class)) {
		x->spacestep = 1.0;
		x->direction = ps_x;
		x->calced = 0;
		x->dim[0] = 1;
		x->dim[1] = 1;
		
		//create internal matrix
		jit_matrix_info_default(&info);
		info.type = _jit_sym_float32;
		info.planecount = 1;
		x->previousName = jit_symbol_unique();
		m = jit_object_new(_jit_sym_jit_matrix, &info);
		m = jit_object_method(m, _jit_sym_register, x->previousName);
		
		//Register matrix name
		if(!m) error("could not allocate internal matrix!");
		jit_object_attach(x->previousName, x);
		x->previous = m;		
	} else {
		x = NULL;
	}	
	return x;
}
Example #9
0
t_cv_jit_calibration *cv_jit_calibration_new(void)
{
	t_cv_jit_calibration	*x = NULL;
	
	x = (t_cv_jit_calibration*)jit_object_alloc(_cv_jit_calibration_class);
	if (x) {
		// some initialization
		x->pattern_size[0] = 7;
		x->pattern_size[1] = 6;
		x->board_view_nb = 20;
		x->dim[0] = 320;
		x->dim[1] = 240;
		x->frame = 0;
		x->wait_n_frame = 20;
		x->array_size = 2;
		strcpy(x->intrinsic_filename, "");
		strcpy(x->dist_filename, "");
		
		// allocate storage memory
		cv_jit_calibration_allocate(x);
		
		// build undistord map
		cv_jit_calibration_build_undistort_map(x);
		
		// load parameters
		cv_jit_calibration_load_param(x);
		
		x->calibration = 0;
		
	} 
	return x;
}
Example #10
0
t_jit_gl_hap *jit_gl_hap_new(t_symbol * dest_name)
{
	t_jit_gl_hap *x;
	
	if (x = (t_jit_gl_hap *)jit_object_alloc(_jit_gl_hap_class)) {
		jit_ob3d_new(x, dest_name);

		jit_gl_hap_new_native(x);
		x->has_video = 0;
		x->file = _jit_sym_nothing;
		x->texoutput = jit_object_new(gensym("jit_gl_texture"), dest_name);
		jit_attr_setsym(x->texoutput,gensym("defaultimage"),gensym("black"));
		jit_attr_setsym(x->texoutput,_jit_sym_name,jit_symbol_unique());
		jit_attr_setlong(x->texoutput, gensym("flip"), 0);
		
		x->hapglsl = jit_object_new(gensym("jit_gl_shader"), dest_name);
		
		x->buffer = NULL;
		x->hap_format = JIT_GL_HAP_PF_NONE;
		x->useshader = 0;
		x->validframe = 0;
		x->movieloaded = 0;
		x->deletetex = 0;
		x->texture = 0;
		x->dim[0] = x->dim[1] = 0;
		x->backingWidth = x->backingHeight = 0;
		x->roundedWidth = x->roundedHeight = 0;
		x->internalFormat = x->newInternalFormat = 0;
		x->newDataLength = x->rowLength = 0;
		x->target = 0;
		x->fboid = 0;
		
		x->direction = 1;
		x->suppress_loopnotify=0;
		x->userloop = 0;
		x->prevtime = 0;
		x->flipped = 0;
		
		x->adapt = 1;
		x->fps = 0;
		x->duration = 0;
		x->timescale = 0;
		x->framecount = 0;
		x->loop = JIT_GL_HAP_LOOP_ON;
		x->loopflags = 0;
		x->autostart = 1;
		x->rate = 1;
		x->vol = 1;
		x->rate_preserves_pitch = 1;
		x->looppoints[0] = x->looppoints[1] = -1;
		x->loopreport = 0;
		x->framereport = 0;
	}
	else {
		x = NULL;
	}	
	return x;
}
Example #11
0
t_jit_hello * jit_hello_new(t_symbol *s)
{
	t_jit_hello *x;

	if (x = (t_jit_hello *)jit_object_alloc(_jit_hello_class)) {
		x->text = s;
	} 
		
	return x;
}
Example #12
0
t_evolver *evolver_new(void)
{
	t_evolver	*x = NULL;

	x = (t_evolver *)jit_object_alloc(s_evolver_class);
	if (x) {
		x->gain = 0.0;
	}
	return x;
}
t_jit_freenect_grab *jit_freenect_grab_new(void)
{
	t_jit_freenect_grab *x;
	
	if ((x=(t_jit_freenect_grab *)jit_object_alloc(_jit_freenect_grab_class)))
	{
		x->device = NULL;
		x->timestamp = 0;
		x->unique = 0;
		x->aligndepth = 0;
		x->mode = 3;
		x->has_frames = 0;
		x->ndevices = 0;
		x->lut.f_ptr = NULL;
		x->lut_type = NULL;
		x->tilt = 0;
		x->state = NULL;
		x->clear_depth = 0;
		x->type = NULL;
		x->threshold = 2.f;
		x->rgb = NULL;
        
		//x->x_systhread = NULL;
		x->backbuffer_mutex = NULL;
		x->x_sleeptime = 10;
		systhread_mutex_new(&x->backbuffer_mutex, 0);
		x->got_rgb=0;
		x->got_depth=0;
		x->depth_mid=NULL;
		x->depth_front=NULL;
		x->rgb_front=NULL;
		x->rgb_back=NULL;
		x->rgb_mid=NULL;
		x->depth_back=NULL;
		
		
		x->depth_back = (uint16_t*)malloc(DEPTH_WIDTH*DEPTH_HEIGHT*DEPTH_BPP);
		x->depth_mid = (uint16_t*)malloc(DEPTH_WIDTH*DEPTH_HEIGHT*DEPTH_BPP);
		x->depth_front = (uint16_t*)malloc(DEPTH_WIDTH*DEPTH_HEIGHT*DEPTH_BPP);
		x->rgb_back = (uint8_t*)malloc(RGB_WIDTH*RGB_HEIGHT*RGB_BPP);
		x->rgb_mid = (uint8_t*)malloc(RGB_WIDTH*RGB_HEIGHT*RGB_BPP);
		x->rgb_front = (uint8_t*)malloc(RGB_WIDTH*RGB_HEIGHT*RGB_BPP);
		
		x->is_open=FALSE;
		x->id=++global_id;
		
		//jit_fnect_restart_thread(x);
        //pthread_mutex_init(&x->cb_mutex, NULL);
		jit_atom_setsym(&x->format, s_rgb);
		postNesa("new freenect instance added.");//TODO: remove	
	} else {
		x = NULL;
	}
	return x;
}
Example #14
0
t_jit_charmap *jit_charmap_new(void)
{
	t_jit_charmap *x;
		
	if (x=(t_jit_charmap *)jit_object_alloc(_jit_charmap_class)) {
		//nada
	} else {
		x = NULL;
	}	
	return x;
}
Example #15
0
t_xray_jit_distance *xray_jit_distance_new(void)
{
	t_xray_jit_distance *x;

	if (x=(t_xray_jit_distance *)jit_object_alloc(_xray_jit_distance_class)) {
		x->mode = 2;
	} else {
		x = NULL;
	}
	return x;
}
Example #16
0
t_gain* GainNew(void)
{
    t_gain*	self = (t_gain*)jit_object_alloc(s_gain_class);
    TTValue empty;

    self->m_x = new TTMatrix();
    self->m_y = new TTMatrix();
    self->m_gain = new TTMatrixObject("matrix.gain", empty);

    return self;
}
Example #17
0
t_jit_tml_fakeDepth *jit_tml_fakeDepth_new(void)
{
    t_jit_tml_fakeDepth *x;
    //long i;
		
    if (x=(t_jit_tml_fakeDepth *)jit_object_alloc(_jit_tml_fakeDepth_class)) {
		x->d = depthDataAlloc();
    } else {
	x = NULL;
    }	
    return x;
}
Example #18
0
StencilObjectPtr StencilNew(void)
{
	StencilObjectPtr	self = (StencilObjectPtr)jit_object_alloc(sStencilClass);
	TTErr				err;
	
	if (self) {
		err = TTObjectBaseInstantiate(kTTSym_matrix, (TTObjectBasePtr*)&self->x, kTTValNONE);
		err = TTObjectBaseInstantiate(kTTSym_matrix, (TTObjectBasePtr*)&self->y, kTTValNONE);
		err = TTObjectBaseInstantiate(TT("matrix.stencil"), (TTObjectBasePtr*)&self->stencilObject, kTTValNONE);
	} 
	return self;
}
Example #19
0
t_jit_3m *jit_3m_new(void)
{
	t_jit_3m *x;
		
	if (x=(t_jit_3m *)jit_object_alloc(_jit_3m_class)) {
		x->planecount = 0;
		systhread_mutex_new(&x->mutex,0);
	} else {
		x = NULL;
	}	
	return x;
}
Example #20
0
t_jit_coerce *jit_coerce_new(void)
{
	t_jit_coerce *x;

	if (x=(t_jit_coerce *)jit_object_alloc(_jit_coerce_class)) {
		x->type = _jit_sym_char;
		x->planecount = 4;
	} else {
		x = NULL;
	}
	return x;
}
Example #21
0
t_jit_thin *jit_thin_new(void)
{
	t_jit_thin *x;
	long i;
		
	if (x=(t_jit_thin *)jit_object_alloc(_jit_thin_class)) {
		
	} else {
		x = NULL;
	}	
	return x;
}
t_jit_pcl_concavehull *jit_pcl_concavehull_new(void)
{
    t_jit_pcl_concavehull	*x = NULL;
    
    x = (t_jit_pcl_concavehull*)jit_object_alloc(s_jit_pcl_concavehull_class);
    if (x) {
        x->leafsize = 1.;
        x->npoints = 10;
        x->alpha = 1.;
        
    }
    return x;
}
Example #23
0
t_cv_jit_blobs_elongation *cv_jit_blobs_elongation_new(void)
{
	t_cv_jit_blobs_elongation *x;
		
	if (x=(t_cv_jit_blobs_elongation *)jit_object_alloc(_cv_jit_blobs_elongation_class)) {
	
		/*Nothing to initialize*/

	} else {
		x = NULL;
	}	
	return x;
}
Example #24
0
t_cv_jit_moments *cv_jit_moments_new(void)
{
	t_cv_jit_moments *x;
		
	if (x=(t_cv_jit_moments *)jit_object_alloc(_cv_jit_moments_class)) {
		x->momcount = 7;
		x->centcount = 2;

	} else {
		x = NULL;
	}	
	return x;
}
t_jit_pcl_segeuclidean *jit_pcl_segeuclidean_new(void)
{
    t_jit_pcl_segeuclidean	*x = NULL;
    
    x = (t_jit_pcl_segeuclidean*)jit_object_alloc(s_jit_pcl_segeuclidean_class);
    if (x) {
        x->leafsize = 0.02;
        x->npoints = 50;
        x->stdthresh = 1.;
        x->cluster_tol = 0.5;
    }
    return x;
}
Example #26
0
t_jit_glue *jit_glue_new(void)
{
	t_jit_glue *x;
	short i;
		
	if (x=(t_jit_glue *)jit_object_alloc(_jit_glue_class)) {
		x->rows=1;
		x->cols=1;
	} else {
		x = NULL;
	}	
	return x;
}
Example #27
0
t_cv_jit_mass *cv_jit_mass_new(void)
{
	t_cv_jit_mass *x;
		
	if (x=(t_cv_jit_mass *)jit_object_alloc(_cv_jit_mass_class)) 
	{
		x->planecount = 0;
	} else 
	{
		x = NULL;
	}	
	return x;
}
Example #28
0
t_cv_jit_blobs_centroids *cv_jit_blobs_centroids_new(void)
{
	t_cv_jit_blobs_centroids *x;
		
	if (x=(t_cv_jit_blobs_centroids *)jit_object_alloc(_cv_jit_blobs_centroids_class)) {
	
		x->maxval = 0;

	} else {
		x = NULL;
	}	
	return x;
}
Example #29
0
t_jit_submatrix *jit_submatrix_new(void)
{
	t_jit_submatrix *x;
		
	if (x=(t_jit_submatrix *)jit_object_alloc(_jit_submatrix_class)) {
		x->dimcount = 1;
		x->dim[0] = 1;
		x->offsetcount = 1;
		x->offset[0] = 0;
	} else {
		x = NULL;
	}	
	return x;
}
Example #30
0
t_jit_ys_pixelweightmat *jit_ys_pixelweightmat_new(void)
{
    t_jit_ys_pixelweightmat *x;
    //long i;
		
    if (x=(t_jit_ys_pixelweightmat *)jit_object_alloc(_jit_ys_pixelweightmat_class)) {
	// attributes initialization	
	//x->param[0] = 1.0f;
	//for(i=1; i<6; i++) x->param[i] = 0.0f;
    } else {
	x = NULL;
    }	
    return x;
}