【发布时间】:2014-11-12 02:08:20
【问题描述】:
我使用 OpenCV 制作了一个工作应用程序,该应用程序在程序完成后会导致 linux mint 崩溃(返回 0;)。
我已将代码缩小到下面的 sn-p。当使用函数 cvtColor 时,程序会崩溃。当代码运行时,没有什么奇怪的事情发生,而 cvtColor 正在做它的工作。
我不是 c/c++ 程序员,我什至不知道在哪里可以进一步了解导致此问题的原因或如何找到可以帮助我在 google 上找到解决方案的东西。
有人能指出正确的方向吗?
OpenCV 版本:3.0 运行于:3.11.0-12-generic #19-Ubuntu x86_64 x86_64 x86_64 GNU/Linux
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <string>
using namespace std;
using namespace cv;
int main( int argc, char** argv )
{
Mat frame1;
Mat grayImage1;
frame1 = imread("lena.jpg");
cvtColor(frame1, grayImage1, COLOR_RGB2BGR);
return 0;
}
【问题讨论】:
-
您是否使用了正确的库(例如调试与发布)?
-
“崩溃”是什么意思?有错误信息吗?
-
Linux 冻结了大约 2 分钟,然后似乎 x 服务器已重新启动。我没有任何错误消息,可能是因为在它冻结之前我看不到它们。屏幕“崩溃”时会显示一些奇怪的模式,并通过重新启动 x 自行恢复。