// FILE: scilabTrackingLego0_1a.sce - Works!
// DATE: 03/30/20 13:12
// AUTH: P.Oh
// VERS: 0_1a: Initial test using 640x480 thresholded image and 71x70 template
//       1_0b: same as 1_0a but with L-shaped black pixels
// DESC: Goal: SSD tracking of Lego cross piece from thesholded Lego USB cam image
// REFS: sciLabTracking1_0b.sce

scicv_Init();
img = imread("M:\00courses\scilabVideo\thresholdedFrame.png");
img_template = imread("crossTemplate.png");
img_result = matchTemplate(img, img_template, CV_TM_SQDIFF); // 0 = match

disp("Result: number of Rows:");
disp(Mat_rows_get(img_result));
disp("Result: number of Columns:");
disp(Mat_cols_get(img_result));
/* uncomment if wish to all values
disp("img_result: entire");
disp(img_result(:,:));
*/
[min_value, max_value, min_value_loc, max_value_loc] = minMaxLoc(img_result)
disp("min_value =");
disp(min_value);
disp("location in image:")
disp(min_value_loc);

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


