-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBilinearInterpolationClass.h
51 lines (39 loc) · 1.6 KB
/
BilinearInterpolationClass.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
#ifndef BILINEARINTERPOLATIONCLASS_H
#define BILINEARINTERPOLATIONCLASS_H
#include <iostream>
#include "math.h"
#include <cmath>
#include <QDebug>
struct Position {
int XPixelPos;
int YPixelPos;
Position():XPixelPos(-1), YPixelPos(-1){}
Position(int X, int Y):XPixelPos(X), YPixelPos(Y){}
Position(const Position& position_):XPixelPos(position_.XPixelPos), YPixelPos(position_.YPixelPos){}
};
class BilinearInterpolationClass
{
public:
BilinearInterpolationClass (const BilinearInterpolationClass&) = delete;
BilinearInterpolationClass& operator=(const BilinearInterpolationClass&) = delete;
static BilinearInterpolationClass* getInstance(double* image_, int width_);
void release();
double GetBilinearInterpolatedPixelValue(double colPixel, double rowPixel);
private:
BilinearInterpolationClass();
BilinearInterpolationClass(double *image_, int width_);
static BilinearInterpolationClass* bilinearInterpolation;
~BilinearInterpolationClass();
double* image;
int width;
double colPixel, rowPixel;
double* pixelWeight;
Position* position;
void GetNeighbouringPixelPositionAndWeight();
double GetPixelValueByInterpolation();
double GetIntermediatePixelValueByInterpolation(double influenceOfPixel1, double influenceOfPixel2,
double pixel1Weight, double pixel2Weight);
void GetPixelWeight(const Position& pixelPosition, double* pixelWeight);
int GetPixelPositionForEdges(int currentPixel, int edgesize);
};
#endif // BILINEARINTERPOLATIONCLASS_H