Guided Selection (Foreground Extraction) Progress Thread

Hi Krita Artists,

I am currently working on the process of making guided selection tool into Krita. Now, before I mention the details of doing so and what is guided selection, there are things that I have done for Krita, and these are the things that I have done:

  • Several Blending Modes including ones that are my own invention which is Modulo series (You won’t see this set of modes in other software except G’MIC, and that’s my contribution there too)
  • Added Gaussian High Pass Filter (This needs more work after guided selection)
  • Added Symmetric Difference Selection Mode

What is guided selection? Guided selection is the process of extracting foreground with guided filtering made by Kaiming He. The main core of guided selection is the box filtering or mean filtering. The purpose of creating guided selection is to bring foreground extraction tool into Krita.

Why am I bringing this tool into Krita as Krita is marketed as a painting software? Such tool enables a wider range of art possibility by combining photographs and painting in one (usually to create ethereal artworks that can lead to greater quality than hand-painted work). For example, ElenaDudina combines foreground extraction, photomanipulation tools, and painting all in one frequently to create such works. I want to bring that option for Krita. As a side effect, it also enables more people to switch to Krita if they’re not sastified with other FOSS raster graphic application options.


Progress on Guided Selection

  • Create Box Convolution Code - Done
  • Create Guided Selection Icon - Done (It’ll be a tree surrounded by selection ants)
  • Create the Guided Selection Widget - Done
  • Create the Guided Selection Processing Code - TODO
  • Finalize Code - TODO
  • Release code publicly - TODO
6 Likes

Thanks for working on this. I am looking forward to this and will help testing it. :+1:

1 Like

This sounds super promising! Excited to see this, thank you for making this!:grin:

great idea ! Cant wait to test it !

1 Like

As Magnetic Tool already has the base for widget, I have finished the widget. Now, for the most difficult part of making the tool. This part will take months as I lack c++ skills.

This idea somewhat looks similar to the object selection tool in Photoshop, am I correct?

Yes. That’s the idea. The purpose is to give a new use case to Krita which would be matte painting, and making it viable to use photographs to create beautiful artworks.

1 Like

Hmm, I am working on a new filter for better edge detection, would love take a look at the code if it is available publicly, :upside_down_face:

2 Likes

Sorry for bumping this thread, but I decided to work on this again. Thanks to @tiar, I was able to get the interface to work.

Up next is to do the algorithm.

1 Like

Now, I actually managed to get a start on the algorithm. See this commit here - https://invent.kde.org/graphics/krita/-/merge_requests/328/diffs?commit_id=81877e44f4ea0709ee8e3a600b0153c5c931fbdd

What this does is to box blur a copy of the original image internally.

Ok, algorithm is halfway done! Also, thanks to a developer, he fixed the crash when starting the selection.

After that, I will have to get the tool to actually work. I won’t be doing selection painting though as I still don’t know much of Krita internals.

2 Likes

Ok guys, now I have officially finished the selection algorithm.

Now, here’s what left to do. Actually getting it to activate and work on selection with the algorithm I have coded in.

Next after that, users will be finally be able to test it.

1 Like

Yes, the qualities a good photographer has in composing/manipulating and the technical use of software can be used to photobash, but that misses out the actual painting/drawing, so it cannot be that the result of photobashing is better, in terms of time/effort/application also. People in the creative industry would most likely say photobashing is better, as you get the result, and as fast as possible, and superficially it works; people visually think it’s actual art that’s been done, and the bucks roll in.

Probably not obvious :rofl: but this has hit on a real bug bear of mine, as I also don’t think photobashing teaches anybody to really draw/paint either. Of course people are free to do as they like, and whoever wants to use Krita differently can, but hopefully Krita doesn’t become too big with non-painting features. A reason I would spend more time in software without reference-tracing inbuilt is that it is hard to tell if any Krita artwork has been traced, unless a timelapse is posted also, thus the work invested by the artist who has not traced at all may be dismissed to some degree. If a timelapse feature comes in, I really hope it shows every part ie if tracing was used.

Not that I or anyone minds you using paintstorm as your go-to app, but the reason you site for it seems to be vague. you choose it as your go to become some person traces artwork using Krita? People can trace or paint with whatever tool they find, that should not discourage you form using anything. :slight_smile:

I mean can’t a person load an image in paintstorm and smudge it and trace over it?

Also to add, I don’t find creativity of photobashers any less than other artists (provided that they use images with right licenses) because mixing and matching also needs creativity. They still need to think about layout lighting etc. Then there are artists who do collage artworks too. We should not think of them as any lesser artists.

1 Like

Some people actually combine painting with photobashing. ElenaDudina is my goto example to show that lazy selection theoretically open way to new form of art.

A example - https://www.deviantart.com/elenadudina/art/The-last-trip-799336107

Also, Krita is never going to be competing with photoediting apps for editing as A) we do not have enough volunteers to expand to that role, and B) it focus has been established into a tool for many artists. There are still way too many things to do before filters can be focused on. It is slowly expanding as a tool for all kinds of artists. Lazy selection opens way to ElenaDudina style of art.

@raghukamath I’m referring to krita having inbuilt reference-tracing. And, yes, there are various ways to be creative, but my comment was a response to referring to artists who don’t photobash as if they’re producing lower quality work. I personally enjoy seeing the creating of art from scratch right through to an accomplished piece, free of photobashing or tracing, and to be confident that’s what I’m seeing. If someone is showing they trace or photobash, that’s at least honest, but, if that’s not shown, or there’s any uncertainty, that can block any engagement.

@Reptorian I understand what you’re saying about the number of devs and volunteers, and that there are more immediate daily-work things at the top of the list e.g. maybe such as export/share bundles, palette blocks vanish when palette resized? So many awesome features and brushes in Krita, plus the plugins are very exciting, + MyPaint inclusion; kudos. And there isn’t much else to use on Linux, so if Krita became say double the size and less painting-focussed that would have a bit more of an edge than say a Windows/Mac/mobile user would encounter.

Just to add, for any young artists who may be concerned about the reference to tracing … that’s where we all start, openly tracing, genuinely to explore and learn and have fun. Then, if developing art skills is the desire, moving on to seeing the main lines and shapes, and using the pencil/pen to measure and connect those main lines and shapes on the page. Next, realising that lines are like scaffolding, around the things in reality that are all actually shapes without lines, etc.

Now, I actually started to get the selection tool to activate as evidenced by a slow-down then a crash. If it does something, then it’s progress.

1 Like

The crashes has been resolved (with the exception of having empty selection, but that does not matter at this point). I’m at a point of where if I fix a few barrier and there’s like 3 barriers left, then an active selection will get modified after the tool is activated. It disappear.

Here’s the progress based on qDebug:

[14516] Krita DEBUG (Line 154): Boundary of initial mean_p_rgb: QRect(0,0 640x600)
[14516] Krita DEBUG (Line 185): Boundary of var_rrrgrb:  QRect(0,0 640x600)
[14516] Krita DEBUG (Line 185): Boundary of var_gggbbb:  QRect(0,0 640x600)
[14516] Krita DEBUG (212) - Boundary of mean_rgb:  QRect(0,0 640x600)
[14516] Krita DEBUG (212) - Boundary of mean_p:  QRect(199,227 346x309)
[14516] Krita DEBUG (212) - Boundary of mean_p:  QRect(0,0 640x600)
[14516] Krita DEBUG (245) - Boundary of mean_rgb:  QRect(0,0 640x600)
[14516] Krita DEBUG (245) - Boundary of mean_p:  QRect(199,227 346x309)
[14516] Krita DEBUG (245) - Boundary of mean_p_rgb:  QRect(0,0 640x600)
[14516] Krita DEBUG (245) - Boundary of image:  QRect(0,0 640x600)
[14516] Krita DEBUG (319) - Boundary of mean_p:  QRect(0,0 0x0)
[14516] Krita DEBUG (319) - Boundary of mean_p_rgb:  QRect(0,0 0x0)

You see that 0x0? Those 2 are needed to have an area greater than 0 to proceed. Once those get fixed, I should be able to finally have working guided selection.

1 Like