Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Getting error -213: Unsupported combination of source format (=0), and destination format (=4) in function getLinearFilter

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; }
click to hide/show revision 2
retagged

updated 2015-03-30 09:45:51 -0600

berak gravatar image

Getting error -213: Unsupported combination of source format (=0), and destination format (=4) in function getLinearFilter

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; }

Getting error -213: Unsupported combination of source format (=0), and destination format (=4) in function getLinearFilter

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 );

  gray = Mat(src.rows, src.cols, CV_32SC1);

  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; }

Getting error -213: Unsupported combination of source format (=0), and destination format (=4) in function getLinearFilter

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;



  // Load image

  src = imread( ImageFilePath, 1 );

  gray = Mat(src.rows, src.cols, CV_32SC1);

  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 );   

  res += gray;

  namedWindow("Laplacian", CV_WINDOW_AUTOSIZE );   
  imshow("Laplacian", res );

   waitKey(0);    return 0; }

Getting error -213: Unsupported combination of source format (=0), and destination format (=4) in function getLinearFilter

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; std;
using namespace cv;

const char ImageFilePath[] = "/home/user/Downloads/skeleton.tif";

/** /**
 * @function main main
 */

int main( int main(int argc, char** argv ) { argv) {
    Mat src, dst; dst;
    Mat gray;



  //     //

    /// Load image

   src = imread( ImageFilePath, 1 );

  gray imread(ImageFilePath, 1);

    //gray = Mat(src.rows, src.cols, CV_32SC1);

  if( !src.data )
      {   if (!src.data) {
        return -1; -1;
    }

    //cout << src.channels() << endl;
    cvtColor(src, gray, CV_BGR2GRAY);
     gray.convertTo(gray, CV_32SC1);

    Mat res,abs_dst;   res res, abs_dst;
    //res = gray.clone();

   namedWindow("src image", CV_WINDOW_AUTOSIZE ); CV_WINDOW_AUTOSIZE);
    imshow("src image", gray );

  Laplacian( gray, gray);

    Laplacian(gray, res, CV_32SC1, 3, 1, 0, BORDER_DEFAULT );   

BORDER_DEFAULT);
    //namedWindow("Laplacian", CV_WINDOW_AUTOSIZE );
    //imshow("Laplacian", res );

    res += gray;

  namedWindow("Laplacian",   //convertScaleAbs( res, abs_dst );
    //namedWindow("Addition", CV_WINDOW_AUTOSIZE );   
  imshow("Laplacian", res );

   waitKey(0); );
    // imshow("Addition", abs_dst );

    waitKey(0);
    return 0; 0;

}