fixed imagaInput() it now passes all tests . . . again
This commit is contained in:
parent
4cb06d2951
commit
51a71ba61f
19
imageInput.c
19
imageInput.c
@ -66,7 +66,7 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
|
|
||||||
// reallocate memory so that each image width can be saved seperately
|
// reallocate memory so that each image width can be saved seperately
|
||||||
//series->images = realloc(series->images, (series->count * (2 * sizeof(unsigned int) + sizeof(headerString))));
|
//series->images = realloc(series->images, (series->count * (2 * sizeof(unsigned int) + sizeof(headerString))));
|
||||||
for (int i = 1; i < series->count; i++)
|
for (int i = 0; i < series->count; i++)
|
||||||
{
|
{
|
||||||
series->images[i].buffer = calloc(numberOfBytesToRead, sizeof(unsigned char));
|
series->images[i].buffer = calloc(numberOfBytesToRead, sizeof(unsigned char));
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ void clearSeries(GrayScaleImageSeries * series)
|
|||||||
printf("width: %d, height: %d\n", series->images[i].width, series->images[i].height);
|
printf("width: %d, height: %d\n", series->images[i].width, series->images[i].height);
|
||||||
// */
|
// */
|
||||||
// /*
|
// /*
|
||||||
if (i >= 1)
|
if (i >= 0)
|
||||||
{
|
{
|
||||||
for (j = 0; j < series->images[i].width * series->images[i].height; j++)
|
for (j = 0; j < series->images[i].width * series->images[i].height; j++)
|
||||||
{
|
{
|
||||||
@ -263,9 +263,9 @@ void readImagedata(FILE *const source, GrayScaleImageSeries *const series, int c
|
|||||||
// geht: &(series->images->buffer[0]) +i*36)
|
// geht: &(series->images->buffer[0]) +i*36)
|
||||||
// geht nicht: &series->images[i].buffer
|
// geht nicht: &series->images[i].buffer
|
||||||
// printf("amountToRead: %d\n", amountToRead);
|
// printf("amountToRead: %d\n", amountToRead);
|
||||||
/* numbreadbuffer =*/ fread(&series->images[i].buffer[0], 1, amountToRead, source);
|
/* numbreadbuffer = */ fread(&series->images[i].buffer[0], 1, amountToRead, source);
|
||||||
|
|
||||||
/*
|
// /*
|
||||||
if (feof(source))
|
if (feof(source))
|
||||||
{
|
{
|
||||||
printf("EOF!! buffer\n");
|
printf("EOF!! buffer\n");
|
||||||
@ -276,8 +276,8 @@ void readImagedata(FILE *const source, GrayScaleImageSeries *const series, int c
|
|||||||
}
|
}
|
||||||
// */
|
// */
|
||||||
|
|
||||||
/*numbreadlabel =*/ fread(&series->labels[i], sizeof(*series->images->buffer), sizeof(*series->labels), source);
|
/* numbreadlabel = */ fread(&series->labels[i], sizeof(*series->images->buffer), sizeof(*series->labels), source);
|
||||||
/*
|
// /*
|
||||||
if (feof(source))
|
if (feof(source))
|
||||||
{
|
{
|
||||||
printf("EOF!!\n label");
|
printf("EOF!!\n label");
|
||||||
@ -286,17 +286,18 @@ void readImagedata(FILE *const source, GrayScaleImageSeries *const series, int c
|
|||||||
{
|
{
|
||||||
printf("ERROR!!! label\n");
|
printf("ERROR!!! label\n");
|
||||||
}
|
}
|
||||||
|
// */
|
||||||
|
/*
|
||||||
printf("numbreadbuffer: %d\n", numbreadbuffer);
|
printf("numbreadbuffer: %d\n", numbreadbuffer);
|
||||||
printf("numbreadlabel: %d\n", numbreadlabel);
|
printf("numbreadlabel: %d\n", numbreadlabel);
|
||||||
|
|
||||||
printf("label %d: %d\n", i, series->labels[i]);
|
printf("label %d: %d\n", i, series->labels[i]);
|
||||||
|
// */
|
||||||
// fread(&(series->labels[i]), sizeof(*series->images->buffer), sizeof(*series->labels), source);
|
// fread(&(series->labels[i]), sizeof(*series->images->buffer), sizeof(*series->labels), source);
|
||||||
|
|
||||||
|
|
||||||
// print complete imagebuffer
|
// print complete imagebuffer
|
||||||
|
/*
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for (int j = 0; j < amountToRead; j++)
|
for (int j = 0; j < amountToRead; j++)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user