function image_test2(tree, test_file, thresh)
% This function takes an image and predicts the corners on it.
disp(['Testing image ' test_file ' ...']);
[img, ~] = imread(test_file);
[row_img, ~] = size(img);
f1 = figure;
imshow(img);
test_features = image_features(img,thresh,[]);
num_of_tests = length(test_features(:,1));
pred_corners = [];
for i = 1:num_of_tests
    
    result = classify_corners(tree, test_features(i,1:16));
    if result == 1
        [x, y] = recover_coordinates(i, row_img);
        pred_corners = [pred_corners; x, y];
    end
end
if ~isempty(pred_corners)
    figure(f1);
    hold on;
    for i = 1:length(pred_corners(:,1))
        scatter(pred_corners(i,1), pred_corners(i,2),'y+');
    end
end
end

function [x,y] = recover_coordinates(i, row_img)
% converts the index to subscripts
y = mod(i, row_img - 6) + 3;
x = floor(i/(row_img - 6)) + 4;
end







