Commit d32a185438809d84d23c787b95151e276ae49f1c
1 parent
081f2c9f
added framework for image class (to encapsulate saving/loading images)
Showing
2 changed files
with
40 additions
and
0 deletions
Show diff stats
CImg/CImg.h renamed to image/CImg.h
1 | +#ifndef STIM_IMAGE_H | ||
2 | +#define STIM_IMAGE_H | ||
3 | + | ||
4 | +#include <iostream> | ||
5 | +//This static class provides the STIM interface for loading images | ||
6 | +// Use this interface for all image management - that way the actual library can be changed without problems | ||
7 | + | ||
8 | +//currently this interface uses CImg | ||
9 | +// T = data type (usually unsigned char) | ||
10 | +template <class T> | ||
11 | +class image{ | ||
12 | + | ||
13 | + CImg<T> data; | ||
14 | + | ||
15 | +public: | ||
16 | + | ||
17 | + //Load an image from a file | ||
18 | + void load(std::string filename){ | ||
19 | + data.load(filename.c_str()); | ||
20 | + } | ||
21 | + | ||
22 | + //save a file | ||
23 | + void save(std::string filename){ | ||
24 | + data.save(filename.c_str()); | ||
25 | + } | ||
26 | + | ||
27 | + //create an image from an interlaced buffer | ||
28 | + void create_interlaced(T* buffer, unsigned int channels = 1){ | ||
29 | + | ||
30 | + | ||
31 | + } | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | +}; | ||
38 | + | ||
39 | + | ||
40 | +#endif |