CImg 转置函数给出了错误的宽度
CImg transpose function gives wrong width
我正在使用 CImg 进行图像处理作业。使用以下代码调用 transpose() 后
cout << image_subsample.width() << ","<<image_subsample.height() << "transpose:" << image_subsample.transpose().width() <<"," <<image_subsample.transpose().height() << endl;
输出为
1200,1transpose:1200,1200
转置的预期输出是
1200,1transpose:1,1200
我是不是漏掉了什么?
在你的例子中你实际上转置了你的矩阵两次,所以你得到的输出是合乎逻辑的。
使用 get_transpose() 或更好地将转置矩阵存储在某处,然后再显示其大小。
CImg<> transp = img.get_transpose();
fprintf(stderr,"%d,%d",transp.width(),transp.height());
我正在使用 CImg 进行图像处理作业。使用以下代码调用 transpose() 后
cout << image_subsample.width() << ","<<image_subsample.height() << "transpose:" << image_subsample.transpose().width() <<"," <<image_subsample.transpose().height() << endl;
输出为
1200,1transpose:1200,1200
转置的预期输出是
1200,1transpose:1,1200
我是不是漏掉了什么?
在你的例子中你实际上转置了你的矩阵两次,所以你得到的输出是合乎逻辑的。 使用 get_transpose() 或更好地将转置矩阵存储在某处,然后再显示其大小。
CImg<> transp = img.get_transpose();
fprintf(stderr,"%d,%d",transp.width(),transp.height());