any one can solve the code of image inpaintig that i have attatched

hello please check the attached code in that code it only run for the one image which i have attached. so please checked it and make it run for any images

 Accepted Answer

Like I said in your duplicate post, that's not a good or efficient method. See my better method, attached as test.m. Even if you did want to use convolution, you wouldn't do it like you did it for reasons I gave in your duplicate post. My method uses roifill(), the inpainting method built in to the Image Processing Toolbox.

13 Comments

thanx butits not working for given image that i attached so please check.
It's just a color image. You can just do what I did on each color channel one at a time. Or did you already think of that (it is rather obvious), and your adaptation still failed for some reason? You probably have a bug in your code where you didn't adapt it correctly. Please attach your code so I can fix it.
check the attach and please tell me what to for another image to... make the code reliable for any image
You didn't adapt it to a color image. You're converting it into a gray scale image. You need to extract out the color channels and do that on each one.
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Alright - here, it was so simple quick and easy that I did it for you (attached below).
thanks a lot.... it is really working.. i tested it with different colors but it worked perfectly for black scratches.. if i want to implement this code for user defined scratch using roipoly tool is it possible??
Yes. roipoly produces a mask and just follow that with the code I gave.
i tried but the inpainted images show light orange color instead of filling the original....
How do you know that's not what it should be? Have you tried drawing different areas around the scratch?
yeah i have tried different areas .........
Are you saying it's wrong? So for any area you do, it does the same solid light orange color? Even if you draw it in a black region?
no no it aint wrong... what i mean is it should fill the scratched portion.. what shall i do to blacken the selected portion using roipoly.. what i thought is if i blacken the selected portion and then apply ur codes it ll generate the required results... what do u think regarding it??
hello please tell me what is the meaning of mask = redChannel <= 20 & greenChannel <= 20 & blueChannel <= 20; in the program test.m
It gets pixels that are black in all three color channels. So if RGB = (0,0,0) it would get that, but if the pixel is (0,2,0) it would not consider that as black because it's not pure black in the green.

Sign in to comment.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!