在 Windows Server 2012 R2 中使用 OpenCV 的 Canny 函数时 C++ 崩溃

在 Windows Server 2012 R2 中使用 OpenCV 的 Canny 函数时 C++ 崩溃

问题描述:

while (true)
{
    cap.read(frame);

    if (frame.empty())
    {
        cap.release();
        break;
    }

    cv::cvtColor(frame, frame, CV_BGR2GRAY);
    cv::GaussianBlur(frame, frame, cv::Size(3, 3), 1.8);

    cv::Mat edgeImage;
    cv::Canny(frame, edgeImage, 120, 255, 5);

    imshow("window", edgeImage);
    cv::waitKey(15);
}

带有 Update3 的 Visual Studio 2015.使用 OpenCV 3.4.3(x64) 构建 x64.

Visual Studio 2015 with Update3. Build it x64 with OpenCV 3.4.3(x64).

这是一个非常奇怪的错误.

This is very strange error.

在 Windows7 中运行此应用程序时,没问题.但在 Windows Server 2012 R2 中,不工作.应用崩溃并死机.

When run this app in Windows7, It's OK. But in Windows Server 2012 R2, Not working. App crash and dead.

应用程序崩溃后,我在控制面板中发现登录事件查看器.

After app crash, I found log in Event Viewer in Control Panel.

无法访问文件C:WindowsSystem32vcruntime140.dll"

Can't access file 'C:WindowsSystem32vcruntime140.dll'

但是文件在那里,而且我还安装了所有 VC++ 运行时重新分发包 (2005,2008,2010,2012,2013,2015) x86 和 x64.

But the file is in there, and also I installed all of VC++ runtime redistribution package (2005,2008,2010,2012,2013,2015) x86 and x64 both.

更多,这是最好的奇怪的东西.当我评论 cv::Canny 时,应用程序运行良好!(当然,我将 imshow 行下方更改为 imshow("window", frame);)

More, Here is best stange things. When I comment cv::Canny and app works just fine! (of course I change below imshow line to imshow("window", frame);)

我不知道这个应用程序发生了什么...请给我任何建议.

I don't know what happended to this application... Please give me any advice.

由于某些原因,我无法在 Server 2012 R2 中使用 VS2015 进行调试

问题已解决.

服务器 CPU 为 Intel Xeon Gold 6126.

The server CPU is Intel Xeon Gold 6126.

我认为 OpenCV 3.4.3 有一个关于它的错误.

I think OpenCV 3.4.3 has a bug about it.

OpenCV 3.4.5 运行良好.

OpenCV 3.4.5 works great.