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
|
// 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
|
// TODO Vervollständigen Sie die Funktion readImages unter Benutzung Ihrer Hilfsfunktionen
|
||||||
GrayScaleImageSeries *readImages(const char *path)
|
GrayScaleImageSeries *readImages(const char *path)
|
||||||
{
|
{
|
||||||
|
|||||||
14
matrix.c
14
matrix.c
@ -7,13 +7,16 @@
|
|||||||
|
|
||||||
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||||
{
|
{
|
||||||
if (rows != 0 && cols != 0){
|
if (rows != 0 && cols != 0)
|
||||||
|
{
|
||||||
Matrix matrix;
|
Matrix matrix;
|
||||||
matrix.rows = rows;
|
matrix.rows = rows;
|
||||||
matrix.cols = cols;
|
matrix.cols = cols;
|
||||||
matrix.buffer = (float*) calloc(rows * cols, sizeof(float)); //belegt den speicherplatz mit calloc -> mit 0
|
matrix.buffer = (float*) calloc(rows * cols, sizeof(float)); //belegt den speicherplatz mit calloc -> mit 0
|
||||||
return matrix;
|
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");
|
printf("Nullgroesse der Matrix!!!\n");
|
||||||
Matrix matrix;
|
Matrix matrix;
|
||||||
matrix.rows = 0;
|
matrix.rows = 0;
|
||||||
@ -25,14 +28,13 @@ Matrix createMatrix(unsigned int rows, unsigned int cols)
|
|||||||
|
|
||||||
void clearMatrix(Matrix *matrix)
|
void clearMatrix(Matrix *matrix)
|
||||||
{
|
{
|
||||||
matrix->rows = 0;
|
free(matrix->buffer); //gibt den heap speicher frei
|
||||||
matrix->cols = 0;
|
matrix->buffer = NULL; //zeiger auf NULL setzen
|
||||||
matrix->buffer = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user