示例#1
0
void display_images(IMAGE &clip_image, IMAGE &scaled_image) { 
  WINDOW clip_im_window;         //window for debug
  WINDOW scale_im_window;        //window for debug
  INT16 i;
  GRAPHICS_EVENT event;          //                                                      c;

                                 // xmin xmax ymin ymax
  clip_im_window = create_window ("Clipped Blob", SCROLLINGWIN, editor_word_xpos - 20, editor_word_ypos - 100, 5 * clip_image.get_xsize (), 5 * clip_image.get_ysize (), 0, clip_image.get_xsize (), 0, clip_image.get_ysize (),
    TRUE, FALSE, FALSE, TRUE);   // down event & key only

  clear_view_surface(clip_im_window); 
  show_sub_image (&clip_image,
    0, 0,
    clip_image.get_xsize (), clip_image.get_ysize (),
    clip_im_window, 0, 0);

  line_color_index(clip_im_window, RED); 
  for (i = 1; i < clip_image.get_xsize (); i++) {
    move2d (clip_im_window, i, 0);
    draw2d (clip_im_window, i, clip_image.get_xsize ());
  }
  for (i = 1; i < clip_image.get_ysize (); i++) {
    move2d (clip_im_window, 0, i);
    draw2d (clip_im_window, clip_image.get_xsize (), i);
  }

                                 // xmin xmax ymin ymax
  scale_im_window = create_window ("Scaled Blob", SCROLLINGWIN, editor_word_xpos + 300, editor_word_ypos - 100, 5 * scaled_image.get_xsize (), 5 * scaled_image.get_ysize (), 0, scaled_image.get_xsize (), 0, scaled_image.get_ysize (),
    TRUE, FALSE, FALSE, TRUE);   // down event & key only

  clear_view_surface(scale_im_window); 
  show_sub_image (&scaled_image,
    0, 0,
    scaled_image.get_xsize (), scaled_image.get_ysize (),
    scale_im_window, 0, 0);

  line_color_index(scale_im_window, RED); 
  for (i = 1; i < scaled_image.get_xsize (); i++) {
    move2d (scale_im_window, i, 0);
    draw2d (scale_im_window, i, scaled_image.get_xsize ());
  }
  for (i = 1; i < scaled_image.get_ysize (); i++) {
    move2d (scale_im_window, 0, i);
    draw2d (scale_im_window, scaled_image.get_xsize (), i);
  }

  overlap_picture_ops(TRUE); 
  await_event(scale_im_window, TRUE, ANY_EVENT, &event); 
  destroy_window(clip_im_window); 
  destroy_window(scale_im_window); 
}
示例#2
0
WINDOW display_image(IMAGE *image,
                     const char *title,
                     INT32 x,
                     INT32 y,
                     BOOL8 wait) {
  WINDOW im_window;
  INT16 i;
  GRAPHICS_EVENT event;          //output event

                                 // xmin xmax ymin ymax
  im_window = create_window (title, SCROLLINGWIN, x, y, 10 * image->get_xsize (), 10 * image->get_ysize (), 0, image->get_xsize (), 0, image->get_ysize (),
    TRUE, FALSE, FALSE, TRUE);   // down event & key only

  clear_view_surface(im_window); 
  show_sub_image (image,
    0, 0,
    image->get_xsize (), image->get_ysize (), im_window, 0, 0);

  line_color_index(im_window, RED); 
  for (i = 1; i < image->get_xsize (); i++) {
    move2d (im_window, i, 0);
    draw2d (im_window, i, image->get_ysize ());
  }
  for (i = 1; i < image->get_ysize (); i++) {
    move2d (im_window, 0, i);
    draw2d (im_window, image->get_xsize (), i);
  }
  overlap_picture_ops(TRUE); 

  if (wait)
    await_event(im_window, TRUE, ANY_EVENT, &event); 

  return im_window;
}
示例#3
0
void
main()
{
  int i, j;
  int nsubpixels = 1 << (HIBITS+LOBITS);
  fixpoint zero, maxpix;

  zero = 0;
  maxpix = ((NPIXELS-1) << LOBITS) | LOMASK;

  InitScreen();

  if (verbose) {
	 printf("zero "); fp_print(zero); printf(", max "); fp_print(maxpix);
	 printf("\n");
  }

  for (i=0; i != maxpix + 1; i++) {
	 for (j=0; j != maxpix + 1; j++) {

		if (verbose) {
		  printf("\n\n************** New Iteration ************\n\n");
		  printf("%3d, %3d --> ", i, j);
		  fp_print(i); printf(", "); fp_print(j); printf("\n");
		}

		clear_buffer();
		clear_view_surface(fildes); 

		fill_color(fildes, 0.5, 0.5, 0.5);
		subpixel_triangle(zero, zero,  zero,  maxpix, i, j);

		fill_color(fildes, 0.0, 1.0, 0.0);
		subpixel_triangle(zero, zero,  maxpix,  zero, i, j);

		fill_color(fildes, 0.0, 0.0, 1.0);
		subpixel_triangle(zero,  maxpix,  maxpix,   maxpix, i, j);

		fill_color(fildes, 1.0, 0.0, 0.0);
		subpixel_triangle( maxpix, zero,  maxpix,   maxpix, i, j);

		buffer_check();
		make_picture_current(fildes);

		if (verbose) {
		  printf("  hit <return> for next iteration\n");
		  getchar();
		}

	 }
  }
}
示例#4
0
WINDOW display_clip_image(WERD *word,                //word to be processed
                          IMAGE &bin_image,          //whole image
                          PIXROW_LIST *pixrow_list,  //pixrows built
                          BOX &pix_box               //box of subimage
                         ) {
  WINDOW clip_window;            //window for debug
  BOX word_box = word->bounding_box ();
  int border = word_box.height () / 2;
  BOX display_box = word_box;

  display_box.move_bottom_edge (-border);
  display_box.move_top_edge (border);
  display_box.move_left_edge (-border);
  display_box.move_right_edge (border);
  display_box -= BOX (ICOORD (0, 0 - BUG_OFFSET),
    ICOORD (bin_image.get_xsize (),
    bin_image.get_ysize () - BUG_OFFSET));

  pgeditor_msg ("Creating Clip window...");
  clip_window =
    create_window ("Clipped Blobs",
    SCROLLINGWIN,
    editor_word_xpos, editor_word_ypos,
    3 * (word_box.width () + 2 * border),
    3 * (word_box.height () + 2 * border),
  //window width,height
                                 // xmin, xmax
    display_box.left (), display_box.right (),
    display_box.bottom () - BUG_OFFSET,
    display_box.top () - BUG_OFFSET,
  // ymin, ymax
    TRUE, FALSE, FALSE, TRUE);   // down event & key only
  pgeditor_msg ("Creating Clip window...Done");

  clear_view_surface(clip_window); 
  show_sub_image (&bin_image,
    display_box.left (),
    display_box.bottom (),
    display_box.width (),
    display_box.height (),
    clip_window,
    display_box.left (), display_box.bottom () - BUG_OFFSET);

  word->plot (clip_window, RED);
  word_box.plot (clip_window, INT_HOLLOW, TRUE, BLUE, BLUE);
  pix_box.plot (clip_window, INT_HOLLOW, TRUE, BLUE, BLUE);
  plot_pixrows(pixrow_list, clip_window); 
  overlap_picture_ops(TRUE); 
  return clip_window;
}
示例#5
0
void display_images(IMAGE *image_w, IMAGE *image_n, IMAGE *match_image) { 
  WINDOW w_im_window;
  WINDOW n_im_window;
  WINDOW match_window;
  GRAPHICS_EVENT event;          //output event
  INT16 i;

                                 // xmin xmax ymin ymax
  w_im_window = create_window ("Image 1", SCROLLINGWIN, 20, 100, 10 * image_w->get_xsize (), 10 * image_w->get_ysize (), 0, image_w->get_xsize (), 0, image_w->get_ysize (),
    TRUE, FALSE, FALSE, TRUE);   // down event & key only

  clear_view_surface(w_im_window); 
  show_sub_image (image_w,
    0, 0,
    image_w->get_xsize (), image_w->get_ysize (),
    w_im_window, 0, 0);

  line_color_index(w_im_window, RED); 
  for (i = 1; i < image_w->get_xsize (); i++) {
    move2d (w_im_window, i, 0);
    draw2d (w_im_window, i, image_w->get_ysize ());
  }
  for (i = 1; i < image_w->get_ysize (); i++) {
    move2d (w_im_window, 0, i);
    draw2d (w_im_window, image_w->get_xsize (), i);
  }

                                 // xmin xmax ymin ymax
  n_im_window = create_window ("Image 2", SCROLLINGWIN, 240, 100, 10 * image_n->get_xsize (), 10 * image_n->get_ysize (), 0, image_n->get_xsize (), 0, image_n->get_ysize (),
    TRUE, FALSE, FALSE, TRUE);   // down event & key only

  clear_view_surface(n_im_window); 
  show_sub_image (image_n,
    0, 0,
    image_n->get_xsize (), image_n->get_ysize (),
    n_im_window, 0, 0);

  line_color_index(n_im_window, RED); 
  for (i = 1; i < image_n->get_xsize (); i++) {
    move2d (n_im_window, i, 0);
    draw2d (n_im_window, i, image_n->get_ysize ());
  }
  for (i = 1; i < image_n->get_ysize (); i++) {
    move2d (n_im_window, 0, i);
    draw2d (n_im_window, image_n->get_xsize (), i);
  }
  overlap_picture_ops(TRUE); 

                                 // xmin xmax ymin ymax
  match_window = create_window ("Match Result", SCROLLINGWIN, 460, 100, 10 * match_image->get_xsize (), 10 * match_image->get_ysize (), 0, match_image->get_xsize (), 0, match_image->get_ysize (),
    TRUE, FALSE, FALSE, TRUE);   // down event & key only

  clear_view_surface(match_window); 
  show_sub_image (match_image,
    0, 0,
    match_image->get_xsize (), match_image->get_ysize (),
    match_window, 0, 0);

  line_color_index(match_window, RED); 
  for (i = 1; i < match_image->get_xsize (); i++) {
    move2d (match_window, i, 0);
    draw2d (match_window, i, match_image->get_ysize ());
  }
  for (i = 1; i < match_image->get_ysize (); i++) {
    move2d (match_window, 0, i);
    draw2d (match_window, match_image->get_xsize (), i);
  }
  overlap_picture_ops(TRUE); 

  await_event(match_window, TRUE, ANY_EVENT, &event); 
  destroy_window(w_im_window); 
  destroy_window(n_im_window); 
  destroy_window(match_window); 
}