-
Notifications
You must be signed in to change notification settings - Fork 0
/
M_SensorPlacement.m
44 lines (34 loc) · 1.32 KB
/
M_SensorPlacement.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
44
%%
function [FrameTrans, FrameRot] = M_SensorPlacement(colorVid, frame, params)
if exist('frame', 'var')==0
display('Can Not Place Axis Without Calibration');
else
noPic = 1;
while noPic == 1
display('Ready to detect Central Frame. Press Any Key to Continue...');
pause
start([colorVid]);
trigger(colorVid);
[f, time, meta] = getdata(colorVid);
stop([colorVid]);
%Flips left and right to give real view with fliplr
frame = cat(4,frame, fliplr(f));
% frame = f;
display('Central Frame Captured. Estimating...');
[imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(frame);
squareSize = 25.125;
worldPoints = generateCheckerboardPoints(boardSize, squareSize);
[params, imagesUsed, ~] = estimateCameraParameters(imagePoints, worldPoints);
if imagesUsed(end)==0
display('Poor image for frame reference. Please take again');
else
FrameRot = params.RotationMatrices(:,:,end);
FrameTrans = params.TranslationVectors(end,:);
noPic = 0;
end
end
%Assumes there is 3 or more photos
% l = length(params.TranslationVectors);
% FrameTrans = params.TranslationVectors;%(l,:,:);
% FrameRot = params.RotationVectors(l,:,:);
end