YOUR ACCOUNT

Login or Register to post new topics or replies
TheBeat
Beat
Posts: 165
By using RGBmath components, I often get values beyond the normal 0-1 scope. In order to scale these values back into the 0-1 range, I need to extract the darkest and lightest value from the image after the RBmath operation.

Simple example : I add two images or noises. I am bound to end up with values > 1. How do I extract the highest value of the result from adding, so I can use the divide component to scale the values back to 0-1, by using the maximum value as divisor. The Maximum- and Minimum Level components in FF only work for the input image and not somewhere down the line. I need one value for the maximum (minimum) from a greyscale result. In RGB I'd need also one value, the max and min from all the R,G and B values. Any suggestions?
The Stone Age did not end because they ran out of stones. Niels Bohr
  Details E-Mail
Sphinxmorpher
Filter Optimizer

Posts: 1750
Filters: 39
  Details E-Mail
Sphinxmorpher
Filter Optimizer

Posts: 1750
Filters: 39
Oh.. it doesn't do HDR. I'll make an updated version.
For now just divide/multiply the input by a reasonable range (e.g. Input / 1000 -> Auto Levels -> Output * 1000)
  Details E-Mail
TheBeat
Beat
Posts: 165
Thanks a lot, Sphinxmorpher. I have looked at your filter, and looked again, and again but I don't get it. Sorry.

My guess is that the part that I need starts with the Minimum just after the'Assemble RGB'. Instead of the Result of 'Assemble RGB', I put my image or Noise that has values >1 and/or <0 into the Minimum component. The part I don't get, is the 'Extract R' and 'Extract G inverse'. Are these the highest and lowest values in the image?

I see where the culprit is why it's not working for HDR : the Maximum and Minimum components are not made for HDR.

Quote
For now just divide/multiply the input by a reasonable range (e.g. Input / 1000 -> Auto Levels -> Output * 1000)


I would like to work more precise, so really getting the highest and lowest value from the HDR image to do exact scaling. The LookUp component would do, if only it would know at which coordinate to sample. Dividing by 1000 (even by 10) makes things less precise. With an addition of two NOT HDR images, I can never get bigger than 2. With other operations I might. So I'd really like a image dependent scaling divisor.

The problem is even a bit more complicated for values <0. There I need to add the biggest negative value, so I get to a minimum of 0. Then get the highest value and do the division.

I was surprised that the Maximum- and Minimum Level components are only working on the input image, and we are not able to plug it in somewhere down the line. That would solve the thing and be very handy in a lot of cases.

Sphinxmorpher, thanks for your time and effort,
Beat
The Stone Age did not end because they ran out of stones. Niels Bohr
  Details E-Mail
Sphinxmorpher
Filter Optimizer

Posts: 1750
Filters: 39
About the inverted G value - if you apply Minimum on an inverted image and then invert the result you get the Maximum. So it is really just an optimization to avoid two bitmap based components (i.e. a maximum and a minimum - they are slow). The tradeoff is that it only works for grayscale/one channel.

I started working on a HDR version - but I'm having some difficulties with the internal precision of the Minimum and Maximum components.

An exact solution in a procedural processing context like Filter Forge requires *all* samples to be rendered and inspected. That is very expensive and actually quite difficult with subsampling taken into account too. But we can get close using an approximation.

Actually it might be an idea for the renderer - we already have an option for clipping HDR values before subsampling. It would be useful with a "Scale HDR to LDR". Of course that wouldn't help in intermediate processing steps when constructing a filter.

I'll keep you updated when I find a way around that internal precision issue
  Details E-Mail
TheBeat
Beat
Posts: 165
Quote
About the inverted G value - if you apply Minimum on an inverted image and then invert the result you get the Maximum. So it is really just an optimization to avoid two bitmap based components (i.e. a maximum and a minimum - they are slow).


I get it now. I am still thinking to basic and havn't paid too much thoughts about optimizing. I am already glad if I get going what I intend to - and learn about the different components. It's really great toying with this stuff.

Quote
I started working on a HDR version - but I'm having some difficulties with the internal precision of the Minimum and Maximum components.


I noticed too, that the Minimum and Maximum components cannot work with HDR. I also noted that with normal (LDR) signals, I sometimes have to put in up to 3 or 4 max components in sequence to get an even grey value (Radius of all of them at 100).

Quote
That is very expensive and actually quite difficult with subsampling taken into account too


Please forgive me if I talk nonsense, I am really new to FF, but I think that extracting the max or min value would only need a sampling once of all pixels, so no subsampling needed here. We would need 2 components like Maximum Level and Minimum Level (from the External category), only with a map input.

Quote
Actually it might be an idea for the renderer - we already have an option for clipping HDR values before subsampling. It would be useful with a "Scale HDR to LDR". Of course that wouldn't help in intermediate processing steps when constructing a filter.


That's it exactly. I am trying to do just that, scaling the HDR into the LDR range. If there would be or become in future such a component, that would be great. In the meantime we have to come up with 'a cunning plan' smile:-)

Please keep me updated of anything you might find and thanks for your kind help.

Beat
The Stone Age did not end because they ran out of stones. Niels Bohr
  Details E-Mail
Sphinxmorpher
Filter Optimizer

Posts: 1750
Filters: 39
Quote
TheBeat wrote:

Quote
That is very expensive and actually quite difficult with subsampling taken into account too


Please forgive me if I talk nonsense, I am really new to FF, but I think that extracting the max or min value would only need a sampling once of all pixels, so no subsampling needed here. We would need 2 components like Maximum Level and Minimum Level (fr om the External category), only with a map input.


It is not a simple thing to explain.. you're really up against the fundamental differences of the between discrete and continuous sampling/processing smile:-D

Some algorithms only work in practice with discrete sampling, e.g. blur/sharping/min/max and more. In FF they are called bitmap based components since they perform internal rendering to a bitmap - i.e. the continuous signal is converted to a discrete representation, somewhere around the image resolution (some components seem to be able to change this... no one knows how that really works).

So when we use a bitmap based components to find min/max and the use these values to scale the result, the antialias process (which may be as high as 25 subsamples) may find subsamples that are out of range. This is because the bitmap based components only - if enabled - perform a simple 4x subsampling (IIRC!).

I think you're better off rendering your intermediate HDR result to a new file/tab and the use the build in input min/max to scale in a second processing step. Get the idea?
  Details E-Mail
Sphinxmorpher
Filter Optimizer

Posts: 1750
Filters: 39
Quote
Sphinxmorpher wrote:
I think you're better off rendering your intermediate HDR result to a new file/tab and the use the build in input min/max to scale in a second processing step. Get the idea?


Okay, that was a bad advice. It turns out that even the Minimum/Maximum Level components in the External category does not support HDR. This makes it impossible to convert HDR to LDR in FF in a manner that scales the complete HDR range into LDR. Ouch. I'll add an entry to the wish list.
  Details E-Mail
TheBeat
Beat
Posts: 165
Quote
Sphinxmorpher wrote : you're really up against the fundamental differences of the between discrete and continuous sampling/processing


I get that. I guess to extract the Max value, FF needs to make a discrete ímage'from that point in the procedural (analogue) flow, just like making a Blur. And no sub-sampling will be needed. But then again, that is just a guess, as I am unfamiliar wioth the inner workings of FF.

Quote
It turns out that even the Minimum/Maximum Level components in the External category does not support HDR. This makes it impossible to convert HDR to LDR in FF in a manner that scales the complete HDR range into LDR. Ouch. I'll add an entry to the wish list.


Thanks for the rectification. I had not come around to trying it. It makes we wonder though why the Min- and Max level component cannot deal with HDR. HDR is a wonderful feature of FF and many components can deal with it. Why not those two. Or should I ask why there is no FF-way to scale from HDR to LDR. If you wotk with these two, it would only seem logical to be able to convert between them.

It would be great if you can put it onto the wish list - I certainly will second it.
I have no idea how good FF is in listening to user's wishes, but I hope they will. It seems such an essential feature.

Thanks, Beat
The Stone Age did not end because they ran out of stones. Niels Bohr
  Details E-Mail

Join Our Community!

Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!

33,711 Registered Users
+18 new in 30 days!

153,531 Posts
+39 new in 30 days!

15,347 Topics
+72 new in year!

Create an Account

Online Users Last minute:

23 unregistered users.