首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从学习Opencv,O‘’Reilly看运动2-4的运行问题

从学习Opencv,O‘’Reilly看运动2-4的运行问题
EN

Stack Overflow用户
提问于 2011-08-24 15:54:03
回答 1查看 941关注 0票数 0

我正在研究布拉德斯基和凯勒的“学习oPENCV,O‘’Reilly”一书。我在Ubuntu10.10上,前面的例子很好,但是在2-4中我遇到了一个问题。

这是代码:

代码语言:javascript
复制
#include "cv.h"
#include "highgui.h"

void example2_4( IplImage* image )
{
    // Create some windows to show the input
    // and output images in.
    //
    cvNamedWindow( "Example2_4-in", CV_WINDOW_AUTOSIZE );
    cvNamedWindow( "Example2_4-out", CV_WINDOW_AUTOSIZE );

    // Create a window to show our input image
    //
    cvShowImage( "Example2_4-in", image );

    // Create an image to hold the smoothed output
    //
    IplImage* out = cvCreateImage(
        cvGetSize(image),
        IPL_DEPTH_8U,
        3
    );

    // Do the smoothing
    //
    cvSmooth( image, out, CV_GAUSSIAN, 5,5 );
    cvSmooth( out, out, CV_GAUSSIAN, 5, 5);

    // Show the smoothed image in the output window
    //
    cvShowImage( "Example2_4-out", out );

    // Be tidy
    //
    cvReleaseImage( &out );

    // Wait for the user to hit a key, then clean up the windows
    //
    cvWaitKey( 0 ); 
    cvDestroyWindow("Example2_4-in" );
    cvDestroyWindow("Example2_4-out" );

}

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

这是一个错误:

/build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp,文件:

alberto@zefiro:/tmp$ g++ pkg-config opencv --cflags --libs ch2_ex2_4.cpp alberto@zefiro:/tmp$ ./a.out tree.avi OpenCV错误:坏参数(数组应该是CvMat或IplImage)第1233行在抛出'cv::Exception‘实例之后调用/build/buildd/opencv-2.1.0/src/cxcore/cxarray.cpp:1233:错误:(-5)数组应该是函数cvGetSize中的CvMat或IplImage

已中止

会是什么??有什么建议?我没有修改这个例子,我刚刚用synaptic下载了opencv,所以我认为它是在最后一个版本上!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-24 16:09:38

代码语言:javascript
复制
./a.out tree.avi

您正在传递一个视频文件,而示例需要一个图像。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7178517

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档