Gray Scale Image with Empty Black area

I want to fill the black areas with the value of neighboring pixels. Kind of interpolation. Can any one suggest me how Can I do in matlab.

  • $\begingroup$ Duplicate on SO: stackoverflow.com/q/11338164/769220 $\endgroup$
    – Chris
    Commented Jul 5, 2012 at 8:25
  • $\begingroup$ This is technically on-topic, but it's an exact duplicate of a question on SO that already has a better answer (by the same user), so I'm closing it here. It's also a little more oriented towards MATLAB programming than DSP concepts, so it's only borderline on-topic. $\endgroup$
    – datageist
    Commented Jul 5, 2012 at 13:30

1 Answer 1


Try the imfill function, see http://www.mathworks.com/help/toolbox/images/ref/imfill.html

  • $\begingroup$ imfill fills with only one color. please suggest some other methods $\endgroup$ Commented Jul 5, 2012 at 5:23
  • $\begingroup$ Then to fill one black area, try to identify a sub-region containing the black area first, then creates a Delaunay triangulation of the non-black points in inside the sub-region. It will allow you to do the interpolation at the black points. $\endgroup$
    – chaohuang
    Commented Jul 5, 2012 at 5:33
  • $\begingroup$ please explain in detail about what to do after I create the Delaunay Triangulation of non-black points. I can Identify the sub-Regions containing black area $\endgroup$ Commented Jul 5, 2012 at 5:37
  • $\begingroup$ see my answer on stackoverflow $\endgroup$
    – chaohuang
    Commented Jul 5, 2012 at 6:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.