17 lines
504 B
Matlab
17 lines
504 B
Matlab
|
% generate query boxes. The query boxes are hand-drawn ones.
|
||
|
img_dir = 'frames\';
|
||
|
write_dir = 'query_box\';
|
||
|
mkdir(write_dir);
|
||
|
|
||
|
% generate query images
|
||
|
fid = fopen('query_info.txt');
|
||
|
while ~feof(fid)
|
||
|
ID = fscanf(fid, '%d ', 1);
|
||
|
rect = fscanf(fid, '%f %f %f %f', 4);
|
||
|
img_name = fscanf(fid, ' %s\r\n', 1);
|
||
|
img = imread([img_dir img_name '.jpg']);
|
||
|
box = imcrop(img, rect);
|
||
|
write_path = [write_dir sprintf('%.3d_%s', ID, img_name) '.jpg'];
|
||
|
imwrite(box, write_path)
|
||
|
end
|
||
|
fclose(fid);
|