【发布时间】:2017-06-30 09:30:33
【问题描述】:
我有一个 640 x 480 CV_8UC3 Mat image 并且想要执行 k-means 分割。所以我需要把它转换成CV_32F(这里没问题),重塑它,然后运行k-means。
问题是reshape() 什么都不做:
cv::Mat colorMat;
image.convertTo (colorMat, CV_32FC3);
std::cout << colorMat.size () << "; ch: " << colorMat.channels () << std::endl; // [640 x 480]; ch: 3
colorMat.reshape (1, colorMat.rows * colorMat.cols); // Here I expect it to become [307200 x 3], 1 channel - each column representing a color component
std::cout << colorMat.size () << "; ch: " << colorMat.channels () << std::endl; // [640 x 480]; ch: 3
我做错了吗?
【问题讨论】: