File Exchange Pick of the Week

Our best user submissions

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!

Contents

Inpaint_Nans

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")

Comments

Give these tools a try and let us know what you think here.




Published with MATLAB® R2020a

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.