function pred_coordinates = image_test1(tree, thresh, test_file, corners)
% This function is in particular designed for testing
% the images of the training and testing datasets.


disp(['Testing image ' test_file ' ...']);
load(corners);
[img,map] = imread(test_file);
f = figure;
hold on;
imshow(im2double(ind2rgb(img,map)));
test_features = image_features(img,thresh,corners);

num_of_tests = length(test_features(:,1));
pred_coordinates = [];

for i = 1:num_of_tests
    result = classify_corners(tree, test_features(i,1:16));
    if result == 1
        [x, y] = in2subscript(i);
        pred_coordinates = [pred_coordinates; x, y];
    end
end

figure(f);
hold on;
for i = 1:length(pred_coordinates(:,1))
    scatter(pred_coordinates(i,1),pred_coordinates(i,2),'y+');
end
end

function [x,y] = in2subscript(i)
% This function converts the index into subscripts
% for the images in the training and testing datasets
y = mod(i,570)   + 3;
x = floor(i/570) + 4;
end