-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMosaitImg.h
73 lines (67 loc) · 1.8 KB
/
MosaitImg.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Mosait by Tangui Morlier
* Under GPLv3
*/
#ifndef MOSAIT_IMG
#define MOSAIT_IMG
#include "MosaitCommon.h"
#include "MosaitPixel.h"
#include <vector>
#include <jerror.h>
#ifdef _MSC_VER
#ifdef BUILDING_DLL
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#define DLLLOCAL
#else
#ifdef HAVE_GCCVISIBILITYPATCH
#define DLLEXPORT __attribute__ ((visibility("default")))
#define DLLLOCAL __attribute__ ((visibility("hidden")))
#else
#define DLLEXPORT
#define DLLLOCAL
#endif
#endif
extern "C" DLLEXPORT void function(int a);
class DLLEXPORT MosaitImg
{
public:
MosaitImg(string & file);
MosaitImg(fipImage & image) ;
// MosaitImg(fipImage::fipImage image) ;
MosaitImg(int size_x, int size_y);
MosaitImg();
string getFileName();
inline float getDistance() const {
return distance;
}
/* inline bool equal(const MosaitImg& i) const{
return operator==(i);
}
*/
inline bool operator==(const MosaitImg& i) const{
// cout << "operator== on Img\n";
return i.pixels == pixels;
};
inline bool operator<(const MosaitImg& i ) const {
cerr << "operator< on Img\n";
return i.pixels < pixels;
};
friend std::ostream& operator<<(std::ostream& os, MosaitImg mi);
friend istream & operator >>(istream &ins, MosaitImg & mi);
static bool compareByDistance(const MosaitImg &i1, const MosaitImg &i2);
float getDistanceWith(const MosaitImg & img, bool withlight = 1) const;
void setDistanceWith(const MosaitImg & img, bool withlight = 1);
void setAverage(const vector<MosaitImg> images);
inline void incrUsed() { nb_used ++ ; };
inline int getNbUsed() const {return nb_used;};
private:
string filename;
vector<MosaitPixel> pixels;
float distance;
void init(fipImage & image) ;
int nb_used;
};
#endif