Histogram and 'auto-levels'

Hi everyone! Faced an interesting problem.

It’s clear to me how get a histogram for an on-screen image. 2 questions:

  1. How to get (compose?) a histogram for a floating-point image (texture)?

  2. How to perform an ‘auto-levels’ (see <your favourite graphics editor>) operation on this fp-image (texture)?

Thanks in advance,

Dmitry.

  1. Текстура с одним каналом - это и есть гисторамма. Для текстуры RGB гистораммой будет текстура с одним каналом, полученным как максимум соответстующих точек.

  2. Найди максимальное число в гисторамме - М. Это число нужно поднять до максимально возможного в формате текстуры. Например, если М = 200, а макс. возм. = 255, то все каналы первоначальной текстуры умножай на (255 / 200).

З.Ы. Приятно встретить земляка на иноземном форуме, и диалог получился приватный :slight_smile:

well, that’s what i call a clear answer to the problem.

but, may i add the following comment: if you solve your problem in the recommended way,
you should not forget to это и есть гисторамма, before you Найди максимальное число в гисторамме…

Grand thanks to both of you! Признаюсь, поначалу был слегка шокирован языком ответа, нельзя так людей пугать :slight_smile:

AFAIK, histogramm value is not max from RGB, it’s the luminance value for given pixel…
float pix_lm = pixcol.r0.2125f+pixcol.g0.7154f+pixcol.b*0.0721f;

Calculating histograms for floating point images is a bit more complicated since there are an arbitrary number of color ranges in the image, but usually you just find the minimum and maximum and then subdivide this range into n buckets.

Auto levels in Photoshop essentially just scales the colors in an image so that the minimum value is mapped to 0 and the maximum to 255 for each channel.

It an attempt to make this relevant to OpenGL - there is an example of using occlusion query to calculate histograms in our SDK:
http://download.developer.nvidia.com/dev…gproc_histogram

и диалог пришел из приватного.
как приватно как вы могл думать…не технология перевода чудесна?

возможно мы будем свободно языковойа барьер скоро.

наилучшия пожелания,
bonehead

Problem solved, thank you all!

And, as I see, language barrier is a problem no more too :-))

As transfer technics is working than why not writing on rus layout… :slight_smile:

Are coefficients may be other. There are many colorymetry government standarts in Russia at any rate are existing. But I am sure what this type of histogram is shall suit to declared intend.

May I point out that this is an international forum? Please post in English or don’t post at all.

Henceforth i shall look after keyboad layout. I’m sorry… :slight_smile: