File Exchange Select – Inpaint_Nans, Gridfit, and fminsearchbnd/fminsearchcon
Sean's pick this week are the "File Exchange Select" files: inpaint_nans, fminsearchbnd-fminsearchcon, and surface-fitting-using-gridfit all by John D'Errico.
The "File Exchange Select" banner/badge was an old idea to advertise high quality, reviewed File Exchange submissions. It never really took off so we'll be deprecating it soon. The three files that did manage to get it are these by John D'Errico, one of the File Exchange's most prolific authors. I'm very surprised none of these are already picks of the week!
Today, I'll highlight inpaint_nans.
I actually used inpaint_nans in grad school to help cover ring artifacts caused by the detector in x-ray images. I don't have one of those images handy, so I'll use a picture of of one of my dogs instead. I've injected bright red ring artifacts to be easily detectable but emulate the real ring artifacts.
I = imread("LexiRing.png"); imshow(I) title("Ring Artifacts")
Find rings and expand them a little bit to cover edge effects.
rings = I(:, :, 1) > 200 & I(:, :, 2) < 100; rings = imdilate(rings, strel('disk', 2)); imshow(rings)
Apply inpaint_nans to each channel.
Ipainted = double(I); for ii = 1:3 planeii = Ipainted(:, :, ii); planeii(rings) = NaN; Ipainted(:, :, ii) = inpaint_nans(planeii); end imshow(uint8(Ipainted)) title("Rings filled with inpainting")
Give these tools a try and let us know what you think here.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.