Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
function cluster_vis(clusters,detections,img_list)
num_cluster = length(clusters);
track_colors = get_track_colors(num_cluster, 1);
detections = cat(1, detections{:});
num_frames = max(detections(:,5));
for imgidx = 1: num_frames
comp_cluster_vis_helper(img_list, clusters, detections, track_colors, imgidx);
end
end
function comp_cluster_vis_helper(img_list, clusters, detections, track_colors, aidx)
text_x_offset = 10;
text_y_offset = 30;
figidx = 1;
h = figure(figidx);xlim([1 2500]);ylim([1 800]);
% set(h,'Visible','off');
clf;
I = imread([img_list(aidx).name]);
imagesc(I); axis equal;
hold on;
for tidx = 1:length(clusters)
fidx_list = detections(clusters{tidx},5);
if any(fidx_list == aidx)
bbox_idx_list = find(fidx_list == aidx);
for k = 1: length(bbox_idx_list)
bbox_idx = clusters{tidx}(bbox_idx_list(k));
det = detections(bbox_idx,:);
rect_x1 = max(det(1), 1);
rect_y1 = max(det(2), 1);
% rect_x2 = min(det(3), size(I, 2));
% rect_y2 = min(det(4), size(I, 1));
rect_x2 = det(3);
rect_y2 = det(4);
rect_width = rect_x2 - rect_x1;
rect_height = rect_y2 - rect_y1;
rectangle('Position', [rect_x1, rect_y1, rect_width, rect_height], ...
'EdgeColor', track_colors(tidx, :), 'LineWidth', 1.5);
text(rect_x1 + text_x_offset, rect_y1 + text_y_offset, ...
num2str(tidx), 'FontSize', 10, 'Color', track_colors(tidx, :));
end
end
end
% vis_name = [vis_dir '/imgidx' padZeros(num2str(aidx), 4) '.jpg'];
% fprintf('saving %s\n', vis_name);
% set(gca, 'visible', 'off', 'position', [0, 0, 1, 1]);
% print(['-f' num2str(figidx)], '-dpng', '-r200', vis_name);
end