(feat) image loader implemented

Includes:
*converter from big endian to c unsigned int
*image loader
*image visualizer to check functionality.
This commit is contained in:
Jakob Stornig 2023-09-19 18:19:45 +02:00
parent 597e8126fa
commit 2eb2814f70
2 changed files with 100 additions and 27 deletions

22
image.h
View file

@ -5,9 +5,27 @@
typedef struct {
Matrix* pixel_values;
int image_label;
char label;
} Image;
Image** import_images(char* image_file_string, char* label_file_string, int number_of_images);
typedef struct {
const Image* image;
const size_t size;
} Image_Container;
static const int MAGIC_NUMBER_LABEL = 2049;
static const int MAGIC_NUMBER_IMAGES = 2051;
/**
* reads a specified number of images out of the training dataset
* @param image_file_string Path to the file containing the image data
* @param label_file_string Path to the file containing the image labels
* @param ptr via this pointer, the images can be accessed
* @param count maximum number of images to be loaded. If it is 0, all available images are loaded.
* @return
*/
Image ** import_images(char* image_file_string, char* label_file_string, unsigned int* number_imported, unsigned int count);
void img_print (Image* image);
void img_visualize(Image*image);
void img_free (Image* image);