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