Filter evenly spaced vertical and horizontal lines
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm doing some temperature downscaling that results in vertical and horizontal artifacts or "lines" in my output image. I would like to remove the artifacts using some form of filtering while changing the rest of the data as little as possible.
A browse image is here: http://fiesta.bren.ucsb.edu/~krittger/misc/filter_question/filt_question_browse.png
Example MATLAB workspace with matrix as variable "A" is here: http://fiesta.bren.ucsb.edu/~krittger/misc/filter_question/filt_question_data.mat
I've tried a few things using fspecial and imfilter but the high gradient in the other parts of the image get changed too.
0 Kommentare
Antworten (1)
Sean de Wolski
am 8 Jul. 2011
%A is your variable
Mx = false(size(A)); %masks in each dimension
My = Mx;
[fx fy] = gradient(A);
idx_x = find(abs(sum(fx))>50); %find lines
idx_y = find(abs(sum(fy,2))>35);
My(idx_y,:) = true; %turn lines on in mask
Mx(:,idx_x) = true;
K = fspecial('gaussian',7,.5);
Ablur = imfilter(A,K);
A2 = A;
M = Mx|My;
A2(M) = Ablur(M); %overwrite masked parts
The trick is to set up a map of the lines. I did that here (two separate maps in case you want to filter dimensions separately). Then once you have the mask, only replace the parts of the image in the mask with the blurred part. The above is just an example - it obviously needs tuning. You may also want to morphologically dilate ( imdilate ) to make sure it covers the lines.
Good luck!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Read, Write, and Modify Image finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!