-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathImageIO.h
56 lines (43 loc) · 1.35 KB
/
ImageIO.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* ___ _ _ ___ _ __ __ _ ___
* / __| | | | \ /_\ | \/ | /_\ | _ \
* | (__| |_| | |) / _ \ | |\/| |/ _ \| _/
* \___|\___/|___/_/_\_\_|_|__|_/_/_\_\_|_ ___
* / __| | | | _ \ __| _ \___| _ \ __/ __|
* \__ \ |_| | _/ _|| /___| / _|\__ \
* |___/\___/|_| |___|_|_\ |_|_\___|___/
* 2012
*
* by Jens Wetzl ([email protected])
* and Oliver Taubmann ([email protected])
*
* This work is licensed under a Creative Commons
* Attribution 3.0 Unported License. (CC-BY)
* http://creativecommons.org/licenses/by/3.0/
*
**/
#ifndef IMAGE_IO_H
#define IMAGE_IO_H
#include <FreeImage.h>
typedef FIBITMAP* ImagePtr;
#include <string>
// Some utility functions for image IO using FreeImage
// (-> http://freeimage.sourceforge.net/).
struct ImageDims
{
ImageDims(ImagePtr img)
: width (FreeImage_GetWidth (img))
, height(FreeImage_GetHeight(img))
{}
const size_t width;
const size_t height;
};
class ImageIO
{
public:
static ImagePtr loadGrayscaleImage(const char *filename);
static void saveGPUImage(const std::string &filename, const float *d_image,
const size_t width, const size_t height, const size_t ld);
static float *uploadImage(const ImagePtr &img, size_t &width, size_t &height, size_t &ld);
};
#endif // IMAGE_IO_H