% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    MPOV - uloha 8a - pasivni triangulace
%
%
%    - kalibrace kamer, zjisteni parametru
%
%
%    verze: 9-2019 / midas.uamt.feec.vutbr.cz
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% uklid
clear all;
close all;
clc;

%% index kamery
cam_ID1 = 1;
cam_ID2 = 2;

%% video stream
camera1 = videoinput('winvideo',cam_ID1);
camera1.ReturnedColorSpace = 'grayscale';
prop1  = getselectedsource(camera1);
prop1.ExposureMode = 'manual';
prop1.Exposure = -3;
prop1.Gain = 260;


camera2 = videoinput('winvideo',cam_ID2);
camera2.ReturnedColorSpace = 'grayscale';
prop2  = getselectedsource(camera2);
prop2.ExposureMode = 'manual';
prop2.Exposure = -3;
prop2.Gain = 260;

%% nahledy z kamer
preview(camera1);
preview(camera2);
pause(1);
pause


%% porizeni snimku

img1 = getsnapshot(camera1);

img2 = getsnapshot(camera2);

figure(3)
imshow(img1);
title('Kamera 1')
figure(4)
imshow(img2);
title('Kamera 2')

%% ukonceni prace s kamerami
closepreview(camera1);
closepreview(camera2);

% ZACNETE PROGRAMOVAT ZDE >>>
% ... doplnte vypocty