Im Trying to perform a Sobel transform on an image however it gives this error:
error: invalid initialization of reference of type 'cv::Mat&' from expression of type 'IplImage*'|
cv.hpp|254|error: in passing argument 2 of 'void cv::Sobel(const cv::Mat&, cv::Mat&, int, int, int, int, double, double, int)'|
||=== Build finished: 2 errors, 0 warnings ===|
Below shows various ways people have used the Sobel function, I am unable to find any help on this particular issue
Yahoo! Groups
Sobel edge detection on OpenCV | About of Image Processing
I have done it different, but tried the same as above , to follow the manual below.
Is it a case of me misunderstanding what the manual is stating?
Image Filtering — opencv v2.1 documentation
Code:
IplImage* img=cvLoadImage("fight1.png");
CvMat *mat = cvCreateMat(img->height,img->width,CV_32FC3 );
//Get width and height
int w=img->width;
int h=img->height;
//create Images
IplImage* img2=cvCreateImage( cvSize( w, h ), IPL_DEPTH_8U, 1 );
IplImage* img3=cvCreateImage( cvSize( w, h ), IPL_DEPTH_8U, 1 );
//convert to Mat
cvConvert(img,mat);
//prepare stream reader
ofstream ob;
ob.open("object.txt");
//Perform Sobel
cvCvtColor( img,img2,CV_RGB2GRAY);
Sobel(img2,img3,32 ,1,3,1.0,1.0,BORDER_DEFAULT);
//cvLaplace( img, img2);