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