Пример #1
0
main( )
{
  load_image_data( );   /* Input of image1 */ 
  sobel_filtering( );   /* Sobel filter is applied to image1 */
  save_image_data( );   /* Output of image2 */
  return 0;
}
Пример #2
0
main( )
{
    load_image_data( );    /* 画像データを image1 に読み込む */
    make_inverse_image( ); /* image1 を反転させ image2 へ */
    save_image_data( );    /* image2 を保存する */
    return 0;
}
Пример #3
0
main( )
{
    load_image_data( );    /* 画像データを image1 に読み込む */
    make_sampling_image( ); /* image1 を標本化させ image2 へ */
    save_image_data( );    /* image2 を保存する */
    return 0;
}
Пример #4
0
/* load from an image file */
void CVmObjClass::load_from_image(VMG_ vm_obj_id_t self,
                                  const char *ptr, size_t siz)
{
    /* load the image data */
    load_image_data(vmg_ self, ptr, siz);

    /* we need the image pointer saved for re-loading on RESTART */
    G_obj_table->save_image_pointer(self, ptr, siz);
}
Пример #5
0
/* 
 *   load from an image file 
 */
void CVmObjHTTPServer::load_from_image(VMG_ vm_obj_id_t self,
                                       const char *ptr, size_t siz)
{
    /* load our image data */
    load_image_data(vmg_ ptr, siz);

    /* 
     *   save our image data pointer in the object table, so that we can
     *   access it (without storing it ourselves) during a reload 
     */
    G_obj_table->save_image_pointer(self, ptr, siz);
}
Пример #6
0
void load_all_tiles()
{
	int i;
	char str[80];

	memset(map_tiles, 0, sizeof(map_tiles));

	for(i = 0; i < 255; i++)
	{
		sprintf(str, "./3dobjects/tile%i.dds", i);

		tiles_no = i;

		load_image_data(str, 1, 1, 1, 0, &map_tiles[i]);
	}
}
Пример #7
0
void load_data_files(void)
{
    /* Tell libt4k_common where TuxMath-specific data can be found */
    T4K_AddDataPrefix(DATA_PREFIX);
    if (!load_sound_data())
    {
        fprintf(stderr, "\nCould not load sound file - attempting to proceed without sound.\n");
        Opts_SetSoundHWAvailable(0);
    }

    /* This now has to come after loading the font, because it replaces
       a couple of images with translatable versions. */
    /* NOTE now the text code will load the font if it isn't already loaded */
    if (!load_image_data())
    {
        fprintf(stderr, "\nCould not load image file - exiting!\n");
        cleanup_on_error();
        exit(1);
    }
}
Пример #8
0
inline GlTexture load_cubemap()
{
    GlTexture tex;

    glBindTexture(GL_TEXTURE_CUBE_MAP, tex.get_gl_handle());
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, 0);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

    int size;
    glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 2048, 2048, 0, GL_RGB, GL_UNSIGNED_BYTE, load_image_data("assets/images/cubemap/positive_x.jpg", size).data());
    glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 2048, 2048, 0, GL_RGB, GL_UNSIGNED_BYTE, load_image_data("assets/images/cubemap/negative_x.jpg", size).data());
    glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 2048, 2048, 0, GL_RGB, GL_UNSIGNED_BYTE, load_image_data("assets/images/cubemap/positive_y.jpg", size).data());
    glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 2048, 2048, 0, GL_RGB, GL_UNSIGNED_BYTE, load_image_data("assets/images/cubemap/negative_y.jpg", size).data());
    glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 2048, 2048, 0, GL_RGB, GL_UNSIGNED_BYTE, load_image_data("assets/images/cubemap/positive_z.jpg", size).data());
    glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 2048, 2048, 0, GL_RGB, GL_UNSIGNED_BYTE, load_image_data("assets/images/cubemap/negative_z.jpg", size).data());
    
    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

    return tex;
}
Пример #9
0
/* reload from an image file */
void CVmObjClass::reload_from_image(VMG_ vm_obj_id_t self,
                                    const char *ptr, size_t siz)
{
    /* load the image data */
    load_image_data(vmg_ self, ptr, siz);
}
Пример #10
0
/*
 *   reload from the image file 
 */
void CVmObjHTTPServer::reload_from_image(VMG_ vm_obj_id_t self,
                                         const char *ptr, size_t siz)
{
    /* load our image data */
    load_image_data(vmg_ ptr, siz);
}
Пример #11
0
int main(int argc, char *argv[])
{
  int no_error=1;       /* Flag set to 0 on error */
  int usefile=0;        /* Flag set to 1 to use input setup file */
  int ncat1,ncat2;      /* Number of catalog objects */
  int nshift=0;         /* Number of matching objects */
  int another_loop=1;   /* Flag set to 0 when ending a loop */
  char fitsfile1[MAXC]; /* The name of the 1st FITS file to load */
  char catfile1[MAXC];  /* The name of the 1st SExtractor catalog file */
  char fitsfile2[MAXC]; /* The name of the 2nd FITS file to load */
  char catfile2[MAXC];  /* The name of the 2nd SExtractor catalog file */
  char setupfile[MAXC]; /* Name of the optional setup file */
  char line[MAXC];      /* General string to read input */
  Pos initshift;        /* Initial shift between two images */
  Pos shiftmean;        /* Mean shift */
  Pos shiftrms;         /* RMS on shift */
  Pos shiftmed;         /* Median shift */
  Image *image1;        /* The container of the 1st FITS image array */
  Image *image2;        /* The container of the 2nd FITS image array */
  Setup *setup1;        /* Container for the 1st image display info */
  Setup *setup2;        /* Container for the 2nd image display info */
  Secat *catdat1=NULL;  /* SExtractor data for 1st catalog */
  Secat *catdat2=NULL;  /* SExtractor data for 2nd catalog */
  Secat *shiftcat=NULL; /* Catalog of shifts between 1st and 2nd catalogs */

  /*
   * Check the command line
   */

  if(argc < 5) {
    fprintf(stderr,"\nfind_dither fitsfile1 catfile1 fitsfile2 catfile2 ");
    fprintf(stderr,"(setupfile)\n\n");
    return 1;
  }

  /*
   * Get the names of the files.
   */

  strcpy(fitsfile1,argv[1]);
  strcpy(catfile1,argv[2]);
  strcpy(fitsfile2,argv[3]);
  strcpy(catfile2,argv[4]);
  if(argc == 6) {
    usefile = 1;
    strcpy(setupfile,argv[5]);
  }
  else
    sprintf(setupfile,"");

  /*
   * Read the 1st data array.
   */

  if(!(image1 = new_Image(fitsfile1))) {
    fprintf(stderr,"ERROR.  Exiting program. Could not open %s\n\n",
	    fitsfile1);
    return 1;
  }

  if(load_image_data(image1) == ERROR)
    no_error = 0;

  /*
   * Create setup structure and fill with information used to set plotting
   *  parameters.
   */

  if(no_error) 
    if(!(setup1 = fill_setup(image1,setupfile,usefile,PIXEL)))
      no_error = 0;

  /*
   * Loop over displaying image until happy with results
   */

  if(no_error) {
    open_plot_window();
    if(display_image(image1,setup1))
      no_error = 0;
    else
      while(no_error && another_loop) {
	switch(another_loop = setup_menu(image1,setup1)) {
	case 1:
	  if(display_image(image1,setup1))
	    no_error = 0;
	  break;
	case 0:
	  break;
	case -1:
	  no_error = 0;
	  break;
	default:
	  break;
	}
      }
  }

  another_loop = 1;

  /*
   * Read the 2nd data array.
   */

  if(!(image2 = new_Image(fitsfile2))) {
    fprintf(stderr,"ERROR.  Exiting program. Could not open %s\n\n",
	    fitsfile1);
    return 1;
  }

  if(load_image_data(image2) == ERROR)
    no_error = 0;

  /*
   * Create setup structure and fill with information used to set plotting
   *  parameters.
   */

  if(no_error)
    if(!(setup2 = fill_setup(image2,setupfile,usefile,PIXEL)))
      no_error = 0;

  /*
   * Loop over displaying image until happy with results
   */

  if(no_error) {
    open_plot_window();
    if(display_image(image2,setup2))
      no_error = 0;
    else
      while(no_error && another_loop) {
	switch(another_loop = setup_menu(image2,setup2)) {
	case 1:
	  if(display_image(image2,setup2))
	    no_error = 0;
	  break;
	case 0:
	  break;
	case -1:
	  no_error = 0;
	  break;
	default:
	  break;
	}
      }
  }

  another_loop = 1;

  /*
   * Read in the first SExtractor catalog file
   */

  printf("---------------------------------------------------------------\n");
  if(no_error)
    if(!(catdat1 = read_secat(catfile1,'#',&ncat1,6)))
      no_error = 0;

  /*
   * Plot the catalog
   */

  if(no_error) {
    cpgslct(1);
    printf("\nPlotting SExtractor positions for first catalog\n");
    if(plot_secat(setup1,catdat1,ncat1,2,3,2.0))
      no_error = 0;
  }

  /*
   * Read in second SExtractor catalog file
   */

  if(no_error)
    if(!(catdat2 = read_secat(catfile2,'#',&ncat2,6)))
      no_error = 0;

  /*
   * Plot the catalog
   */

  if(no_error) {
    cpgslct(2);
    printf("\nPlotting SExtractor positions for second catalog\n");
    if(plot_secat(setup2,catdat2,ncat2,2,3,2.0))
      no_error = 0;
  }

  /*
   * Get initial shift
   */

  if(no_error) {
    get_init_shift(catdat1,ncat1,catdat2,ncat2,&initshift);
  }

  /*
   * Calculate shifts between first and second catalogs
   */

  if(no_error)
    if(!(shiftcat = find_shifts(catdat1,ncat1,catdat2,ncat2,initshift,
				setup2,&nshift,0)))
      no_error = 0;
    else
      printf("\nCalculated shifts between %d pairs.\n",nshift);

  /*
   * Get statistics on the shifts and plot results
   */

  if(no_error)
    plot_shifts(shiftcat,nshift);

  /*
   * Clean up and exit
   */

  cpgend();
  cpgend();
  image1 = del_Image(image1);
  setup1 = del_setup(setup1);
  catdat1 = del_secat(catdat1);
  image2 = del_Image(image2);
  setup2 = del_setup(setup2);
  catdat2 = del_secat(catdat2);
  shiftcat = del_secat(shiftcat);
  
  if(no_error) {
    printf("\nProgram find_dither.c completed.\n\n");
    return 0;
  }
  else {
    fprintf(stderr,"\nERROR. Exiting find_dither.c\n\n");
    return 1;
  }
}
Пример #12
0
/*
 *   reload from the image 
 */
void CVmObjFrameRef::reload_from_image(VMG_ vm_obj_id_t self,
                                       const char *ptr, size_t siz)
{
    /* load our image data */
    load_image_data(vmg_ self, ptr, siz);
}