Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Pre processing with tan trigs functions

So i added the tan trigs function to preprocess the image (probe set only, not training set).

I pass my image to it:

      // Convert to grayscale
    cvtColor(contrast, gray, CV_BGR2GRAY); // first arg used to be brightness on 6/09/2016
    // Equalize
    equalizeHist(gray,equalize);
    Mat preprocessed = tan_triggs_preprocessing(equalize);
    // Find the faces in the frame:
    vector< Rect_<int> > faces;
    haar_cascade.detectMultiScale(preprocessed, faces,1.2,4,0|CASCADE_SCALE_IMAGE, Size(min_face_size,min_face_size),Size(max_face_size,max_face_size));

But when i run it it crashes with:

OpenCV Error: Assertion failed (scaleFactor > 1 && _image.depth() == CV_8U) in detectMultiScale, file /Users/alefveld/Downloads/opencv/modules/objdetect/src/cascadedetect.cpp, line 1323
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/alefveld/Downloads/opencv/modules/objdetect/src/cascadedetect.cpp:1323: error: (-215) scaleFactor > 1 && _image.depth() == CV_8U in function detectMultiScale

Abort trap: 6

So i added this to the end the tan trigs function so it returns 8UC1 image instead:

 I.convertTo(I, CV_8UC1);
 return I;

But now it doesn't detect any image at all. Is it the scale that is wrong instead? Or should i not have converted it back. But detectmultiscale expects a CV_8UC image..

Many thanks for help.