Beispiel #1
0
void playlist_oper::remove_sel(bool crop)
{
	bit_array_bittable mask(get_count());
	get_sel_mask(mask);
	if (crop) remove_mask(bit_array_not(mask));
	else remove_mask(mask);
}
IplImage* cleanUpRedComponent(IplImage* img)
{
	IplImage* bn_redMask = NULL;
	IplImage* bn_image = NULL;
	IplImage* bn_dark_pixels= NULL;
	IplImage* dark_pixels= NULL;
	IplImage* filtered = NULL;
	
	bn_redMask = getABPixelsMap(img,LAB_A_THRES,LAB_B_THRES); //mask of the red pixels
	
	/*OTSU Thresholding for b/w image*/
	bn_dark_pixels = cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,1);
	bn_image = cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,1);
	cvCvtColor(img,bn_image,CV_BGR2GRAY);
	cvThreshold(bn_image,bn_dark_pixels,90,255,CV_THRESH_OTSU);
	
	/*Get back to color image*/
	dark_pixels = cvCreateImage(cvGetSize(img),img->depth,img->nChannels);
	cvCvtColor(bn_dark_pixels,dark_pixels,CV_GRAY2BGR);
	
	/*Remove the red pixels*/
	filtered=remove_mask(bn_dark_pixels,bn_redMask);
	
	
	cvReleaseImage(&bn_image);
	cvReleaseImage(&dark_pixels);
	cvReleaseImage(&bn_dark_pixels);
	cvReleaseImage(&bn_redMask);
	return filtered;
}
Beispiel #3
0
void metadb_handle_list::delete_mask(const bit_array & mask)
{
	unsigned n,m=get_count();
	for_each_bit_array(n,mask,true,0,m)
		get_item(n)->handle_release();
	remove_mask(mask);
}
Beispiel #4
0
Datei: get_raw.c Projekt: goTJ/tj
//}}}
//{{{int parse_command(char buffer[], int ctrl_socket){
//parse camara command 
int parse_command(char buffer[], int ctrl_socket){
	char command[MAX_LENG];
	char temp[MAX_LENG];
	int index;
	int i,j;
	int a,b,c,d;
	if(sscanf(buffer,"%s", command) == 1){
		if(strcmp(command,"stop") == 0){
			ctrl[0] = 0;
			return 1;
		}
		else if(strcmp(command, "start") ==0){
			ctrl[0] = 1;
			return 1;
		}
		else if(strcmp(command, "allrecord") == 0){
			ctrl[1] = 1;
			return 1;
		}
		else if(strcmp(command, "smartrecord") ==0){
			ctrl[1] = 0;
			return 1;
		}
		else if(strcmp(command, "rect_add") == 0){
			index = masklist[0];
			sscanf(buffer, "%s %u %u %u %u", command, &a,&b,&c,&d);
			printf("===%d %d %d %d===",a,b,c,d);
			
			masklist[4*index +1] = (a>255)?255:a; masklist[4*index +2] = (b>255)?255:b; masklist[4*index +3] = c; masklist[4*index +4] = (unsigned char)((int)((double)d/320.0*250.0));	
			

			printf("%d %s %u %u %u %u",masklist[0], command, masklist[4*index +1], masklist[4*index +2], masklist[4*index +3],(int) masklist[4*index +4] * 320/250);
			
			masklist[0]++;
			build_mask();
			printf("%d", masklist[0]);
			return 1;
		}
		else if(strcmp(command, "rect_del") == 0){
			sscanf(buffer,"%s %d", command, &index);
			return remove_mask(index);
		}
		else if(strcmp(command, "list") == 0){
			for(i = 0 ; i < masklist[0]; i++){
				sprintf(temp, "rect %d %d %d %d\r\n", masklist[i*4+1],masklist[i*4+2],masklist[i*4+3], (int)((double)masklist[i*4+4]*320.0/250.0));	
				write(ctrl_socket,temp, strlen(temp));
			}
			return 1;
		}
		else if(strcmp(command, "setthreshold") == 0){
			sscanf(buffer, "%s %d", command, &a);
			ctrl[2] = a /256;
			ctrl[3] = a % 256;
			return 1;
		}
		else
			return 0;
	}
}
Beispiel #5
0
void metadb_handle_list::remove_duplicates(bool b_release)
{
	unsigned count = get_count();
	if (count>0)
	{
		bit_array_bittable mask(count);
		mem_block_t<int> order(count);

		sort_by_format_get_order(order,"%_path_raw%|$num(%_subsong%,9)",0);

		unsigned n;
		for(n=0;n<count-1;n++)
		{
			if (get_item(order[n])==get_item(order[n+1]))
			{
				mask.set(order[n+1],true);
			}
		}

		if (b_release) delete_mask(mask);
		else remove_mask(mask);
	}
}
Beispiel #6
0
void metadb_handle_list::remove_duplicates_quick(bool b_release)
{
	unsigned count = get_count();
	if (count>0)
	{
		sort(remove_duplicates_quick_compare);
		bit_array_bittable mask(count);
		unsigned n;
		bool b_found = false;
		for(n=0;n<count-1;n++)
		{
			if (get_item(n)==get_item(n+1))
			{
				b_found = true;
				mask.set(n+1,true);
			}
		}
		if (b_found)
		{
			if (b_release) delete_mask(mask);
			else remove_mask(mask);
		}
	}
}
Beispiel #7
0
void dsp_chain_config::remove_all()
{
	remove_mask(bit_array_true());
}
Beispiel #8
0
void dsp_chain_config::remove_item(t_size p_index)
{
	remove_mask(bit_array_one(p_index));
}