generated from freudenreichan/info2Praktikum-NeuronalesNetz
funktionen in image.c implementiert
This commit is contained in:
1 parent
2b84bdac23
commit
127f93301f
1 file changed
+30
-3
+30
-3
@@ -7,12 +7,38 @@
|
|||||||
#define FILE_HEADER_STRING "__info2_image_file_format__"
|
#define FILE_HEADER_STRING "__info2_image_file_format__"
|
||||||
|
|
||||||
// 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
|
||||||
static readNumberOfImages(const char *path, )
|
static unsigned short readNumberOfImages(const char *path)
|
||||||
{
|
{
|
||||||
GrayScaleImageSeries series;
|
unsigned short numberOfImages = 0;
|
||||||
fread(series.images, sizeof(unsigned short), 1, path);
|
fseek(path, sizeof(char)*strlen(FILE_HEADER_STRING)-1, SEEK_SET);
|
||||||
|
fread(numberOfImages, sizeof(unsigned short), 1, path);
|
||||||
|
return numberOfImages;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned short readImageWidth(const char *path)
|
||||||
|
{
|
||||||
|
unsigned short ImageWidth = 0;
|
||||||
|
fseek(path, sizeof(unsigned short), SEEK_CUR);
|
||||||
|
fread(ImageWidth, sizeof(unsigned short), 1, path);
|
||||||
|
return ImageWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned short readImageHeight(const char *path)
|
||||||
|
{
|
||||||
|
unsigned short ImageHeight = 0;
|
||||||
|
fseek(path, sizeof(unsigned short), SEEK_CUR);
|
||||||
|
fread(ImageHeight, sizeof(unsigned short), 1,path);
|
||||||
|
return ImageHeight;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static *readImage(const char *path, unsigned short ImageWidth, unsigned short ImageHeight)
|
||||||
|
{
|
||||||
|
fseek(path, sizeof(unsigned short), SEEK_CUR);
|
||||||
|
fread(path, sizeof(char), ImageHeight*ImageWidth, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
@@ -20,6 +46,7 @@ GrayScaleImageSeries *readImages(const char *path)
|
|||||||
FILE *file = fopen(path, "wb");
|
FILE *file = fopen(path, "wb");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
return series;
|
return series;
|
||||||
|
|||||||
Reference in new issue
Block a user