【发布时间】:2011-11-18 04:23:17
【问题描述】:
我有一个大问题。在网上搜索后,我没有找到一个好的解决方案。我通过opencv(2.3)从文件中读取图像并对其进行操作。之后我想在我用 wxwidgets (2.9.3) 编写的应用程序中展示结果。主要问题是,我的图像是灰度的,所以我只有一个数据指针,但 wxwidgets 只使用 RGB。只是一个小例子:
cv::imread(filename,CV_LOAD_IMAGE_GRAYSCALE).convertTo(pictureMatrix,CV_32F,(float)(1/2.0f),0);
// here are some more floating point calculations
cv::Mat output;
pictureMatrix.convertTo(output,CV_8U);
wxImage test(output.rows, output.cols, output.data, true);
wxInitAllImageHandlers();
// saving the picture is just for testing, if it works
test.SaveFile("test.png", wxBITMAP_TYPE_PNG);
【问题讨论】: