images_free + comments
This commit is contained in:
parent
e824d7fdea
commit
4453b4743e
1 changed files with 6 additions and 1 deletions
7
image.c
7
image.c
|
|
@ -20,19 +20,24 @@ Img** import_images(char* image_file_string, char* label_file_string, int number
|
||||||
}
|
}
|
||||||
|
|
||||||
void img_print (Img* img) {
|
void img_print (Img* img) {
|
||||||
|
|
||||||
//print the image
|
//print the image
|
||||||
matrix_print(img->pixel_values);
|
matrix_print(img->pixel_values);
|
||||||
//print the number of the image
|
//print the number of the image
|
||||||
printf("Number it is supposed to be: %d\n", img->image_label);
|
printf("Number it is supposed to be: %d\n", img->image_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void img_free (Img* img) {
|
void img_free (Img* img) {
|
||||||
|
//frees the matrix of image (deep free)
|
||||||
matrix_free(img->pixel_values);
|
matrix_free(img->pixel_values);
|
||||||
|
//frees the rest of img
|
||||||
free(img);
|
free(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
void images_free (Img** images, int quantity){
|
void images_free (Img** images, int quantity){
|
||||||
|
//frees every single image
|
||||||
for(int i=0;i<quantity;i++){
|
for(int i=0;i<quantity;i++){
|
||||||
img_free(images[i]);
|
img_free(images[i]);
|
||||||
}
|
}
|
||||||
|
//frees the rest of images
|
||||||
free(images);
|
free(images);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue