forked from freudenreichan/info2Praktikum-NeuronalesNetz
Fehler gefunden und Ausgebessert
This commit is contained in:
parent
545acd0356
commit
c476386ff3
10
imageInput.c
10
imageInput.c
@ -46,9 +46,9 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
return NULL;
|
||||
}
|
||||
unsigned short image_count, width, height;
|
||||
fread(&image_count,1,sizeof(unsigned short),datei);
|
||||
fread(&width,1,sizeof(unsigned short),datei);
|
||||
fread(&height,1,sizeof(unsigned short),datei);
|
||||
fread(&image_count,sizeof(unsigned short),1,datei);
|
||||
fread(&width,sizeof(unsigned short),1,datei);
|
||||
fread(&height,sizeof(unsigned short),1,datei);
|
||||
//printf("%u Bilder und %u mal %u",image_count,width,height);
|
||||
GrayScaleImageSeries *series = NULL;
|
||||
series = malloc(sizeof(GrayScaleImageSeries));
|
||||
@ -57,6 +57,8 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
series->labels = malloc(image_count*sizeof(unsigned char));
|
||||
for(unsigned short i = 0;i<image_count;i++)
|
||||
{
|
||||
series->images[i].width = width;
|
||||
series->images[i].height = height;
|
||||
series->images[i].buffer = malloc(width*height);
|
||||
}
|
||||
for(unsigned short i = 0;i<image_count;i++)
|
||||
@ -94,4 +96,4 @@ void clearSeries(GrayScaleImageSeries *series)
|
||||
printf("Serie freigegeben\n");
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ void test_readImagesReturnsCorrectImageWidth(void)
|
||||
GrayScaleImageSeries *series = NULL;
|
||||
const unsigned short expectedWidth = 10;
|
||||
const char *path = "testFile.info2";
|
||||
prepareImageFile(path, 8, expectedWidth, 2, 1);
|
||||
prepareImageFile(path, expectedWidth, 8, 2, 1);
|
||||
series = readImages(path);
|
||||
TEST_ASSERT_NOT_NULL(series);
|
||||
TEST_ASSERT_NOT_NULL(series->images);
|
||||
@ -70,7 +70,7 @@ void test_readImagesReturnsCorrectImageHeight(void)
|
||||
GrayScaleImageSeries *series = NULL;
|
||||
const unsigned short expectedHeight = 10;
|
||||
const char *path = "testFile.info2";
|
||||
prepareImageFile(path, expectedHeight, 8, 2, 1);
|
||||
prepareImageFile(path,8, expectedHeight, 2, 1);
|
||||
series = readImages(path);
|
||||
TEST_ASSERT_NOT_NULL(series);
|
||||
TEST_ASSERT_NOT_NULL(series->images);
|
||||
|
||||
13
main.c
13
main.c
@ -1,13 +1,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "imageInput.h"
|
||||
//#include "mnistVisualization.h"
|
||||
//#include "neuralNetwork.h"
|
||||
#include "mnistVisualization.h"
|
||||
#include "neuralNetwork.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
readImages("mnist_test.info2");
|
||||
/*
|
||||
//readImages("mnist_test.info2");
|
||||
|
||||
const unsigned int windowWidth = 800;
|
||||
const unsigned int windowHeight = 600;
|
||||
|
||||
@ -67,5 +68,5 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
return exitCode;
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user