I'm trying to convert an image from RGB to grayscale. However, I am getting this error when trying:
OpenCV Error: Null poi开发者_开发技巧nter in unknown function, file ......\ocv\opencv\src\cxcore\cxarray.cpp, line 2376
Why might this be happening?
I was getting the same error, later discovered that the Iplimage I was getting as the source was null. try putting breakpoints and check whether the src image(CvArray) is not null. and do create a dst image by cvCreateImage()
Are you sure img and bw_img is a valid pointer, and not NULL by any chance?
The destination image must exist - it's not created by cvtColor() otherwise you would have to pass a pointer to a pointer.
http://opencv.willowgarage.com/documentation/miscellaneous_image_transformations.html#cvtcolor
"dst – The destination image of the same data type as the source. The number of channels may be different"
Notice the following:
..The destination image of the same data type as the source.
Otherwise, you'll crash.
精彩评论