matrix.c: clear matrix gemacht
imageInput.c: verusch, kein plan ob das stimmt
This commit is contained in:
parent
e326600ab6
commit
0e501b7e4e
@ -8,6 +8,9 @@
|
||||
|
||||
// TODO Implementieren Sie geeignete Hilfsfunktionen für das Lesen der Bildserie aus einer Datei
|
||||
|
||||
FILE *fopen(const char *'/Users/niklaskegelmann/Desktop/Uni/3. Semester /I2/Praktikum/Neuronales_Netz/Start_Mac', const char *"r");
|
||||
|
||||
|
||||
// TODO Vervollständigen Sie die Funktion readImages unter Benutzung Ihrer Hilfsfunktionen
|
||||
GrayScaleImageSeries *readImages(const char *path)
|
||||
{
|
||||
|
||||
12
matrix.c
12
matrix.c
@ -7,13 +7,16 @@
|
||||
|
||||
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||
{
|
||||
if (rows != 0 && cols != 0){
|
||||
if (rows != 0 && cols != 0)
|
||||
{
|
||||
Matrix matrix;
|
||||
matrix.rows = rows;
|
||||
matrix.cols = cols;
|
||||
matrix.buffer = (float*) calloc(rows * cols, sizeof(float)); //belegt den speicherplatz mit calloc -> mit 0
|
||||
return matrix;
|
||||
}else{ //Bei einer "falschen" Matrix eine leere zurückgeben, ohne speicher zu belegen
|
||||
}
|
||||
else
|
||||
{ //Bei einer "falschen" Matrix eine leere zurückgeben, ohne speicher zu belegen
|
||||
printf("Nullgroesse der Matrix!!!\n");
|
||||
Matrix matrix;
|
||||
matrix.rows = 0;
|
||||
@ -25,9 +28,8 @@ Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||
|
||||
void clearMatrix(Matrix *matrix)
|
||||
{
|
||||
matrix->rows = 0;
|
||||
matrix->cols = 0;
|
||||
matrix->buffer = NULL;
|
||||
free(matrix->buffer); //gibt den heap speicher frei
|
||||
matrix->buffer = NULL; //zeiger auf NULL setzen
|
||||
}
|
||||
|
||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user