Compare commits
4
Commits
master
...
b8510c82da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8510c82da | ||
|
|
7b9a1d8f07 | ||
|
|
4486fbd82e | ||
|
|
2f30c2d030 |
@@ -7,6 +7,25 @@
|
||||
#define FILE_HEADER_STRING "__info2_image_file_format__"
|
||||
|
||||
// TODO Implementieren Sie geeignete Hilfsfunktionen für das Lesen der Bildserie aus einer Datei
|
||||
static int checkFileHeader(FILE *fp)
|
||||
{
|
||||
if (!fp) // Datei konnte nicht geöffnet werden
|
||||
return 0;
|
||||
|
||||
char buffer[BUFFER_SIZE];
|
||||
size_t headerLen = strlen(FILE_HEADER_STRING);
|
||||
if (headerLen >= BUFFER_SIZE) // Safety Check
|
||||
return 0;
|
||||
|
||||
if (fread(buffer, 1, headerLen, fp) != headerLen)
|
||||
return 0;
|
||||
|
||||
buffer[headerLen] = '\0';
|
||||
if (strcmp(buffer, FILE_HEADER_STRING) != 0)
|
||||
return 0;
|
||||
|
||||
return 1; // Header stimmt
|
||||
}
|
||||
|
||||
// TODO Vervollständigen Sie die Funktion readImages unter Benutzung Ihrer Hilfsfunktionen
|
||||
GrayScaleImageSeries *readImages(const char *path)
|
||||
@@ -19,4 +38,10 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
// TODO Vervollständigen Sie die Funktion clearSeries, welche eine Bildserie vollständig aus dem Speicher freigibt
|
||||
void clearSeries(GrayScaleImageSeries *series)
|
||||
{
|
||||
if (series == NULL)
|
||||
return;
|
||||
|
||||
free(series->images);
|
||||
free(series->labels);
|
||||
free(series);
|
||||
}
|
||||
@@ -11,17 +11,34 @@ Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||
|
||||
void clearMatrix(Matrix *matrix)
|
||||
{
|
||||
|
||||
//test
|
||||
}
|
||||
|
||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||
{
|
||||
|
||||
if (matrix.buffer != NULL)
|
||||
{
|
||||
if (rowIdx < matrix.rows && colIdx < matrix.cols)
|
||||
{
|
||||
matrix.buffer[rowIdx * matrix.cols + colIdx] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||
{
|
||||
|
||||
if (matrix.buffer != NULL)
|
||||
{
|
||||
if (rowIdx < matrix.rows && colIdx < matrix.cols)
|
||||
{
|
||||
return matrix.buffer[rowIdx * matrix.cols + colIdx];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix add(const Matrix matrix1, const Matrix matrix2)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}.
|
||||
|
||||
void test_loadModelReturnsCorrectNumberOfLayers(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user