Assgin value to cv::Mat using Mat.at()
I'm trying to rearrang Mat imageWork which is 800 x 600 Type:8UC3 into kmeansData which is 480000 x 1 Type:32FC3.The Vec3f pixel can fetch vaule correctly but at the last step nothing is copied to kmeansData.In the debbuger it shows kmeansData.data=uchar*='/0'
kmeansData = Mat(imageWork.rows * imageWork.cols, 1, CV_32FC3);
for (int x = 0; x < imageWork.rows; x++) {
for (int y = 0; y < imageWork.cols; y++) {
Vec3f pixel=(Vec3f)imageWork.at<Vec3b>(x, y);
kmeansData.at<Vec3f>(y + x * imageWork.cols,0)= pixel;
}
}
Anybody can explain to me why?