-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.h
68 lines (52 loc) · 1.35 KB
/
models.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
#ifndef MODELS_H
#define MODELS_H
#ifdef _CH_
#pragma package <opencv>
#endif
#define CV_NO_BACKWARD_COMPATIBILITY
#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#endif
typedef struct _options
{
std::string method;
int iterations;
float var;
bool add_noise;
} options;
template<class T> class Image
{
public:
IplImage* imgp;
Image(IplImage* img=0) {imgp=img;}
~Image(){imgp=0;}
void operator=(IplImage* img) {imgp=img;}
inline T* operator[](const int rowIndx) {
return ((T *)(imgp->imageData + rowIndx*imgp->widthStep));}
};
typedef struct{
unsigned char b,g,r;
} RgbPixel;
typedef struct{
float b,g,r;
} RgbPixelFloat;
typedef Image<RgbPixel> RgbImage;
typedef Image<RgbPixelFloat> RgbImageFloat;
typedef Image<unsigned char> BwImage;
typedef Image<float> BwImageFloat;
typedef Image<double> BwImageDouble;
double psnr(IplImage*, IplImage*);
// non-convex
void non_convex(IplImage*, IplImage*, int);
// nlm-naive
CvMat *cvGaussianKernel(int, float);
float cvGaussianWeightedDistance(CvMat*, IplImage *, IplImage *);
void cvGetSubImage(IplImage*, IplImage*, CvRect);
void nlm_naive(IplImage*, IplImage*);
// nlm-mean
template<class T> T si_sum(Image<T>, int, int, int);
void nlm_mean(IplImage*, IplImage*);
// noise
void addGaussianNoise(IplImage*, IplImage*, double, double);
#endif /* MODELS_H */