// FILE: sciLabTracking0_1b.sce - Works!
// DATE: 03/12/20 18:54
// AUTH: P.Oh
// VERS: 0.1a: copied from Scilab help example
//       0.1b: use insight from sciLabReadImage0_1b.sce to report pixel value
// DESC: Goal: Find object in an image.

scicv_Init();
img = imread("M:\00courses\scilabVideo\puffin.png");
img_template = imread(getSampleImage("puffin_pattern.png"));
// matplot(img_template);

img_result = matchTemplate(img, img_template, CV_TM_SQDIFF_NORMED)

gcf().color_map = graycolormap(255);
colorbar(0, 255);

img_out = normalize(img_result, 0, 255, NORM_MINMAX);

matplot(img_out);
disp("img_result(1,1) =");
disp(img_result(1:1, 1:1)); // display pixel value at (1,1)

disp("img_result 2 first rows and columns values = ");
disp(img_result(1:2, 1:2));

disp("img_result: entire");
disp(img_result(:,:));

delete_Mat(img);
delete_Mat(img_template);
delete_Mat(img_result);


