[Image Processing] Remove stripes / horizontal streaks in image

I have a photo that has some kind of horizontal stripes as below. They show very clear in the darker region at the bottom.
Is there a way to remove them (destripe) or minimize the effect of horizontal stripes but still keep the image look reasonable, not blurry.
Any ideas would be appreciated.
Thanks.

 채택된 답변

Matt J
Matt J 2023년 10월 5일
편집: Matt J 2023년 10월 5일
A=double(imread('pic.jpg'));
Acorrected=A-medfilt2(A-medfilt2(A,[50,1]),[1,100]);
immontage({A,Acorrected},'DisplayRange',[40 160])

댓글 수: 2

Tks Matt J! Appreciate it.
You're welcome, but please Accept-click the answer if you are satisfied with it.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2023년 10월 6일

0 개 추천

Hopefully the white part is not overexposed. If not, then the common way to do it is to take the mean of the image horizontally over the uniform (i.e., white) parts and then get a measure of exposure. Then divide the image by that vector to "undo" the differences in exposure.
You can find the white parts outside of the car by thresholding for the car and then taking the bounding box. Then sum across columns and count white pixels across columns and divide the two to get the mean across columns in the white area. Then divide each column by that resul.

댓글 수: 2

Hi,
I tried to code following your suggestion.
% read image
in = double(imread("pic.jpg"));
% threshold image, assign 0 for black, 1 for white
threshImg = zeros(size(in));
threshImg(in > 220) = 1;
% figure; imshow(threshImg, []);
out = in;
% for each row
for r=1:size(in,1)
% sum across cols / num of white pixels across cols
m = sum(threshImg(r,:) .* in(r,:), "all") / ...
nnz(threshImg(r,:));
% divide
out(r,:) = out(r,:) / m;
end
figure; imshow(out, []);
As you can see from the result I get, the horizontal stripes are still there.
Did I do something wrong, or I misunderstanded what you suggested.
Thank you for your help.
I think it looks right. You might plot m as a function of row to see that you have a nice looking step-like profile. Also use imadjust to expand contrast in the white region to make sure it looks like uniform horizontal stripes. Even with all that, if the gain changes across columns, then it may not do a perfect job, and you'll just have to figure out how to do your subsequent analyses with stripes still partially there.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

릴리스

R2023b

질문:

TP
2023년 10월 5일

댓글:

2023년 10월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by