Siderevs

December 02, 2005

1D Histogram with OpenCV C++

I'd like to say again that the documentation of the OpenCV is very poor.

This is a histogram of 1D for an image of 8 bit single channel (grayscale).

The code is commented for an easier understanding.

I used the same image to obtain the histogram as i made it in Python

1D histogram


The advantage of the opencv histograms functions is that you can obtain a histogram of n - dimensions.

Labels:

7 Comments:

  • Good job!!! with OpenCV

    By Anonymous Anonymous, at 11:29 AM  

  • How to create RGB picture histogram?

    By Anonymous Humbler, at 8:55 PM  

  • Good job, but how i find objects and backgrounds thresholds?????

    By Anonymous Anonymous, at 8:57 AM  

  • really really nice thxxxx :-D

    worldwide

    By Blogger enrico, at 3:50 PM  

  • Nicely done. I agree on the lack of examples and tutorials for open CV. Especially the python wrapper.

    By Anonymous Alp Tilev, at 3:34 PM  

  • I'm surprised. I thought the library was documented decently in the ref folder.... at least it's had everything I needed to learn, though I haven't done many heavy-duty tasks yet. Check out their yahoo group too which is helpful.

    By Blogger William, at 1:19 PM  

  • Nice...

    Also there is an example of how to make a 2D histogram in the opencv documentation... you can see it here:

    http://www710.univ-lyon1.fr/~bouakaz/OpenCV-0.9.5/docs/ref/OpenCVRef_ImageProcessing.htm#ch2_histograms

    It is shown as:
    "Sample. Calculating and displaying 2D Hue-Saturation histogram of a color image"

    Also you should add these lines at the end of your code to prevent memory leaks (imagine the case you want to make continuous histograms of images at 30 fps...)

    cvReleaseImage(&imgHistogram);
    cvReleaseImage(&image);
    cvReleaseImage(&gray);
    cvReleaseHist(&hist);

    By Blogger samontab, at 12:37 PM  

  •  

Post a Comment

<< Home