Created
September 23, 2016 05:06
-
-
Save pppoe/ba1ec5a4c17ce39c517d1a6d5cbcfe2d to your computer and use it in GitHub Desktop.
Quick Script to dump out images and annotations from the COFW dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## http://www.vision.caltech.edu/xpburgos/ICCV13/ | |
output_dets_f = './dets-COFW-train.txt' | |
image_root = './COFW-train-'; | |
load('COFW_train.mat'); | |
imgs = IsTr; | |
bboxes = bboxesTr; | |
lms = phisTr; | |
% output_dets_f = './dets-COFW-test.txt' | |
% image_root = './COFW-test-'; | |
% load('COFW_test.mat'); | |
% imgs = IsT; | |
% bboxes = bboxesT; | |
% lms = phisT; | |
fp_dets = fopen(output_dets_f, 'w'); | |
num_images = size(imgs,1); | |
num_lms = 29 | |
for n=1:num_images | |
img = imgs{n}; | |
image_p = sprintf('%s%04d.jpg', image_root, n); | |
imwrite(img, image_p); | |
fprintf(fp_dets, '%s\n1\n%d %d %d %d 1\n', image_p, bboxes(n,1), bboxes(n,2), bboxes(n,3), bboxes(n,4)); | |
lms_p = sprintf('%s%04d.lms', image_root, n); | |
fp_lms = fopen(lms_p, 'w'); | |
for l=1:num_lms | |
fprintf(fp_lms, '%f %f\n', lms(n,l*2-1), lms(n,l*2)); | |
end | |
fclose(fp_lms); | |
occ_p = sprintf('%s%04d.occ', image_root, n); | |
fp_occ = fopen(occ_p, 'w'); | |
for l=1:num_lms | |
fprintf(fp_occ, '%d\n', lms(n,num_lms*2+l)); | |
end | |
fclose(fp_occ); | |
end | |
fclose(fp_dets); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment