Skip to content

Commit

Permalink
fix Ymean issue in batch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoupc committed Dec 13, 2017
1 parent f950d1a commit 088afc1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ca_source_extraction/@Sources2D/initTemporal.m
Expand Up @@ -137,15 +137,9 @@ function initTemporal(obj, frame_range, use_parallel)
end
A_patch = A{mpatch};

if isempty(A_patch)
fprintf('Patch (%2d, %2d) is done. %2d X %2d patches in total. \n', r, c, nr_patch, nc_patch);
continue;
end

% use ind_patch to indicate pixels within the patch
ind_patch = false(diff(tmp_block(1:2))+1, diff(tmp_block(3:4))+1);
ind_patch((tmp_patch(1):tmp_patch(2))-tmp_block(1)+1, (tmp_patch(3):tmp_patch(4))-tmp_block(3)+1) = true;
AA{mpatch}= sum(A_patch(ind_patch,:).^2, 1);

% get data
if strcmpi(bg_model, 'ring')
Expand All @@ -159,6 +153,12 @@ function initTemporal(obj, frame_range, use_parallel)
Ymean{mpatch} = temp((tmp_patch(1):tmp_patch(2))-tmp_block(1)+1, (tmp_patch(3):tmp_patch(4))-tmp_block(3)+1);
Ypatch = reshape(Ypatch, [], T);

if isempty(A_patch)
fprintf('Patch (%2d, %2d) is done. %2d X %2d patches in total. \n', r, c, nr_patch, nc_patch);
continue;
end
AA{mpatch}= sum(A_patch(ind_patch,:).^2, 1);

% get background
if strcmpi(bg_model, 'ring')
W_ring = W{mpatch};
Expand Down Expand Up @@ -207,15 +207,9 @@ function initTemporal(obj, frame_range, use_parallel)
end
A_patch = A{mpatch};

if isempty(A_patch)
fprintf('Patch (%2d, %2d) is done. %2d X %2d patches in total. \n', r, c, nr_patch, nc_patch);
continue;
end

% use ind_patch to indicate pixels within the patch
ind_patch = false(diff(tmp_block(1:2))+1, diff(tmp_block(3:4))+1);
ind_patch((tmp_patch(1):tmp_patch(2))-tmp_block(1)+1, (tmp_patch(3):tmp_patch(4))-tmp_block(3)+1) = true;
AA{mpatch}= sum(A_patch(ind_patch,:).^2, 1);

% get data
if strcmpi(bg_model, 'ring')
Expand All @@ -229,6 +223,12 @@ function initTemporal(obj, frame_range, use_parallel)
Ymean{mpatch} = temp((tmp_patch(1):tmp_patch(2))-tmp_block(1)+1, (tmp_patch(3):tmp_patch(4))-tmp_block(3)+1);
Ypatch = reshape(Ypatch, [], T);

if isempty(A_patch)
fprintf('Patch (%2d, %2d) is done. %2d X %2d patches in total. \n', r, c, nr_patch, nc_patch);
continue;
end
AA{mpatch}= sum(A_patch(ind_patch,:).^2, 1);

% get background
if strcmpi(bg_model, 'ring')
W_ring = W{mpatch};
Expand Down

0 comments on commit 088afc1

Please sign in to comment.