Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I use the MSR method to output the light map? #5

Open
sunohm opened this issue Feb 12, 2023 · 0 comments
Open

how can I use the MSR method to output the light map? #5

sunohm opened this issue Feb 12, 2023 · 0 comments

Comments

@sunohm
Copy link

sunohm commented Feb 12, 2023

Hello,
I'm sorry to bother you. First of all, thank you for your work. I have learned great knowledge. In addition, I have a question to ask. In the comparison experiment, how can I use the MSR method to output the light map? Is it like the SSRlog in the following code that directly outputs the filtered results?

function OUT = SSR(I, varargin)
T = imgaussfilt(I, varargin{:});
OUT = I./(T); % avoid NaN
end

function OUT = SSRlog(I, varargin)
OUT = imgaussfilt(I, varargin{:});
%OUT = log(I) - log(T+1) + 0.5;
end

function OUT = MSR(I, varargin)
if numel(varargin) == 0
varargin = {25 100 240}; %{25 100 240}
end
OUT = 0; N = numel(varargin);
for n = 1:N
OUT = OUT + (1/N)* multiscaleRetinex(I,'SSR',varargin{n});
end
end

function OUT = MSRCR(I, lowScale, medScale, highScale, leftChop, rightChop)
if ~exist('lowScale', 'var'), lowScale = 15; end
if ~exist('MedScale', 'var'), medScale = 80; end
if ~exist('HighScale', 'var'), highScale = 250; end
if ~exist('s1', 'var'), leftChop = 1; end
if ~exist('s2', 'var'), rightChop = 1; end

MSR = multiscaleRetinex(I, 'MSR', lowScale, medScale, highScale);

for c = 1:3
CR = (log(125*I(:,:,c))-log(I(:,:,1)+I(:,:,2)+I(:,:,3)));
OUT(:,:,c) = colorBalance(mat2gray(CR.*MSR(:,:,c)), 'simplest', leftChop, rightChop);
end
%OUT = max(0, min(1, OUT));
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant