From: Lukáš Jiřiště Date: Mon, 19 Aug 2024 12:23:02 +0000 (+0200) Subject: Rework get_mask function X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=abf413a3cd5f99eb00376d4fdc8d446db835e063;p=Bubble_column.git Rework get_mask function Move get_mask to get_simple_mask, and make get_mask get the final mask. --- diff --git a/get_mask.m b/get_mask.m index 28232d9..98a470e 100644 --- a/get_mask.m +++ b/get_mask.m @@ -1,14 +1,6 @@ -function mask = get_mask(changefig, meanfig, threshold, strength) - if nargin < 3 - threshold = 200; - end - - mask = (changefig > threshold); - if nargin >= 4 - mask = clean_mask(mask, strength); - else - mask = clean_mask(mask); - end - mask = double(mask); +function mask = get_mask(changefig, meanfig) + change_mask = get_simple_mask(changefig, 200); + mean_mask = get_simple_mask(meanfig, 60); + mask = change_mask .* mean_mask; end diff --git a/get_simple_mask.m b/get_simple_mask.m new file mode 100644 index 0000000..a0d974f --- /dev/null +++ b/get_simple_mask.m @@ -0,0 +1,10 @@ +function mask = get_simple_mask(fig, threshold, strength) + mask = (fig > threshold); + if nargin >= 3 + mask = clean_mask(mask, strength); + else + mask = clean_mask(mask); + end + mask = double(mask); +end +