OpenCV无法读取图像! [英] OpenCV can't read image!

查看:180
本文介绍了OpenCV无法读取图像!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码:

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>
#include <cxcore.h>
#include <cxtypes.h>

int main(int argc, char* argv[])
{
 IplImage* img = cvLoadImage( "dow2oc8.png" );
 cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
 cvShowImage("Example1", img);
 cvWaitKey(0);
 cvReleaseImage( &img );
 cvDestroyWindow( "Example1" );
 return 0;
}

我拿出了英镑符号和脚镣
我可以'让它读取图像文件,我已将文件添加到项目中。
我接下来应该做什么

I took out the pound signs and carrets and I can't get it to read the image file, I have added the file to the project. What should I do next

推荐答案

我的第一个猜测是它试图从某个位置加载png文件除了png文件实际上的位置。它是否在项目中并不重要 - 它在磁盘上的哪个位置?原因是,如果没有指定路径,它可能应该在您的可执行文件运行的文件夹中 - 如果您将其添加到项目中,它可能不是。

My first guess would be that it's attempting to load the png file from a location other than where the png file actually is. It doesn't matter whether it's in the project or not - where is it on disk? Cause, with no path specified, it should probably be in the folder your executable is running from - which, if you added it to the project, it probably isn't.

这篇关于OpenCV无法读取图像!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆