How can I create histogram from a set of values in OpenCV?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: How can I create histogram from a set of values in OpenCV?

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    21

    How can I create histogram from a set of values in OpenCV?

    I have a text file which consist of several values. These values represent distance from origin to any point in the triangle. How can I create histogram from these values? Is there any functions in OpenCV which can create histogram from these values? Below my sample values are given:

    ..........................

    3.4 1.2 6.9 0.2 5.1 2.9

    ........................

  2. #2
    Join Date
    Feb 2013
    Posts
    21

    Re: How can I create histogram from a set of values in OpenCV?

    I tried in this way , but output is not acceptable.

    Code:
    int main(.......)
            {
            ......................
            double histogram_sample[1][6]={1.0,2.0,3.0,4.0,1.0,2.0};
    
    	Mat histogram(1,6,CV_64F,(void*)histogram_sample);
    
    	
    	int histSize = 4;
    	float range[] = { 1.0, 4.0 } ;
    	const float* histRange = { range };
    
    	bool uniform = true; bool accumulate = false;
    
    	Mat hist;
    
    	calcHist( &histogram, 1, 0, Mat(), hist, 1, &histSize, &histRange, uniform, accumulate );
    
    	cout<<"hist:"<<hist<<endl;
            ...........................
            }
    Output: hist:[0;0;0;0]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center