It is currently Fri Mar 29, 2024 6:29 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 3:43 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Hello there,

There has been a lot of time since my last message on this forum, sorry about that.
I've been actually very busy implementing a new "cool" filter in the G'MIC plug-in for GIMP (among other things!).
And I've reached a point where it has become usable enough to be announced here.
So here I am ! :)

Pre-requisites: The filter requires latest development version of the plug-in (so, a recent 1.6.8_pre should be good). You can pick it
at the usual download page if you are interested : http://gmic.eu/gimp.shtml
(should be available for Windows and Linux at least).

What the filter does ?

This is a new inpainting filter, so it basically reconstructs missing regions in your images. Regions are user-defined by marking the corresponding pixels with a single flat color (Red #FF0000 is the default). The algorithm tries then to copy/paste pieces of "valid'" image pixels into the holes to fill in.
There was already a quite good reconstruction filter in G'MIC to do this job (located in Repair / Inpaint [patch-based]), so consider the new filter as a different alternative. The new filter is parallelized, so if you have multiple CPU cores, it should make them warm up a little bit!

How to use the inpainting filter ?

Considering you have the latest version of the plug-in, using the filter is quite simple. Just 'refresh' the filters first (by pressing the update button located under the filter list), just in case (I'm regularly improving it since a few days). Then fill the pixels you want to reconstruct with a single flat color (beware, disable Anti-aliasing in selections, or use the pencil tool with a Hard-brush to get rid of unwanted color shades). Then, open G'MIC plug-in, and select filter Repair / Inpaint [multi-scale]. It should look like this (here I'm trying to remove the eiffel tower from a photograph).

Image

There are only few filter parameters to set, but you have to experiment a little bit with them, because finding good parameters depend on the size of the region you want to remove, the resolution of your image, etc. You can also enable a preview window that pops up when the filter is running, which show the algorithm working in real-time, reconstructing the image scale by scale.
Click OK, and wait a little bit (depends on the number of cores your machine has, mine has 24 cores, so I wait only for a few seconds :) ).
And you get this (I show the result as an animated .gif to better illustrate how parts have been reconstructed) :

Image

The algorithm implemented here should be very close to the one available in Photoshop (named "Content-Aware Filling"). Of course, not exactly the same (we don't have the Photoshop sources to compare), but pretty close, as it is based on the same kind of reconstruction techniques.
Of course, the G'MIC implementation of this algorithm is open-source.

Additional results:

I repost here some results I've already posted on the Google+ page of G'MIC. They illustrate what kind of things we can do with this new algorithm.
That looks quite good to me.

Image

Image

Image

Image

You can also uses this filter to "expand" complex textures a little bit:

Image

Well that's it ! I'd be interested by feedback on this filter.
Of course, sometimes it completely messes up with the reconstruction (be aware that reconstructing unknown image pixels is a very ill-posed problem with no perfect solutions known to date), but I have the impression it works quite well in most of the cases.
Just let me know what you think about it !

I've also done a small video that shows how it runs live (but as the filter has been already updated, the video is not up-to-date :) )

www.youtube.com Video from : www.youtube.com


I'm preparing a new filter to be included in G'MIC, that should be based on the same kind of algorithm for something a bit different.
I'll tell you more when it is ready !


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 5:00 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14801
Location: roma, italy
thanks a lot David!
It looks as an excellent add-on.
I will try it soon and post some outcome.
(but, please, never REMOVE GIRLS from a picture.......hehehe)

_________________
"Where am I ?"


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 5:25 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14801
Location: roma, italy
updated G'MIC
performed some tests
I do not post my results because not good (complex surroundings)
IMHO I think it would be necessary to add a new parameter: directions from where to get the texture to be painted over; they may be the 4 standard North-East-South-West.
I say that because in many cases it seems necessary not to take into account one of the directions, so that an object is replaced by a patch coming from W-N-E surroundings but not S for instance.
What do you think about?

_________________
"Where am I ?"


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 5:31 am  (#4) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
Looks great David

_________________
Image


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 5:46 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
dinasset wrote:
updated G'MIC
performed some tests
I do not post my results because not good (complex surroundings)
IMHO I think it would be necessary to add a new parameter: directions from where to get the texture to be painted over; they may be the 4 standard North-East-South-West.
I say that because in many cases it seems necessary not to take into account one of the directions, so that an object is replaced by a patch coming from W-N-E surroundings but not S for instance.
What do you think about?


In that case, use a selection to limit the part of the image used for the reconstruction.


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 5:55 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14801
Location: roma, italy
ok, thanks
I'll try again

_________________
"Where am I ?"


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 6:15 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14801
Location: roma, italy
better results with the selection

_________________
"Where am I ?"


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 6:48 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Not so surprising :)
Selection is a way for the user to "guide" the algorithm a bit more than it can do by itself.


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 8:23 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Nice one David. I used a rectangular selection filled with red and then de selected the area. Otherwise i had artifacts of red lines around the inpainted area. Probably my settings i imagine. Great filter though.

Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 10:04 am  (#10) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
I need to practice a bit more with the filter. It's very impressive. Thanks, David! Can't wait to see the finished product.

Here are two tries on the same image:
Image



Image


I used Unsharp Mask at it's default setting to get rid of the residual blurriness left by the filter. You may have to wait a bit on the animation, it's set at 1500ms.

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 10:33 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
It is very good - I think I will be getting a lot of use out of it.

Is there any explanation on the use of the other inpaint options which are available?

p.s. I notice an Italian is not concerned about the disappearance of the Eiffel Tower, but the loss of two girls is serious!! (dinasset - please excuse my sense of humour.)

david.


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 7:09 pm  (#12) 
Offline
GimpChat Member

Joined: Jul 11, 2010
Posts: 349
Partha' latest release of 2.9.1 comes with G'MIC 1.6.8_pre


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 9:39 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12513
Any possibility to allow the expanded selection one be made seamless, David? :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Fri Nov 27, 2015 9:44 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12513
Getting an error, at least with this small selection, David. :)

Error:

*** Error in ./gimp_inpaint_patchmatch/*repeat/*local/(...)/*if/*repeat/_inpaint_patchmatch/*if/ *** Command '-f': [_cimg_math_parser] gmic<float>::fill(): Invalid item 'init(boundary=1)' in expression 'init(boundary=1); if (i#2,i, avg = norm = 0; for (q = -1, q(...)...'.

edit:

OK: Have 1.6.7 so that must be my issue. Should have read your post in more detail, David. lol

I'll try again later. :)


Attachments:
error.png
error.png [ 171.65 KiB | Viewed 1962 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Sat Nov 28, 2015 3:50 am  (#15) 
Offline
Global Moderator
User avatar

Joined: Apr 01, 2012
Posts: 7696
Location: On the other side of this screen
Tried this a couple of times, at least 12 hours apart. I also refreshed the filters in G'MIC before using today. Both times nothing happened.
I have the latest 32 bit G'MIC. On a 32bit Windows 10. Gimp vs is 2.8.10

_________________


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Sat Nov 28, 2015 5:50 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12513
Installed the pre-beta and now it works. Had to increase the mask dilation to 1 (default was 0) otherwise, I would get a red outline border. Setting it too high gives repeating patch like results similar to what I get with Resynthesizer sometimes. lol

Thanks David. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Sat Nov 28, 2015 8:37 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: Jun 02, 2013
Posts: 2075
Awesome. I had great success with the other inpainting feature as well.

_________________
Image


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Sat Nov 28, 2015 10:10 pm  (#18) 
Offline
Global Moderator
User avatar

Joined: Apr 01, 2012
Posts: 7696
Location: On the other side of this screen
Haven't even got an error message. I know that G'MIC has ''run' because it gives an option to undo it. But nothing at all has changed.... :gaah
What am I doing wrong. How long (at the latest) should I wait for it to work?

_________________


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Sun Nov 29, 2015 1:59 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12513
If you are running the 1.6.8 pre-beta, you paint the area that you want in solid red and the preset takes care of the rest Sallyanne. Older versions of G'MIC will give you errors. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: New G'MIC filter for Inpainting (object removal)
PostPosted: Sun Nov 29, 2015 8:24 am  (#20) 
Offline
GimpChat Member
User avatar

Joined: Jun 02, 2013
Posts: 2075
Color me impressed:

Image

Forgot to get a shot of my mask, but here's the settings I used. Results are the result of many times of testing:

Image

EDIT: By the way, I love the window to be able to watch the results progressing. Very cool.

_________________
Image


Top
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts How to enlarge the "Preview" window of the Map Object filter?

3

No new posts Lama Cleaner: a free, open-source inpainting tool

9

No new posts Attachment(s) GEGL Simple Background Removal Tool (by color range)

1

No new posts Attachment(s) REMBG - an open source offline usable background removal AI

12

No new posts Map to Object

3



* Login  



Powered by phpBB3 © phpBB Group