tags:

views:

164

answers:

2

I've noticed in the O'rielly book that when using histograms it refers to a cvMatND data structure. However, the book does not explain what this data structure is used for and how its different then cvMat. Can someone please explain this to me? Thank you.

A: 

Maybe this helps: http://opencv.willowgarage.com/documentation/python/basic_structures.html

Konamiman
Hmm, so from that page I was able to see that it's multi-dimensional while cvMat is just a single dimension. Am I understanding this correctly?
Sevaj Ba
cvMat is actually a matrix (so, it has two dimensions).
Konamiman
+1  A: 

cvMat is two-dimensional (multi-channel) array, i.e., a matrix.
cvMatND is an n-dimensional (multi-channel) array.

See the Basic Structures section in the CXCORE reference manual.

Update:

A histogram can be computed in arbitrary dimensions, therefore the definition of the CvHistogram structure uses CvMatND to store multidimensional histograms to a dense multidimensional array structure.

typedef struct CvHistogram
{
    int      type;
    CvArr* bins;
    float thresh[CV_MAX_DIM][2]; // for uniform histograms
    float** thresh2;             // for nonuniform histograms
    CvMatND mat;                 // embedded matrix header
                                 // for array histograms
}
CvHistogram;
rcs
Could you please explain why you would use one over the other, I'm a newb at openCV and computer vision so this is really difficult for me to understand without an example.
Sevaj Ba
Thank you very much
Sevaj Ba
Feel free to accept my answer since it seems to have solved your problem ;)
rcs