I am trying to apply the inbuilt laplacian operator on an image but I am getting error "error: (-213) Unsupported combination of source format (=0), and destination format (=4) in function getLinearFilter" Please tell how to resolve. Complete code:
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std; using namespace cv;
const char ImageFilePath[] = "/home/user/Downloads/skeleton.tif";
/** * @function main */
int main( int argc, char** argv ) { Mat src, dst; Mat gray;
gray = Mat(gray.rows, gray.cols, CV_32SC1);
// Load image
src = imread( ImageFilePath, 1 );
if( !src.data )
{ return -1; }
cvtColor(src, gray, CV_BGR2GRAY);
Mat res,abs_dst; res = gray.clone();
namedWindow("src image", CV_WINDOW_AUTOSIZE ); imshow("src image", gray );
Laplacian( gray, res, CV_32SC1, 3, 1, 0, BORDER_DEFAULT ); namedWindow("Laplacian", CV_WINDOW_AUTOSIZE );
imshow("Laplacian", res );
waitKey(0); return 0; }