CImg 转置函数给出错误的宽度

CImg transpose function gives wrong width

本文关键字:错误 出错 转置函数 CImg      更新时间:2023-10-16

我正在使用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());
相关文章: