generated from freudenreichan/info2Praktikum-NeuronalesNetz
added some more comments
This commit is contained in:
parent
4e2dd7b4d4
commit
7d30feef54
@ -46,7 +46,7 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
}
|
||||
actualFileTag[strlen(FILE_HEADER_STRING)] = '\0';
|
||||
|
||||
// checks if the files are equal: strcmp should return '0' --> convert it to '1' for 'true'
|
||||
// checks if the files are equal
|
||||
int fileTagEqual = strcmp(actualFileTag, FILE_HEADER_STRING);
|
||||
|
||||
//we only need the fileTag to verify its an image for our series.
|
||||
@ -54,6 +54,7 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
actualFileTag = NULL;
|
||||
|
||||
|
||||
//only if equal, the method continues
|
||||
if (fileTagEqual == 0) {
|
||||
numberOfImages = getCharValueFromFile(openFile);
|
||||
|
||||
@ -73,16 +74,12 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
}
|
||||
|
||||
//all the starting parameters are set --> the images can be read and stored
|
||||
// GrayScaleImage* images = malloc(numberOfImages * sizeof(GrayScaleImage));
|
||||
// unsigned char* labels = malloc(numberOfImages * sizeof(unsigned char));
|
||||
series = malloc(sizeof(GrayScaleImageSeries));
|
||||
|
||||
series->count = 0;
|
||||
series->images = malloc(numberOfImages * sizeof(GrayScaleImage));
|
||||
series->labels = malloc(numberOfImages * sizeof(unsigned char));
|
||||
|
||||
printf(" %d , %d , %d \n", width, height, numberOfImages);
|
||||
|
||||
for (int i = 0; i < numberOfImages; i++) {
|
||||
series->images[i].height = height;
|
||||
series->images[i].width = width;
|
||||
@ -98,6 +95,7 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
// the fclose happens here, since every other path closes the file. beforehand
|
||||
fclose (openFile);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user