This repository has been archived by the owner on Nov 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
PhotometricStero.h
executable file
·75 lines (68 loc) · 2.42 KB
/
PhotometricStero.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
74
75
#ifndef PCVASSIGNMENT1_PHOTOMETRICSTERO_H_
#define PCVASSIGNMENT1_PHOTOMETRICSTERO_H_
#include <string>
#include <vector>
#include <opencv2\core\core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include "PFMAccess.h"
namespace phoSte {
struct circle {
circle(double x = 0, double y = 0, double r = 0): mCenterX(x), mCenterY(y), mR(r) {
}
double mCenterX;
double mCenterY;
double mR;
};
struct light {
light(double x, double y, double z): mx(x), my(y), mz(z) {
}
double mx;
double my;
double mz;
double mIntensity;
};
class photometryStero {
public:
// fill the imageNames and maskNames
// use image with euqal distance
photometryStero(int n, int startI, int endI, std::string path,
std::string metal1Phere1Name, std::string metal2Phere1Name,
std::string lambertPhereName, std::string objectName, double discardRatio = 0.1);
photometryStero(const photometryStero&) = delete;
photometryStero& operator = (const photometryStero&) = delete;
~photometryStero();
bool readImage(); // read the images and masks according to the ImageNames
void getLightInformation(const int metalIndex, const int lambIndex);
void getPixelNormAndAlbedo(const int objectIndex);
cv::Mat outputNormalImage(int objectIndex);
cv::Mat outputAlbedoImage(int objectIndex);
cv::Mat outputNormalWithAlbedo(int objectIndex);
cv::Mat getHeightMap(int mode, double parameter);
// below are functions for test
//
void outputImage();
// build one mask with size*size in the middle to test the N;
void addSmallMaskForObject(int size, int midX, int midY);
private:
const int imageNum; // the num of images used to calculate;
std::vector<std::string> mImageNames; // the name of images
std::vector<std::string> mMaskNames; // the name of mask
std::vector<cv::Mat> mp2Images;
std::vector<cv::Mat> mp2Mask;
// when the PFMACCess destructs, the data will be destroyed
// so it's very dangerous, it should not be copied
std::vector<CPFMAccess*> mImageStorage;
// tht circle data for the metalSphere
phoSte::circle m_metalSphere;
phoSte::circle m_lambSpere;
std::vector<phoSte::light> m_light;
cv::Mat mN;
cv::Mat mAlbedo;
std::vector<int> mObjectX;
std::vector<int> mObjectY;
std::vector<int> mInvalidIndex;
const double mDiscardRatio;
};
}
#endif