function [X,Y] = Hand_Label_Data_Learn

global IMAGE;


cont_Label = 1;
while cont_Label == 1
    h = figure(10000);
    image(permute(IMAGE.rgb,[2 1 3]));
    title('Image');


    tmp_str = input('Enter if Image is ok for learning. Otherwise enter any key before Enter to see next image:  ', 's');
    if isempty(tmp_str)
        cont_Label = 0;
    else
        IMAGE.rgb = lagrAPIGetImageRGB('current');
    end
end

% warning('remove before shipping');
% keyboard;


fim = double(colrHist(IMAGE.rgb,5,0,255,5,5));
%fim = double(IMAGE.rgb);


[image_height, image_width, num_features_per_pixel] = size(fim);
X = double(reshape(fim, image_height * image_width, num_features_per_pixel));


% warning('remove before shipping');
% keyboard;


% First the path points.
cont = 1;
X_grn = [];
while cont == 1

    disp('...');
    disp('...');
    disp('Pick Path Example.');

    h = figure(10000);
    image(permute(IMAGE.rgb,[2 1 3]));

    [ptss] = pick_rec(IMAGE.rgb); % choose a window

    tmp_mask = zeros(image_height, image_width);
    tmp_mask(ptss(1,2):ptss(1,4),ptss(1,1):ptss(1,3))=1;

    figure(10001);
    tmp_image = permute(IMAGE.rgb,[2 1 3]);
    tmp_i1_1 = tmp_image(:,:,1);
    tmp_i1_1(tmp_mask'==0) = 0;
    tmp_i1_2 = tmp_image(:,:,2);
    tmp_i1_2(tmp_mask'==0) = 0;
    tmp_i1_3 = tmp_image(:,:,3);
    tmp_i1_3(tmp_mask'==0) = 0;
    tmp_i1 = uint8(zeros(size(tmp_image)));
    tmp_i1(:,:,1) = tmp_i1_1;
    tmp_i1(:,:,2) = tmp_i1_2;
    tmp_i1(:,:,3) = tmp_i1_3;
    image(tmp_i1);
    title('Mask Selected');

    mask3_state_str = input('\nPath Pts window OK? Enter for yes, anything else entered before Enter means no: ', 's');
    if isempty(mask3_state_str)
        mask_grn = tmp_mask;
        ptss_grn = ptss;
        cont = 0;
        label_imag_tt = reshape(mask_grn, image_height * image_width, 1);

        ind = find(label_imag_tt==1);
        X_grn = [X_grn;X(ind,:)];
    end
    if cont == 0
        mask3_state_str = input('\n    Enough Path Points? Enter for yes, anything else entered before Enter means no: ', 's');
        if ~isempty(mask3_state_str)
            cont = 1;
        end
    end
end

%Then the non-path points.
cont = 1;
X_obs = [];
while cont == 1

    disp('...');
    disp('...');
    disp('Pick Non-Path Example');

    h = figure(10000);
    image(permute(IMAGE.rgb,[2 1 3]));

    [ptss] = pick_rec(IMAGE.rgb); % choose a window


    tmp_mask = zeros(image_height, image_width);
    tmp_mask(ptss(1,2):ptss(1,4),ptss(1,1):ptss(1,3))=1;

    figure(10002);
    tmp_image = permute(IMAGE.rgb,[2 1 3]);
    tmp_i1_1 = tmp_image(:,:,1);
    tmp_i1_1(tmp_mask'==0) = 0;
    tmp_i1_2 = tmp_image(:,:,2);
    tmp_i1_2(tmp_mask'==0) = 0;
    tmp_i1_3 = tmp_image(:,:,3);
    tmp_i1_3(tmp_mask'==0) = 0;
    tmp_i1 = uint8(zeros(size(tmp_image)));
    tmp_i1(:,:,1) = tmp_i1_1;
    tmp_i1(:,:,2) = tmp_i1_2;
    tmp_i1(:,:,3) = tmp_i1_3;
    image(tmp_i1);
    title('Mask Selected');

    mask3_state_str = input('\nNon-Path Pts window OK? return yes, anything else entered before return means no: ', 's');
    if isempty(mask3_state_str)
        mask_obs = tmp_mask;
        ptss_obs = ptss;
        cont = 0;

        label_imag_tt = reshape(mask_obs, image_height * image_width, 1);

        ind = find(label_imag_tt==1);
        X_obs = [X_obs;X(ind,:)];
    end
    if cont == 0
        mask3_state_str = input('\n    Enough Non-Path Points? return yes, anything else entered before return means no: ', 's');
        if ~isempty(mask3_state_str)
            cont = 1;
        end
    end
end

X = [X_grn;X_obs];
Y = [-ones(size(X_grn,1),1);ones(size(X_obs,1),1)];


% warning('remove before shipping');
% keyboard;

close all;






