-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalib_function.m
More file actions
54 lines (42 loc) · 1.36 KB
/
Copy pathcalib_function.m
File metadata and controls
54 lines (42 loc) · 1.36 KB
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
function [T]=calib_function(calibpoints)
%%% Calib point for DMD
%% 1 : 350 412
%% 2 : 350 662
%% 3 : 400 662
%%
if nargin >= 1
calibpoints = calibpoints;
else
calibpoints = [412 350 1; 662 350 1 ; 662 400 1]';
end
supportedtypes={'*.png','PNG Files'; '*.bmp','BMP Files'};
currentFolder = pwd;
[fname,pname,typeind]=uigetfile(supportedtypes,'Choose Calibration image',currentFolder);
info = imfinfo([pname,fname]);
height= info(1).Height;
width=info(1).Width;
F = imread(fullfile(pname, fname));
[m,n,o] = size(F);
figure;
img = imagesc(log(double(F)));
colormap(gray);
title('Choose reference points in right order');
pts=ginput_modified(3);
x=round(pts(:,1)); y=round(pts(:,2));
pause(0.7);
d=30;
for k=1:3
set(gca,'ylim',[y(k)-d y(k)+d]);
set(gca,'xlim',[x(k)-d x(k)+d]);
title(sprintf('Point #%d - zoom',k));
pts1=ginput_modified(1);
x1(k)=pts1(1,1);
y1(k)=pts1(1,2);
end
campoints = [x1; y1; [1, 1, 1]];
T = calibpoints*inv(campoints);
T(3,:) = [0 0 1];
sintheta = 0.5*(-T(1,2) + T(2,1));
T (1,2) = -sintheta;
T(2,1) = sintheta;
close;