Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Convert Mat to std::set

I have a cv::Mat that contains labels (the name of each class used in the training of a classifier). Now I want to check for confusion matrix from the labels and the predictions. I am doing this for each class, so I have done it in a function that I want to call for each label, so, it would be nice to create a std::set of labels. The labels are of type float, so the cv::Mat is CV_32F, but cv::Mat::data, cv::Mat::datastart and cv::Mat::dataend are *uchar, so the std::set is not having the correct labels.

std::set< float > lbls(lblMat.datastart, lblMat.dataend); // should be 100, 101, 102, ...
                                                          // but is 0, 63, 72, ...

Any other ideas, please?