Idea for a new dt module - Posterize

Nope! Impossible to say really.

@europlatus , Do you think the new Blurs module is niche?
Blurs “simulates physically-accurate blurs in scene-referred RGB space”
It looks pretty niche to me. There are already ways to blur photos in dt, and this module is not exactly exciting, simulating as it does effects that are usually considered a defect!

I still think there is mileage in a posterize module. It would allow people to be creative and experiment in dt with stuff like this -

It was exciting enough for a developer to spend effort for it. That’s what’s relevant :wink:

I think the blur module is exciting, since I shoot a lot with a 24mm lens and even wide open, it doesn’t blur things very well. Being able to add realistic blur is really nice.

1 Like

Have you found it noticeably different to the various blur tools dt already had? -

  • surface blur in diffuse/sharpen module
  • surface blur module
  • censorize module
  • blur tool in retouch module
  • bloom module

Yes, none of the modules you mentioned can simulate motion blur or somewhat physically accurate lens blur (as in bokeh).

2 Likes

I think the key question for a module which can be used only for artistic / aesthetic purposes is whether you want to do anything else with it afterwards, for which you need the capabilities of Darktable.

If yes, a good case can be made for it having it in Darktable. The scene-referred blur module is a good example: it operates in linear RGB space, so you can do color manipulation, tone mapping, etc afterwards.

An example of what you would do in Darktable after posterization would help make a better case for this module. Otherwise, you can just export and use other tools. It is of course understood that this is less convenient than having a single tool for everything, but all software tools are specialized to some extent. LUA scripting can make your workflow smoother.

Bokeh is not considered a defect. The Blurs module was not a good example of the point you are trying to prove. Besides, whether I would consider it niche or not, which I don’t, its existence is down to the fact that the developer wanted to implement it. And this is pretty much how the whole of darktable has been developed.
If a developer wants to add a posterize module, I’m sure it will get developed.

And the corollary to that is: if none of the current developers is interested, you’ll have to implement it yourself (iirc, that’s how the filmic module started)

@flannelhead ,
I was asking paperdigits. I think he was talking about simple blurring, not motion.
Bokeh is interesting. I believe it’s down to lens design. Some lenses are great, others poor. My guess is that the process described in the user manual is not going to render the subtleties of a lens designed for good bokeh, with all due respect to whoever developed this.

@Tamas_Papp ,
You say “only for artistic / aesthetic purposes” - I hope you don’t think these are a poor relation as compared to photo-realistic processing!
In any case, I don’t get your logic. dt, RT, Gimp, Art, Krita… they would look very different if the approach had been to export to a different app rather than extend the app you already use. But anyway, of course you might want to do things after posterizing. Changing the colours delivered by the posterize. Altering saturation. Tweaking with a tone curve. Etc. dt can do all this. And remember it’s a creative process!

@europlatus ,
Ok, so we disagree about it being niche or not.
I agree bokeh is not a defect.

@rvietor ,
Yes, I accept someone has to want to do it! But look how well filmic has turned out, and yet you imply the devs weren’t interested initially.

I don’t know if the team at that time wasn’t interested, I seem to remember that @anon41087856 starting coding for dt to implement filmic.

1 Like

I was talking about out of focus lens blur/bokeh. It wasn’t clear you were talking to me since your question doesn’t make sense with what I had written.

Yes it looks more like out of focus blur than other modules, especially

  • censorize → gives you blocks
  • retouch blur → sort of Gaussian, good for skin retouching. Can’t apply it by using a sharpness mask, its brush based
  • bloom → film-ish foggy highlights

Haven’t played with the diffuse or sharpen blur yet, but its a diffusion blur.

There already is posterization code inside Tone EQ by the way, it’s meant to help the masking in some situations. Somebody can just copy-paste the logic (it’s easy) and start on that. I have a lot on my plate already.

2 Likes

@paperdigits , I think it does make sense, it comes immediately after your comment, and as blurs is fairly new, I assumed you must have been using one of the other blur tools previously. Hence I asked about the difference.

censorize doesn’t necessarily give you blocks. If you have pixelation radius at zero, the default, there are no blocks.

This is pedantic, the modules clearly aren’t even close to the same if you’ve used them in the slightest.

On second thought, you don’t even need to bother about doing archaeology in Tone EQ. Posterization is super easy:

  1. Normalize pipeline RGB with pipeline white point, such that RGB gets encoded between [0; 1]. That is, divide RGB by the white point,
  2. Multiply the normalized RGB by the number of bands you want (let’s call that n),
  3. Round the n×RGB result to the closest integer,
  4. Divide back by n,
  5. Denormalize to pipeline RGB, that is multiply back by the white point.

You will find a boilerplate module in src/iop/useless.c, you can start hacking this. The pixel loop is already in there, and the only C function you will need is roundf(). All the rest is basic algebra.

1 Like

@anon41087856 , I’m so pleased someone is taking an interest! Thanks.

Can I humbly make a point about colour spaces, even though I don’t understand them very well -

If posterize progresses, could it be generalised in the sense that it might work on RGB, Lab, HSL?, JzCzhz, with the user choosing which. And the user choosing 1, 2 or all 3 channels to be posterized in the chosen space. The idea being maximum flexibility/creativity.

What would be the use case ?

I have a feeling that what you want to achieve can already be done with bilateral blurring.

You might want to reduce an image to just say 5 hues but not interfere with brightnesses. Or leave colours alone but have 4 brightness levels. Or just posterize the blue channel to see what you get! I think it’s the ability to experiment that is useful.

Could you expand on bilateral blurring pls? Can I try that in current dt somehow?

@paperdigits , pedantic or not, it’s nice to get to the bottom of things. Here are 3 versions of a crop - straight, one with censorize, one with blurs. Can you tell which is which? Which is the better blurring would you say? (I’ve tried to make the “overall blurring” comparable)