Home > analysis > get_all_detection_samples.m

get_all_detection_samples

PURPOSE ^

% INIT

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% INIT

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 %% INIT
0003 load _iFolders;
0004 load _report;
0005 load _parameters;
0006 
0007 EXTENSION = '.mn.png';
0008 MATCH_DISTANCE = 25;
0009 SAMPLE_DIMENSION = 30;
0010 FILTER_SIZE = 5;
0011 KERNEL_SIZE = 30;
0012 THRESHOLD = 0.2471;
0013 SIZE_THRESHOLD = 0;
0014 FP = zeros(SAMPLE_DIMENSION,SAMPLE_DIMENSION,0);
0015 FN = zeros(SAMPLE_DIMENSION,SAMPLE_DIMENSION,0);
0016 TP = zeros(SAMPLE_DIMENSION,SAMPLE_DIMENSION,0);
0017 GT = zeros(SAMPLE_DIMENSION,SAMPLE_DIMENSION,0);
0018 counter = 1;
0019 
0020 %% Loop each folder
0021 for f = 1: 6
0022    % Loop each sub sequence
0023    maskPath = strcat(iFolders(f).Name,'/amask.png');
0024    mask = imread(maskPath);
0025    for s = 1: size(iFolders(f).Ra,1)
0026        % Loop through each frame in a sub sequence
0027        frStart = iFolders(f).Ra(s,1);
0028        frEnd   = iFolders(f).Ra(s,2);
0029        for fr = frStart: frEnd
0030            clc; disp(strcat('Processing...dataset_', num2str(f),...
0031                ' - sequence_',num2str(s),...
0032                ' - frame_',num2str(fr)));
0033                                                         
0034             % get image
0035             imName = get_im_name(iFolders(f).Name,fr, EXTENSION);
0036             imPath = strcat(iFolders(f).Name,'/MN/',imName);
0037             im = imread(imPath);
0038 
0039             % get positions
0040             auPositions = adaBoost_detect(iFolders(f).Name,fr,SIZE_THRESHOLD);
0041 %             auPositions = imdetect(im,mask, FILTER_SIZE, KERNEL_SIZE, THRESHOLD, SIZE_THRESHOLD);
0042 %             auPositions = SS(f).Rich.frames(SS(f).Rich.frames(:,1)==fr,2:3);
0043             gtPositions = SS(f).Rich.tracksGT(SS(f).Rich.tracksGT(:,2)==fr,3:4);
0044             gtPositions = round(gtPositions);
0045             
0046             [fpStack fnStack tpStack] = im_collect_false_detection ...
0047                       (im, auPositions, gtPositions,MATCH_DISTANCE, SAMPLE_DIMENSION, 0);                  
0048             
0049             gtStack = get_image_samples(im,gtPositions(:,1),gtPositions(:,2),SAMPLE_DIMENSION);      
0050             counter = counter + 1;
0051             if counter == 20
0052                 close all;
0053                 counter  = 0;
0054             end
0055             
0056             % Concat images
0057             FP = cat(3,FP,fpStack);
0058             FN = cat(3,FN,fnStack);
0059             TP = cat(3,TP,tpStack);
0060             GT = cat(3,GT,gtStack);
0061        end
0062        
0063        
0064    end
0065     
0066 end
0067 
0068 %% SAVE
0069 save _samples TP FN FP GT;
0070 
0071 % iPath = 'Samples\';
0072 % disp('Saving... TP');
0073 % for i = 1: size(TP,3)
0074 %     im = TP(:,:,i);
0075 %     name = strcat(iPath,'TP\',num2str(i),'.png');
0076 %     im = imnormal(im);
0077 %     imwrite(im,name);
0078 % end
0079 % disp('Saving... FP');
0080 % for i = 1: size(FP,3)
0081 %     im = FP(:,:,i);
0082 %     name = strcat(iPath,'FP\',num2str(i),'.png');
0083 %     im = imnormal(im);
0084 %     imwrite(im,name);
0085 % end
0086 % disp('Saving... FN');
0087 % for i = 1: size(FN,3)
0088 %     im = FN(:,:,i);
0089 %     name = strcat(iPath,'FN\',num2str(i),'.png');
0090 %     im = imnormal(im);
0091 %     imwrite(im,name);
0092 % end
0093 % disp('Saving... GT');
0094 % for i = 1: size(GT,3)
0095 %     im = GT(:,:,i);
0096 %     name = strcat(iPath,'GT\',num2str(i),'.png');
0097 %     im = imnormal(im);
0098 %     imwrite(im,name);
0099 % end
0100 
0101 
0102

Generated on Thu 17-Mar-2011 14:45:51 by m2html © 2005