Ejemplo n.º 1
0
static gint resize_cb(GtkWidget *widget, GdkEventConfigure *event)
{
	gint	width, height;

	/* detect change in window size */
	width = event->width;
	height = event->height;
	if ((width != img_physwidth || height != img_physheight)
					&& width >= 64 && height >= 64)
	{
		/* Change the image to match the window */
		gtk_drawing_area_size(GTK_DRAWING_AREA(area), width, height);
		img_resize(width, height);

		/* Store the new height & width.  Might as well grab the
		 * position too.
		 */
		config.width = width;
		config.height = height;
		config.x = event->x;
		config.y = event->y;

		/* Remember to save this change in .xmms/config eventually */
		savewhen = time(NULL) + RESIZE_SAVE_DELAY;
	}
	return TRUE;
}
Ejemplo n.º 2
0
	void AudioData( os::View* pcTarget, int16 nData[2][512] )
	{
		if( !activated )
			return;
			
			
		config.signal_style = m_zType;
		
		blursk_view = pcTarget;
		int width = pcTarget->GetBounds().Width() + 1;
		int height = pcTarget->GetBounds().Height() + 1;
		
		if( width < 32 || height < 32 )
			return;
			
		
		if ((width != img_physwidth || height != img_physheight))
		{
			/* Change the image to match the window */
			img_resize(width, height);

			/* Store the new height & width.  Might as well grab the
			 * position too.
			 */
			config.width = width;
			config.height = height;
			config.x = 0;
			config.y = 0;
		
			delete( blursk_bitmap );
			blursk_bitmap = new os::Bitmap( config.width, config.height, os::CS_RGB32 );
		}
		
		blursk_render_pcm( nData );
	}
Ejemplo n.º 3
0
int loadFaceImgArray(char * filename)
{
 FILE * imgListFile = 0;
 char imgFilename[512];
 int iFace, nFaces=0;
 
 // open the input file
 imgListFile = fopen(filename, "r");
 
 // count the number of faces
 while( fgets(imgFilename, 512, imgListFile) ) ++nFaces;
 rewind(imgListFile);
 
 // allocate the face-image array and person number matrix
 faceImgArr = (IplImage **)cvAlloc( nFaces*sizeof(IplImage *) );
 personNumTruthMat = cvCreateMat( 1, nFaces, CV_32SC1 );
 
 // store the face images in an array
 for(iFace=0; iFace<nFaces; iFace++)
 {
 // read person number and name of image file
 fscanf(imgListFile,
 "%d %s", personNumTruthMat->data.i+iFace, imgFilename);
 
 // load the face image
 faceImgArr[iFace] = cvLoadImage(imgFilename, CV_LOAD_IMAGE_GRAYSCALE);
 faceImgArr[iFace]=img_resize(faceImgArr[iFace],faceImgArr[0]->width,faceImgArr[0]->height);

 }
 
 fclose(imgListFile);
 printf("Exiting loadFaceImgArray\n");
 return nFaces;

}
Ejemplo n.º 4
0
	/* 提取runlength 特征*/
	void RunLength::Dorunlength(float* feature){
		
		img_resize();
		/* 二值化 */
		adaptiveThreshold(image_resize, image_binary, 255, CV_ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY, 31, 15);

		Mat _Pyramid = Mat(1, 4, CV_32F);
		Mat coords = Mat(1, 4, CV_32F);

		for (int i = 0; i < Pyramid.rows; i++){

			_Pyramid = Pyramid(Rect(0, i, 4, 1));
			

			coords = _Pyramid.mul(width_height);
			
			int x1 = (int)coords.at<float>(0, 0);
			int x2 = (int)coords.at<float>(0, 1);
			int y1 = (int)coords.at<float>(0, 2);
			int y2 = (int)coords.at<float>(0, 3);
			Mat test = image_binary(Range(y1, y2), Range(x1, x2));

			runlength_encoding(test, &feature[72 * i]);
		}

	}
Ejemplo n.º 5
0
void tlen_image(const char *in_file, const char *templ_file, const char *result_file, double level)
{
    int x = 0;
    int y = 0;
    IplImage* dst;
    IplImage* image, *gray_image;
    IplImage* templ;
    IplImage* new_templ;
    int width, height;
    double alpha, beta;

    /* Get image */
    image = cvLoadImage(in_file, 1);
    assert(image != 0);

    templ = cvLoadImage(templ_file, 1);
    assert(templ != 0);

    /* Size of template */
    new_templ = img_resize(templ, image->width, image->height);
    width = new_templ->width;
    height = new_templ->height;
    dst = cvCloneImage(new_templ);

    alpha = level;
    beta = 0.5;

    /* Set area */
    cvSetImageROI(image, cvRect(x, y, width, height));
    /* Summ */
    cvAddWeighted(image, alpha, new_templ, beta, 0.0, dst);
    /* Free area */
    cvResetImageROI(image);

    /* Set black-white image */
    gray_image = cvCreateImage(cvSize(image->width,image->height), 8, 1);
    cvCvtColor(dst, gray_image, CV_RGB2GRAY);

    cvSaveImage(result_file, gray_image, NULL);

    /* Fre memory */
    cvReleaseImage(&image);
    cvReleaseImage(&gray_image);
    cvReleaseImage(&templ);
    cvReleaseImage(&new_templ);
    cvReleaseImage(&dst);
}
Ejemplo n.º 6
0
static void blursk_init(void)
{
#if 0	
	if (blursk_window)
		return;
#endif
#ifdef DUMPCORE
	signal(SIGSEGV, SIG_DFL);
#endif
	/* Get the configuration and create the image buffers */
	//config_read(NULL, NULL);
	//preset_read();
	config_default(&config);
	img_resize(config.width, config.height);

#if 0
	/* Create the window */
	blursk_window = gtk_window_new(config.window_title ? GTK_WINDOW_TOPLEVEL
							   : GTK_WINDOW_DIALOG);
	gtk_window_set_title(GTK_WINDOW(blursk_window), PACKAGE);
	gtk_window_set_policy(GTK_WINDOW(blursk_window), TRUE, TRUE, TRUE);
	gtk_signal_connect(GTK_OBJECT(blursk_window), "destroy",
		GTK_SIGNAL_FUNC(blursk_destroy_cb), NULL);
	gtk_signal_connect(GTK_OBJECT(blursk_window), "destroy", 
		GTK_SIGNAL_FUNC(gtk_widget_destroyed), &blursk_window);
	gtk_signal_connect(GTK_OBJECT(blursk_window), "configure_event", 
		GTK_SIGNAL_FUNC(resize_cb), NULL);

	/* Put a drawing area in the window */
	area = gtk_drawing_area_new();
	gtk_drawing_area_size(GTK_DRAWING_AREA(area), img_physwidth, img_physheight);
	gtk_container_add(GTK_CONTAINER(blursk_window),area);
	gtk_widget_show(area);

	/* Arrange for key & mouse events to be detected */
	gtk_signal_connect(GTK_OBJECT(blursk_window), "selection_received",
		GTK_SIGNAL_FUNC(selection_cb), NULL);
	gtk_signal_connect(GTK_OBJECT(blursk_window), "key_press_event",
		GTK_SIGNAL_FUNC(key_cb), NULL);
	gtk_signal_connect(GTK_OBJECT(blursk_window), "button_press_event",
		GTK_SIGNAL_FUNC(mousebutton_cb), NULL);
	gtk_signal_connect(GTK_OBJECT(blursk_window), "button_release_event",
		GTK_SIGNAL_FUNC(mousebutton_cb), NULL);
	gtk_signal_connect(GTK_OBJECT(blursk_window), "motion_notify_event",
		GTK_SIGNAL_FUNC(mousemove_cb), NULL);
	gtk_widget_set_events(blursk_window, GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK);

	/* Initialize the drawing area */
	gtk_widget_realize(area);
	bg_pixmap = gdk_pixmap_create_from_xpm_d(area->window,
		NULL, NULL, blursk_xmms_logo_xpm);
	gdk_window_set_back_pixmap(area->window, bg_pixmap, 0);
	

	/* Move the window to its usual place, if any.  If portions are beyond
	 * the edge of the screen, then move it to make everything visible.
	 */
	if (config.x != -1 || config.y != -1)
	{
		if (config.x < 0)
			config.x = 0;
		else if (config.x + img_physwidth >= gdk_screen_width())
			config.x = gdk_screen_width() - img_physwidth;
		if (config.y < 0)
			config.y = 0;
		else if (config.y + img_physheight >= gdk_screen_height())
			config.y = gdk_screen_height() - img_physheight;
		gtk_widget_realize(blursk_window);
		gtk_window_reposition(GTK_WINDOW(blursk_window), config.x, config.y);
	}

	/* Show it! */
	gtk_widget_show(blursk_window);

	/* Determine whether fullscreen operation is supported. */
	can_fullscreen = xmms_fullscreen_init(blursk_window);
#endif
	if( blursk_bitmap == NULL )
		blursk_bitmap = new os::Bitmap( config.width, config.height, os::CS_RGB32 );
	color_genmap(TRUE);
}
Ejemplo n.º 7
0
void __blursk_init (BlurskPrivate *priv) {
    color_genmap(priv, FALSE);
    img_resize(priv, config.width, config.height);
    songinfo = visual_songinfo_new(VISUAL_SONGINFO_TYPE_NULL);
}