Error using calculLut and/or getMinMaxHistogram

asked 2019-04-04 04:56:41 -0500

lii gravatar image

updated 2019-04-04 08:55:28 -0500

int main(int argc, char** argv){

    if(argc!=1){
        usage();
    }
    for ( indice=1 ;indice<=14; indice++ ){

        src = imread(cv::format("NouveauPermis/%d.jpg",indice).c_str(), indice);  

        //imshow("original",src);

        // Pretraitement
        vector<Point> points = getMinMaxHistogram(src);
        calculLut(points[0],points[1], src);

        //imshow("l'image transformée",src);

        // Detection des contours
        contour = method_canny(src);
        //imshow("les contour",contour);

        imwrite(cv::format("NouveauPermisT/frame%d.jpg",indice).c_str(), src);
        waitKey(0);
        destroyAllWindows();  
    }

    return 0;
}

but i get this error when I run it:

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

terminate called after throwing an instance of 'cv::Exception' what(): c:/opencv/sources/modules/imgproc/src/color.cpp:8000: error: (-215) scn == 3 || scn == 4 in function cvtColor

edit retag flag offensive close merge delete

Comments

You need to reduce this to the smallest possible code that throws the exception. What does reading 14 images have to do with anything? Where does "method_canny" come from?

Der Luftmensch gravatar imageDer Luftmensch ( 2019-04-04 08:48:21 -0500 )edit

the method I created it myself, what I want to do is read one image at a time(from a local forlder which contains 14 images)and then do a series of treats, I waste time reading the images one by one

lii gravatar imagelii ( 2019-04-04 08:59:53 -0500 )edit

check, if your images really were loaded (i bet, not so. it's the typical noob problem)

berak gravatar imageberak ( 2019-04-05 02:05:14 -0500 )edit