function annotatedir

imagePath = 'images/';
yourImages = dir(imagePath);
for p = 3 : length(yourImages)
    IMGdir = yourImages(p).name;
    PNGdir = ['images/', IMGdir, '/']
    BOXdir = ['humanbbox/', IMGdir]
    ANNdir = ['keypoints/', IMGdir]
    RLTdir = ['poseresult/', IMGdir]
    if ~exist(ANNdir, 'dir')
        mkdir(ANNdir);
    end
    if ~exist(RLTdir, 'dir')
        mkdir(RLTdir);
    end

    d=dir([PNGdir,'/*.jpg']);
    for i = 1 : length(d),
        [path, name, ext] = fileparts(d(i).name);
        boxfile = [BOXdir, '/', name, '.txt'];
        annfile = [ANNdir, '/', name, '.txt'];
        rltfile = [RLTdir, '/', name, '.bmp'];
        if(~exist(annfile, 'file'))
            img = imread([PNGdir, d(i).name]);
            bbox = load(boxfile);
            fprintf('-- Now annotating %s --\n', d(i).name);
            record = annotatepts(img, bbox, rltfile);
            dlmwrite(annfile, record, ' ');
            clear record;
        else
            disp(['skipping image because anno file already exists: ' annfile])
        end
    end;
end

return