Ask Your Question

astro02's profile - activity

2014-03-23 15:54:43 -0600 asked a question Error opencv when i run my code.

Hi Everyone,

I have a bug when i run my code who use Canny function. This is my compilation command :

g++ detection.cpp `pkg-config --cflags --libs opencv`

And when i run my code, i have this error :

OpenCV Error: Unsupported format or combination of formats () in

cvCanny, file /build/buildd/opencv-2.3.1/modules/imgproc/src/canny.cpp, line 67 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.3.1/modules/imgproc/src/canny.cpp:67: error: (-210) in function cvCanny

Abandon (core dumped)

I don't understand why i have this error.

This is my code :

#include<iostream>
#include<cv.hpp>
#include<opencv2/highgui/highgui.hpp>
#define MODELE "./croix.png"
//g++ detection.cpp `pkg-config --cflags --libs opencv`
using namespace std;
using namespace cv;

bool findModele();

int main(int argc, char **argv){
  Mat image, forme;
    bool resultDetection = false;

        resultDetection = findModele();
        cout << "Resultat detection: ";
        if(resultDetection)
            cout << "OK" << endl;
        else
            cout << "KO" << endl;

    return 0;
}

bool findModele(){
    Mat modele = imread(MODELE, 1);
    Mat modeleCannyOutput;
    bool result = false;
    double detection = 0.0;

    Canny(modele, modeleCannyOutput, 100, 100*2, 3);

    return result;
}

But I do not think my error comes from my code.

Thank you in advance for your help,