Ask Your Question

ctagg's profile - activity

2015-12-30 12:20:19 -0600 received badge  Famous Question (source)
2014-05-28 05:40:55 -0600 received badge  Notable Question (source)
2013-10-25 05:11:13 -0600 received badge  Popular Question (source)
2012-12-20 20:32:05 -0600 received badge  Editor (source)
2012-12-20 20:31:01 -0600 asked a question cvtColor crash

I am getting a crash in Visual Studio 2010 express. Unhandled exception at ..., exception: cv::Exception at memory location ...

Also says: OpenCV Error: Assertion failed (scn == 3 || scn == 4) in unknown function, file ......\modules\imgproc\src\color.cpp, line 3256

Stepping through the code the crash happens at cvtColor line

#include <iostream>
#include <dirent.h>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"


int main(int argc, char** argv)
{

    cv::Mat img_1 = cv::imread( argv[1] );
    cv::Mat img_1_gray;

    cv::cvtColor(img_1, img_1_gray, CV_RGB2GRAY);    

    return 0;
}

I have also tried the following demo but crashes at the cvtColor line:

http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html