forked from mw-shiremat/MATLAB-Demo-ADI-ToF
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GrabCheckerBoardImages.m
49 lines (42 loc) · 1.5 KB
/
GrabCheckerBoardImages.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
45
46
47
48
49
%% This script is for Grabbing Checkboard Calibration Images using the
%% ADI ToF Camera
imaqreset;
%% Run this only if the 'aditofadapter' adapter is not present
% You need to update the location of the DLL as appropriate for your
% setup.
%imaqregister('c:\work\demos\ADI\aditofadapter.dll');
%% Open a connection to the ADI ToF camera. Be careful to not delete this
% You cannot open a second connection to the camera. You must close this
% connection before you can open another one. Be careful not to delete this
% variable. Also make sure to update the IP address as appropriate for
% your setup.
CamVid = videoinput('aditofadapter', 'ToF Ethernet Device', '169.254.77.142');
%%
src = getselectedsource (CamVid);
src.FrameType = 'Ir';
src.CameraMode = 'Far';
% Now wait until depthVid shows up in the workspace before moving on to the
% next code section.
%% Grab image
start(CamVid);
pause(2); % need a bit of delay before getting a good image
image = getsnapshot(CamVid);
figure;imshow(image);
stop(CamVid);
%% Grab images
start(CamVid);
pause(1); % need a bit of delay before getting a good image
image = getsnapshot(CamVid);
figure;imshow(image);
pause(2)
for i=26:50 % Put your hand in front of the camera for a bit
pause(2)
image = getsnapshot(CamVid);
imshow(image);
drawnow
filename = ['calibration\checkboard' num2str(i,'%03d') '.png']
imwrite(image,filename);
end
stop(CamVid);
%%
delete(CamVid);