any one can solve the code of image inpaintig that i have attatched
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
0 votes
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
Image Analyst
on 4 May 2014
0 votes
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
asthana
on 4 May 2014
thanx butits not working for given image that i attached so please check.

Image Analyst
on 4 May 2014
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.
asthana
on 4 May 2014
check the attach and please tell me what to for another image to... make the code reliable for any image
Image Analyst
on 4 May 2014
Edited: Image Analyst
on 4 May 2014
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).
asthana
on 5 May 2014
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??
Image Analyst
on 5 May 2014
Edited: Image Analyst
on 5 May 2014
Yes. roipoly produces a mask and just follow that with the code I gave.
asthana
on 5 May 2014
i tried but the inpainted images show light orange color instead of filling the original....
Image Analyst
on 5 May 2014
How do you know that's not what it should be? Have you tried drawing different areas around the scratch?
asthana
on 5 May 2014
yeah i have tried different areas .........
Image Analyst
on 5 May 2014
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?
asthana
on 5 May 2014
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??
asthana
on 7 May 2014
hello please tell me what is the meaning of mask = redChannel <= 20 & greenChannel <= 20 & blueChannel <= 20; in the program test.m
Image Analyst
on 7 May 2014
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.
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)