【发布时间】:2015-04-09 08:06:36
【问题描述】:
Apple 没有提供类似于“OpenCV”或“Eigen”的加速矩阵调试工具吗?
Eigen 和 OpenCV 如何打印矩阵的示例代码
Eigen::Matrix4f matrix;
std::cout << matrix << std::endl;
4x4 矩阵的输出
-0.483662 0.86859 0.10781 51.8456
0.865028 0.455597 0.210137 29.6781
0.133405 0.194894 -0.971709 192.69
0 0 0 1
我想要的粗略近似,但还不够笼统。
这是我的快速和肮脏的版本。我最终可能会在处理 C 或 C++ 版本的地方使它更彻底,但我真的希望 Apple 提供它,我只是没有找到文档。
void logSIMD(const simd::float4x4 &matrix)
{
std::stringstream output;
int columnCount = sizeof(matrix.columns) / sizeof(matrix.columns[0]);
for (int column = 0; column < columnCount; column++) {
int rowCount = sizeof(matrix.columns[column]) / sizeof(matrix.columns[column][0]);
for (int row = 0; row < rowCount; row++) {
output << std::setfill(' ') << std::setw(9) << matrix.columns[column][row];
output << ' ';
}
output << std::endl;
}
output << std::endl;
NSLog(@"%s", output.str().c_str());
}
有没有人为 Accelerate 中各种大小的矩阵和向量的 C/C++ 打印提供通用解决方案,或者 Apple 提供了我还没有找到的功能?
【问题讨论】:
标签: ios objective-c opencv eigen accelerate-framework