found potential mistake in imageTesting function
This commit is contained in:
parent
cddd141ea6
commit
c937323342
@ -29,14 +29,15 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
/*
|
||||
char curChar = 0;
|
||||
int i = 0;
|
||||
*/
|
||||
|
||||
|
||||
// dieses print(hier) wird nur einmal aufgerufen,
|
||||
// der zweite test schafft es also nicht readImages
|
||||
// korrekt aufzurufen!!!!!
|
||||
printf("hier\n");
|
||||
*/
|
||||
readSource = fopen(path, "rb");
|
||||
|
||||
|
||||
if (readSource != NULL)
|
||||
{
|
||||
/*
|
||||
@ -64,11 +65,9 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
|
||||
readImagedata(readSource, series->images->buffer, series->labels, series->count, numberOfBytesToRead);
|
||||
|
||||
fclose(readSource);
|
||||
}
|
||||
|
||||
fclose(readSource);
|
||||
|
||||
|
||||
return series;
|
||||
}
|
||||
|
||||
|
||||
@ -8,20 +8,21 @@
|
||||
|
||||
static void prepareImageFile(const char *path, unsigned short int width, unsigned short int height, unsigned int short numberOfImages, unsigned char label)
|
||||
{
|
||||
printf("hier7\n");
|
||||
FILE *file = fopen(path, "wb");
|
||||
|
||||
printf("hier8\n");
|
||||
|
||||
if(file != NULL)
|
||||
{
|
||||
const char *fileTag = "__info2_image_file_format__";
|
||||
GrayScalePixelType *zeroBuffer = (GrayScalePixelType *)calloc(numberOfImages * width * height, sizeof(GrayScalePixelType));
|
||||
|
||||
if(zeroBuffer != NULL)
|
||||
{
|
||||
fwrite(fileTag, sizeof(fileTag[0]), strlen(fileTag), file);
|
||||
fwrite(&numberOfImages, sizeof(numberOfImages), 1, file);
|
||||
fwrite(&width, sizeof(width), 1, file);
|
||||
fwrite(&height, sizeof(height), 1, file);
|
||||
|
||||
|
||||
for(int i = 0; i < numberOfImages; i++)
|
||||
{
|
||||
fwrite(zeroBuffer, sizeof(GrayScalePixelType), width * height, file);
|
||||
@ -30,7 +31,7 @@ static void prepareImageFile(const char *path, unsigned short int width, unsigne
|
||||
|
||||
free(zeroBuffer);
|
||||
}
|
||||
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
@ -134,6 +135,7 @@ int main()
|
||||
printf("\n============================\nImage input tests\n============================\n");
|
||||
RUN_TEST(test_readImagesReturnsCorrectNumberOfImages);
|
||||
RUN_TEST(test_readImagesReturnsCorrectImageWidth);
|
||||
printf("hier4\n");
|
||||
RUN_TEST(test_readImagesReturnsCorrectImageHeight);
|
||||
RUN_TEST(test_readImagesReturnsCorrectLabels);
|
||||
RUN_TEST(test_readImagesReturnsNullOnNotExistingPath);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user