/* display pictures in directory */
int dispaly_pic_in_dir(const char *directory, fb_info fb_inf)
{
    picture_t *pic = NULL;

    pic = get_pictures(directory, pic);
    display_pictures(pic, fb_inf);
    free_pic(pic);

    return 0;
}
Beispiel #2
0
/**
 * This function executes the extraction process.
 *
 * @param infos Informations about the launch process.
 */
void processAll(t_launch_infos *infos)
{
  t_binary_image *pic;
  SDL_Surface *image;
  t_cc_list *cc_list;
  
  pic = NULL;
  image = NULL;
  image = SDL_LoadBMP(infos->inFile);
  if (image != NULL)
    { 
      if (infos->verbose)
	printf("\n >> Image %s loaded.\n", infos->inFile);
      pic = bitmap_to_binaryimage(image,infos->inFile);
      if (pic != NULL)
	{ 
	  if (infos->verbose)
	    printf(" >> Binarization done.\n");
	  cc_list = findCC(pic->matrix);
	  if (cc_list != NULL)
	    {
	      checkIfCharacter(cc_list, pic->height, pic->width);

	      if (infos->verbose)
		printf(" >> Extraction of %d characters done.\n", cc_list->nbcc);

	      updateCC(cc_list);
	      exportCC(cc_list, pic);
	      
	      /*traceCC(image, cc_list); */

	      if (SDL_SaveBMP(image, infos->outFile) < 0)
		fprintf(stderr," > SDL BMP saving error <\n");
	      else
		if (infos->verbose)
		  printf(" >> Image %s saved.\n\n", infos->outFile);
	      /* free_listCC(cc_list) */
	      free_pic(pic);
	    }
	}
      SDL_FreeSurface(image);
    }
  else
    {
      fprintf(stderr, " > SDL BMP Loader error <\n");
      wfree(infos);
      exit(EXIT_FAILURE);
    }
}
Beispiel #3
0
Datei: free.c Projekt: wavs/ocre
/**
 * This function frees all structures from the extraction part.
 * @param pic Binary image.
 * @param result Result structure with lines set.
 */
void free_all(t_binary_image *pic, t_result_extraction *result)
{
  free_result(result);
  free_pic(pic);
}