forked from baidut/LECARM
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CameraModel.m
43 lines (33 loc) · 937 Bytes
/
CameraModel.m
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
classdef CameraModel < matlab.mixin.Heterogeneous % & handle
properties (Abstract)
param
end
properties
name
end
methods (Abstract)
B = crf(this, E)
end
methods (Access = public)
function this = CameraModel(param)
if exist('param', 'var')
this.param = param;
end
s = strsplit(class(this), '.');
this.name = s{end};
end
function this = setParam(this, param)
this.param = param;
end
function B1 = btf(this, B0, k)
B1 = this.crf(k .* this.crf_inv(B0));
end
function E = crf_inv(this, B)
idx = linspace(0,1,1024);
e = idx;
b = this.crf(e);
E = interpn(b, e, B(:), 'spline');
E = reshape(E, size(B));
end
end
end