mat.at() not returning correct values after setting labels with rowrange()
I have this code:
// Create the labels
cv::Mat labels(100, 1, CV_32SC1);
// first 50 labels of positive samples = 1.0
labels.rowRange(0, 50) = 1.0;
// last 50 labels of negative samples = -1.0
labels.rowRange(50, 100) = -1.0;
//print labels
for (int i = 0; i < 100; i++)
std::cout << "Label:" << i << " = " << labels.at<float>(i) << std::endl;
But something is wrong because my output looks like this:
Label:0 = 1.4013e-45
Label:1 = 1.4013e-45
Label:2 = 1.4013e-45
Label:3 = 1.4013e-45
....etc
The only values should be 1.0 or -1.0 yet I keep getting 1.4013e-45.