// FILE: sciLabReadImage0_1b.sce - Works
// DATE: 03/07/20 18:51
// AUTH: P.Oh
// VERS: 0.1a: simply display greyscale Lena image
//       0.1b: 0.1a but show value of pixel at desired location
// DESC: Goal: access image pixel data.  Start from basics

scicv_Init();
img = imread("M:\00courses\scilabVideo\8-bit-256-x-256-Grayscale-Lena-Image.png");
matplot(img);
disp("Number of Rows:");
disp(Mat_rows_get(img));
disp("Number of Columns:");
disp(Mat_cols_get(img));

// Extract the whole image
disp(img(:,:));

// Extract pixel value at (row, col) location (0,0)
disp(img(1:1,1:1)); // NB: Scilab begins image with (1,1,) rather than (0,0)

// Extract pixel value at (row, col) location (4,9)
disp(img(5:5, 10:10));
// NB: 3 identical values will be displayed for 1st, 2nd, and 3rd byte

delete_Mat(img);

