MATLAB Answers


how to estimate bright channel for color image in Matlab??

ghada sandoub さんによって質問されました 2019 年 3 月 11 日
最新アクティビティ ghada sandoub さんによって コメントされました 2019 年 3 月 13 日
how to estimate the bright channel prior for color image (convert the image of the spatial domain into Brightness Domain) using the following formula:
Does anyone know how to do this in Matlab??

  4 件のコメント

ghada sandoub 2019 年 3 月 12 日
this is the form of estimating bright channel. where Ic is a color channel of I and Ω(x) is a local patch centered at x. y is a pixel in the local path Ω(x). the bright channel is the outcome of two maximum operators. The operator "max c∈{r,g,b}” is performed on each pixel for the three channels. The operator “max y∈Ω(x)” is a maximum filter. the local patch size for both operation was set as 15 × 15. so, i asked about how to do this in matlab?
2019 年 3 月 12 日
So you want a window average, but with a maximum, with a 15-by-15-by-size(I,3) window?
ghada sandoub 2019 年 3 月 12 日
I think that..

サインイン to comment.

2 件の回答

Image Analyst
回答者: Image Analyst
2019 年 3 月 12 日
編集済み: Image Analyst
2019 年 3 月 12 日

The inner operation is dilation. The outer one is max. So simply dilate each color channel (take the max in a 15x15 window) with imdilate(). Like for the red channel.
dilatedRed = imdilate(redChannel, ones(3));
Same for blue and green, then recombine into an rgb image and use max
brightnessImage = max(rgbImage, [], 3);
A full demo is attached.
0000 Screenshot.png
But I don't recall seeing this formula you gave. Taking the max is what you do to get L in the RGB-to-HSL, or to get the V in RGB-to-HSV formula. But they don't do dilation first. Not sure what that gets you, do you know? Why not just do it without dilation and use the built-in rgb2hsv() function
hsvImage = rgb2hsv(rgbImage); % Convert to HSV color space.
brightnessImage = hsvImage(:, :, 3); % Extract the V channel.

  5 件のコメント

ghada sandoub 2019 年 3 月 13 日
Thanks alot for your response. so, in another case if i want to estimate the dark channel prior for the color image with the following formula:
should i use erosion instead of dilation?? and make the min operation first then make the erosion or what should i do in this case?
Image Analyst
2019 年 3 月 13 日
Yes, except the order is switched. It is:
Imin = imerode(min(Ig, [], 3), ones(windowSize));
Where are you getting these formulas from? I can understand that the dark current signal might be estimated as the min of the red, green, and blue pixels in the demosaicing window but I really doubt any camera uses a demosaicing algorithm where the interpolated pixels are the uniformly weighted average inside a 15x15 window.
ghada sandoub 2019 年 3 月 13 日
I'm working now in researching and I get these formulas from a paper that interested in low light image enhancement. this paper uses the bright channel formula to estimate the insufficient illumination in the low light image.

サインイン to comment.

回答者: Rik
2019 年 3 月 12 日

Below you find 2.5 strategies. The first should be a lot faster, especially for larger images. With the last it is easier to see that the method returns the expected outcome.
A=randi(20000,300,300,3);%random image
%strategy 1:
GetSingleLayerMax=@(A,window) nlfilter(A,[window window],@(x) max(x(:)));
for n=2:size(A,3)
maxIM = max(tmp,[],3);
%strategy 1b:
GetSingleLayerMax2=@(A,window) colfilt(A,[window window],'sliding',@max);
for n=2:size(A,3)
maxIM_1b = max(tmp,[],3);
%strategy 2:
tmp=ceil(tmp);%in case of even window size
w=[w_x(:) w_y(:) w_z(:)];
for r=1:size(A,1)
for c=1:size(A,2)
%get all indices
%remove invalid indices
%convert to linear indices
%compute the max
if isequal(maxIM,maxIM2) && isequal(maxIM_1b,maxIM2)
disp('everything finished succesfully')
disp('something went wrong (check for float rounding errors)')

  1 件のコメント

ghada sandoub 2019 年 3 月 13 日
thanks alot

サインイン to comment.

Translated by