Commit f77c6f96 authored by Yipeng Hu's avatar Yipeng Hu

ref #6 simplified data set added

parent 0d80d064
......@@ -81,7 +81,12 @@ num_subjects = length(unique(indices_subject));
% by subject
h5fn_subjects = fullfile(normFolder,'protocol_sweep_class_subjects.h5'); delete(h5fn_subjects);
MAX_num_frames = 50;
RESIZE_scale = 2;
frame_size = round(frame_size/2);
h5fn_subjects = fullfile(normFolder,'ultrasound_50frames.h5'); delete(h5fn_subjects);
% write global infomation
GroupName = '/frame_size';
h5create(h5fn_subjects,GroupName,size(frame_size),'DataType','uint32');
......@@ -99,14 +104,18 @@ for idx_subject = 0:num_subjects-1 % 0-based indexing
indices_frame_1_subject = find(indices_subject==idx_subject);
num_frames_subject = length(indices_frame_1_subject);
if num_frames_subject>MAX_num_frames
indices_frame_1_subject = randsample(indices_frame_1_subject,MAX_num_frames);
num_frames_subject = MAX_num_frames;
end
for idx_frame_subject = 0:num_frames_subject-1
idx_frame = indices_frame_1_subject(idx_frame_subject+1);
filename = fullfile(dataFolder, frame_info(idx_frame).class_name, frame_info(idx_frame).filename);
img = imread(filename);
img = img(roi_crop(1):roi_crop(2),roi_crop(3):roi_crop(4));
img = imresize(img(roi_crop(1):roi_crop(2),roi_crop(3):roi_crop(4)),frame_size);
GroupName = sprintf('/subject%06d_frame%08d',idx_subject,idx_frame_subject);
h5create(h5fn_subjects,GroupName,size(img),'DataType','uint8');
h5write(h5fn_subjects,GroupName,img);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment