File size: 895 Bytes
dc7407d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
%% copy files randomly
copy_files = false;
path = 'D:\All_files\pys\AI_algos\Mikes_Work\viscosity-video-classification\code_digdiscovery\annotate\';
file_path = 'D:\All_files\pys\AI_algos\Mikes_Work\viscosity-video-classification\code_digdiscovery\new_honey_164\';
cropped_path = [path, 'cropped'];

tot_frames = 1;
folders = dir(file_path);
if copy_files
    for i = 1: length(folders)

        if ~strcmp(folders(i).name,'.') && ~strcmp(folders(i).name,'..')
            frame_list = randperm(30,tot_frames);
            for j = 1 : tot_frames
                frames = ['frame_',num2str(frame_list(j)),'.jpg'];
                copyfile([file_path,folders(i).name,'\',frames],[path,folders(i).name,'_',frames]);
            end
        end

    end
end


%% check a single image and crop the rest using the smale BBox
files = dir(path);
figure;
file = '2202_frame_6.jpg';
img = imread(file);i