I have read that one of the requirement of image inpainting is to have a mask which locates places of an image where inpainting is needed. How is this mask automatically designed? From the internet I searched but I can't get an explicit information on how to automatically locate scratches in an image (mask). I also read that one can locate those damaged parts by taking the difference of the damaged image and the median-filtered original image. This doesn't give me better results, in fact I get extremely bad results. If one has a MATLAB function, please share.

Similar questions and discussions