0

我知道我的问题类似于:

使用 imshow 的 OpenCV 2.0 C++ API:返回未处理的异常和“坏标志”

尽管我已经尝试了此页面以及其他相关页面中所有建议和验证的解决方案,但我仍然面临窗口名称损坏的相同问题。这是我的代码:

#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
#include <math.h>
#include <iostream>
#include <stdio.h>
#include <string.h>   
#include <malloc.h>   
#include <math.h>   
#include"ip.h"  
#include"histogram.h"
#include <opencv2\highgui\highgui.hpp>
#include "opencv2/core/core.hpp"

using namespace cv;
using namespace std;

void main()
{
    IplImage *img01 = cvLoadImage("E:\liberty.jpg",CV_LOAD_IMAGE_GRAYSCALE);
    cv::Mat img1(img01, false);
    cv::namedWindow("Image 1");
    cv::imshow("Image 1",img1);
    cv::waitKey(0);
    cv::destroyWindow("Image 1");
}

我该怎么办?请帮忙。

4

1 回答 1

0

您的图像是否加载到 img01?

尝试将 IplImage 中的 '\' 更改为 '/' *img01 = cvLoadImage("E:\liberty.jpg",CV_LOAD_IMAGE_GRAYSCALE);

于 2013-05-06T13:00:49.147 回答