fixed bracketplacement in imageInput.c
This commit is contained in:
parent
4999631b9e
commit
ed1191fffd
@ -29,8 +29,8 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
|
|
||||||
if (readSource != NULL)
|
if (readSource != NULL)
|
||||||
{
|
{
|
||||||
series = calloc(sizeof(unsigned int) + 3* sizeof(headerString), amountOfStatusInfoToRead);
|
series = calloc(3 * sizeof(unsigned int) + 3*sizeof(headerString), amountOfStatusInfoToRead);
|
||||||
series->images = calloc(2*sizeof(unsigned int) + sizeof(headerString), amountOfStatusInfoToRead);
|
series->images = calloc(2 * sizeof(unsigned int) + sizeof(headerString), amountOfStatusInfoToRead);
|
||||||
|
|
||||||
numberOfBytesToRead = readStatusInfo(readSource, series, headerString, sizeOfStausInfoElementsInBytes, amountOfStatusInfoToRead);
|
numberOfBytesToRead = readStatusInfo(readSource, series, headerString, sizeOfStausInfoElementsInBytes, amountOfStatusInfoToRead);
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
if (expectedHeader)
|
if (expectedHeader)
|
||||||
{
|
{
|
||||||
// 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 loop was previously running with i < series->count, wich caused programm to crash.
|
// for loop was previously running with i < series->count, wich caused programm to crash.
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < series->count; i++)
|
||||||
{
|
{
|
||||||
series->images[i].width = series->images->width;
|
series->images[i].width = series->images->width;
|
||||||
series->images[i].height = series->images->height;
|
series->images[i].height = series->images->height;
|
||||||
|
|||||||
@ -170,7 +170,7 @@ NeuralNetwork loadModel(const char *path)
|
|||||||
|
|
||||||
static Matrix imageBatchToMatrixOfImageVectors(const GrayScaleImage images[], unsigned int count)
|
static Matrix imageBatchToMatrixOfImageVectors(const GrayScaleImage images[], unsigned int count)
|
||||||
{
|
{
|
||||||
Matrix matrix = {NULL, 0, 0};
|
Matrix matrix = {/*NULL,*/ 0, 0, NULL};
|
||||||
|
|
||||||
if(count > 0 && images != NULL)
|
if(count > 0 && images != NULL)
|
||||||
{
|
{
|
||||||
@ -180,6 +180,7 @@ static Matrix imageBatchToMatrixOfImageVectors(const GrayScaleImage images[], un
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < count; i++)
|
for(int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
printf("i %d\n", i);
|
||||||
for(int j = 0; j < images[i].width * images[i].height; j++)
|
for(int j = 0; j < images[i].width * images[i].height; j++)
|
||||||
{
|
{
|
||||||
setMatrixAt((MatrixType)images[i].buffer[j], matrix, j, i);
|
setMatrixAt((MatrixType)images[i].buffer[j], matrix, j, i);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user