Re: [Oiio-dev] Histogram calculation

2012-07-20 Thread Stefan Stavrev
I need opinions on how to output histograms. A histogram can be saved as image or text. We can save as text in simple format like: 2 50 ... 3 14 Should I use ofstream? Chris suggested we could just print to standard output and then you could do: our_operation file.txt About saving the

Re: [Oiio-dev] Histogram calculation

2012-07-20 Thread Larry Gritz
My advice is to have an IBA function that computes the histogram and stores it in a std::vectorimagesize_t. This could be helpful to apps, and we know will be useful for other IBA functions that need histogram information. Also, a function that takes a histogram and plots it in an ImageBuf

Re: [Oiio-dev] Histogram calculation

2012-07-20 Thread Stefan Stavrev
I am good with that, and we already have that in the histograms pull request. I am left to deal with final finesses. ___ Oiio-dev mailing list Oiio-dev@lists.openimageio.org http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Re: [Oiio-dev] Histogram calculation

2012-07-06 Thread Stefan Stavrev
1. I quit the class design, it did not work out. Much simpler to have them as separate functions. 2. The only thing that is not there and I mentioned in the proposal is component histograms. At this point the function histograms only one channel for a given image. I think it is better left that

Re: [Oiio-dev] Histogram calculation

2012-07-05 Thread Larry Gritz
I vote that for simplicity, specify number of bins and that will also be the width (one pixel column per bin). They can always resize the resulting image as a separate operation. On Jul 5, 2012, at 1:25 PM, Stefan Stavrev wrote: Agreed. Modifying the height of the histogram will be easy,

Re: [Oiio-dev] Histogram calculation

2012-07-05 Thread Chris Foster
On Fri, Jul 6, 2012 at 6:25 AM, Stefan Stavrev stavrevste...@gmail.com wrote: In summary, the two cases are: 1. User specifies width and number of bins, but we modify number of bins to fit width. 2. User specifies number of bins and X, and we decide about the width. So, if you want a fixed

Re: [Oiio-dev] Histogram calculation

2012-07-05 Thread Stefan Stavrev
Chris, yeah me too. I was about to say ok let's go just with option 2, but you don't need the parameter for width of bins. If you draw it as Larry suggests, then later by resizing to double or triple histogram width you basically get the same thing as if you used the parameter X=2, or X=3 for bins

Re: [Oiio-dev] Histogram calculation

2012-07-05 Thread Chris Foster
On Fri, Jul 6, 2012 at 7:24 AM, Stefan Stavrev stavrevste...@gmail.com wrote: Just one thing, do you want me to put limit for minimum bins? I vote no, but would be cool to hear what you think. So if the user wants 2 bins he will have to live with the fact that what will be drawn won't be that

Re: [Oiio-dev] Histogram calculation

2012-07-05 Thread Stefan Stavrev
At this point it is natural to think about having a Histogram class with methods such as: // getters bins, height, cumulative(is it ordinary or cumulative histogram), min_count, max_count, min_pixel_value, max_pixel_value, background and foreground colors, etc. // statistics mean, deviation,

Re: [Oiio-dev] Histogram calculation

2012-07-04 Thread Kevin Wheatley
Just to add to this, when I typically want to draw a histogram for analytical reasons I like to see every bin clearly. This is usually to look for missing bits or bins in integer image representations. Given that we typically need 10 bits worth as a minimum and increasingly 12, I would want

Re: [Oiio-dev] Histogram calculation

2012-07-04 Thread Stefan Stavrev
Kevin, can you please provide more details? You mean 10 bits per channel? That means 1024 intensity values, and width of histogram that much? And why would you want to search for missing bins? As far as I know the histogram is used to give you a bird eye view of the values distribution.

Re: [Oiio-dev] Histogram calculation

2012-07-04 Thread Stefan Stavrev
Wow Kevin, thanks for the long reply ;). This will be tricky to handle, but I might deal with some common cases. What is a good upper limit for histogram width? 4096? For 16-bit image I can't have width 2^16 and draw bins 1:1, it is too much obviously. Do you have some big histogram image I can

Re: [Oiio-dev] Histogram calculation

2012-07-04 Thread Chris Foster
On Wed, Jul 4, 2012 at 11:51 PM, Stefan Stavrev stavrevste...@gmail.com wrote: What is a good upper limit for histogram width? Why specify an upper limit? Just have a default (small) size, and let the user override it as they please. If the user explicitly says they want 1 bins just assume

Re: [Oiio-dev] Histogram calculation

2012-07-04 Thread Will Rosecrans
On Wed, Jul 4, 2012 at 6:51 AM, Stefan Stavrev stavrevste...@gmail.com wrote: Wow Kevin, thanks for the long reply ;). This will be tricky to handle, but I might deal with some common cases. What is a good upper limit for histogram width? 4096? For 16-bit image I can't have width 2^16 and

Re: [Oiio-dev] Histogram calculation

2012-07-03 Thread Stefan Stavrev
I am working on histogram drawing. What are all the possible ranges of values in one channel I should consider? The usual ranges are 0-1 and 0-255. Any other ranges I should have in mind? ___ Oiio-dev mailing list Oiio-dev@lists.openimageio.org

Re: [Oiio-dev] Histogram calculation

2012-07-03 Thread Chris Foster
On Wed, Jul 4, 2012 at 5:20 AM, Stefan Stavrev stavrevste...@gmail.com wrote: I am working on histogram drawing. What are all the possible ranges of values in one channel I should consider? The usual ranges are 0-1 and 0-255. Everything is converted to a float for our purposes, so these

Re: [Oiio-dev] Histogram calculation

2012-07-03 Thread Will Rosecrans
Should granularity of bins also be a parameter? What is a sane default for floats? Would it make sense to have such a parameter be expressed in terms of size of the bin, or number of bins between the high and low? Histograms are one area where I think things are actually conceptually cleaner in

Re: [Oiio-dev] Histogram calculation

2012-07-03 Thread Stefan Stavrev
Hi Will, You might have some ideas about this. For simplicity sake I made a decision to draw the histogram in a fixed window 256x256. In Photoshop and After Effects the histogram windows are of fixed size too. But in Matlab I believe the image adjusts itself in size, it is not fixed. Usually the

Re: [Oiio-dev] Histogram calculation

2012-07-03 Thread Larry Gritz
How about width equal to the number of bins, height set by user? I worry that fixing width at 256, it's going to be tricky or misleading to have a different number of bins. On Jul 3, 2012, at 3:45 PM, Stefan Stavrev wrote: Hi Will, You might have some ideas about this. For simplicity sake

Re: [Oiio-dev] Histogram calculation

2012-07-03 Thread Stefan Stavrev
I like the height set by user part, can be done easily. Will need to specify min and max height though, for example 100 to 512. In Photoshop the histogram has fixed height 100, smaller heights make no sense, since we want the thing to be visible. But not sure about having variable width. Since I

Re: [Oiio-dev] Histogram calculation

2012-07-03 Thread Larry Gritz
I don't think you should have variable width. The only width that is easy to do is when it's exactly equal to the number of bins you requested for the histogram. Support that only, is fine with me. -- lg On Jul 3, 2012, at 8:21 PM, Stefan Stavrev wrote: I like the height set by

Re: [Oiio-dev] Histogram calculation

2012-07-02 Thread Chris Foster
Hi Stefan, On Fri, Jun 29, 2012 at 10:49 AM, Stefan Stavrev stavrevste...@gmail.com wrote: The contrast algorithm for color images needs histograms so I will have to leave it for now and do histograms first. Which contrast formula do you plan to use, and how does it need a histogram exactly?

Re: [Oiio-dev] Histogram calculation

2012-07-02 Thread Stefan Stavrev
Hi Chris, 1. Which contrast formula do you plan to use, and how does it need a histogram exactly? I imagine exposing the contrast function parameters to the user rather than choosing them automatically. The contrast algorithm for color images needs histogram equalization, and that needs

Re: [Oiio-dev] Histogram calculation

2012-07-02 Thread Chris Foster
On Mon, Jul 2, 2012 at 11:03 PM, Stefan Stavrev stavrevste...@gmail.com wrote: The contrast algorithm for color images needs histogram equalization, and that needs histograms calculations. Can't say now if there will be parameters, since histogram equalization is like an automatic enhancment

[Oiio-dev] Histogram calculation

2012-06-28 Thread Stefan Stavrev
The contrast algorithm for color images needs histograms so I will have to leave it for now and do histograms first. I start with the histogram calculation function only, which only calculates a histogram, there is another function for drawing it. This was done based on previous suggestions from