This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
c-net/image.h
Jakob Stornig 2eb2814f70 (feat) image loader implemented
Includes:
*converter from big endian to c unsigned int
*image loader
*image visualizer to check functionality.
2023-09-19 18:19:45 +02:00

31 lines
No EOL
905 B
C

#pragma once
#include "matrix.h"
#include "matrix.h"
typedef struct {
Matrix* pixel_values;
char label;
} Image;
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);