【发布时间】:2014-08-29 20:37:13
【问题描述】:
我在 C++ 中使用 OpenCV for Windows Phone 8.1(Windows 运行时),并由 MS Open Tech https://github.com/MSOpenTech/opencv 发布。
此版本基于 OpenCV 3,medianBlur 函数似乎有问题。 当我使用方形图像时,medianBlur 效果很好,但是当我使用矩形图像时,medianBlur 会产生奇怪的效果......
结果如下:http://fff.azurewebsites.net/opencv.png
我使用的代码:
// get the pixels from the WriteableBitmap
byte* pPixels = GetPointerToPixelData(m_bitmap->PixelBuffer);
int height = m_bitmap->PixelHeight;
int width = m_bitmap->PixelWidth;
// create a matrix the size and type of the image
cv::Mat mat(width, height, CV_8UC4);
memcpy(mat.data, pPixels, 4 * height*width);
cv::Mat timg(mat);
cv::medianBlur(mat, timg, 9);
cv::Mat gray0(timg.size(), CV_8U), gray;
// copy processed image back to the WriteableBitmap
memcpy(pPixels, timg.data, 4 * height*width);
// update the WriteableBitmap
m_bitmap->Invalidate();
我没有找到问题出在哪里...这是我的代码中的错误吗?还是 OpenCV 3 的错误?来自 MS Open Tech 的代码?
感谢您的帮助!
【问题讨论】:
标签: opencv windows-phone-8 winrt-xaml