Ejemplo n.º 1
0
void    Data_Close(void)
{
    assert(g_Datafile != NULL);
    list_free_custom(&g_DatafileBitmapCopy32, destroy_bitmap);
    unload_datafile(g_Datafile);
    g_Datafile = NULL;
}
Ejemplo n.º 2
0
int ClassifyOcrSamples_Example()
{
	char *input = Examples::getPath_alloc(ocrSamples);
	char *output = Examples::getPath_alloc(ocrSamplesOutput);


	Image *img = ReadImage_STB(input);
	if (img == NULL) {
		NConsolePrint("\nClassify OCR Samples failed! input image not found!");
		return -1;
	}
	Image *subimage = 0;
	Image *subImageEdges = NULL;
	ImageClassificationData *icdTemp = 0;
	List *classes = list_create();

	int si = 0;
	for (int x = 0; x < 2000 - 20; x += 20)
	{
		for (int y = 700; y < 800; y += 20)
		{
			subimage = image_get_area(img, x, y, ocrSubimageSize, ocrSubimageSize);

			icdTemp = image_classify(subimage, 12);
			
			free_image(subimage);
			
			if (icdTemp == NULL)
				continue;
			list_put(classes, icdTemp);
			
			//free_image_classification_data(icdTemp);
			si++;
		}
	}

	char *csvContent = datas_get_format_csv(classes);

	file_write(output, csvContent);

	freeN(csvContent);
	//list_free_default(classes, free_l);
	
	list_free_custom(classes, free_l);
	
	freeN(input);
	freeN(output);
	free_image(img);

	return 0;
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// VLFN_DataBase_Save (void)
// Save VLFN database back to MEKA.FDB file.
//-----------------------------------------------------------------------------
void        VLFN_DataBase_Save (void)
{
    FILE *  f;
    t_list *list;

    if ((f = fopen (VLFN_DataBase.filename, "wt")) == 0)
        return; // FIXME: report that somewhere ?

    // Sort entries by file name before writing, so the output file is more sexy
    list_sort (&VLFN_DataBase.entries, (int (*)(void *, void *))VLFN_Entries_Compare);

    // Write header
    fprintf (f, ";-----------------------------------------------------------------------------\n");
    fprintf (f, "; " MEKA_NAME " " MEKA_VERSION " - User Filenames DataBase\n");
    fprintf (f, "; Associate user filenames with MEKA DataBase entries.\n");
    fprintf (f, "; This information is used by the file loader.\n");
    fprintf (f, "; This file is automatically updated and rewritten by the emulator.\n");
    fprintf (f, ";-----------------------------------------------------------------------------\n\n");

    // Write all entries
    for (list = VLFN_DataBase.entries; list != NULL; list = list->next)
    {
        t_vlfn_entry *entry     = list->elem;
        t_db_entry *db_entry    = entry->db_entry;
        fprintf (f, "%s", entry->filename);
        if (db_entry->crc_crc32 != 0)
            fprintf (f, "/CRC32:%08x", db_entry->crc_crc32);
        // Note: MekaCRC is always written now!
        fprintf (f, "/MEKACRC:%08X%08X\n", db_entry->crc_mekacrc.v[0], db_entry->crc_mekacrc.v[1]);
    }

    fprintf (f, "\n;-----------------------------------------------------------------------------\n\n");

    // Close write
    fclose (f);

    // Free all entries
    list_free_custom (&VLFN_DataBase.entries, VLFN_Entry_Delete);
}
Ejemplo n.º 4
0
int List_Example()
{
	NConsolePrint("\nstart List\n");
	List *list = list_create();
	//list_put(list, "static str");
	//list_put(list, "static string");
	//list_put(list, "statString");
	list_put(list, strmakeN("DynString"));
	list_put(list, strmakeN("DynamicS"));
	list_put(list, strmakeN("String dyn"));

	//print them
	NConsolePrint("\n");
	LIST_FOREACH(list)
	{
		NConsolePrint("%s\n", (char *)link->data);
	}

	list_free_custom(list, freeN); /* with passed callback for free element */
	//list_free(list); /* clear only list. for list with static elements */

	NConsolePrint("finish List\n\n");
	return 0;
}
Ejemplo n.º 5
0
//-----------------------------------------------------------------------------
// Release all Meka DB data
//-----------------------------------------------------------------------------
void            DB_Close (void)
{
    list_free_custom (&DB.entries, (t_list_free_handler)DB_Entry_Delete);
    DB.entries = NULL;
    DB.current_entry = NULL;
}
Ejemplo n.º 6
0
//-----------------------------------------------------------------------------
// DB_Close (void)
// Release all Meka DB data
//-----------------------------------------------------------------------------
void            DB_Close (void)
{
    list_free_custom (&DB.entries, DB_Entry_Delete);
    DB.entries = NULL;
    DB_CurrentEntry = NULL;
}
Ejemplo n.º 7
0
void Blitters_Close()
{
    list_free_custom(&Blitters.list, (t_list_free_handler)Blitter_Delete);
}