2
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

#include <QDebug>

int main()
{
    // Read input image
    cv::Mat img= cv::imread("D:\\extra\\Procesare de imagine\\altele\\images\\group.jpg");
    if (!img.data)
    {
        qDebug("no image");
        return 0;

    }

    // Display the image
    cv::namedWindow("Image");
    cv::imshow("Image",img);

    // Erode the image
    cv::Mat eroded;
    cv::erode(img,eroded,cv::Mat());


    cv::waitKey();
    return 0;
}

Hi, I have the following problem with opencv (in Qt) function erode() and dilate(). I use the msvc10 compiler. I try to run a simple code , but at the line cv::erode(img,eroded,cv::Mat()) it crashes. I don't get any error message, just a dialog with "program.exe has stopped working". I go to "Debug the program" and I get Call Stack tbb.dll ([Frames below may be incorrect and/or missing, no symbols loaded for tbb.dll] : ). I mention that from start I had problems with building in Debug mode (imread does not work in Debug, only cvLoadImage), and the function cv::threshold() crashes in the same way, with very simple code. I read that it's possible to solve by copying the tbb.pdb next to tbb.dll, but it doesn't work.

mada_p
  • 21
  • 1
  • 2
  • It seems to me that you are including wrong library files. Check to see that you are using the debug version of lib/dll files or not. I'm not sure about the Qt library files, but the difference is mostly like `opencv_core230.lib` and `opencv_core230d.lib`. which the latter is the debug version and if you use the release version it will probably crash your program. – Kamyar Infinity Aug 23 '12 at 21:08
  • In my .pro file I have included both version of the lib files. But it's only the cv::imread() that does't work in debug. cv::erode() and cv::dilate() crash both in debug and release mode. – mada_p Aug 24 '12 at 06:17
  • other things you may check, as you get to tbb.dll in debug mode, there must be something wrong, as you should be using tbb_debug.dll, check that you have correctly separated debug/release library files in your .pro file, as noted [here](http://stackoverflow.com/a/1130184/634150). – Kamyar Infinity Aug 24 '12 at 11:28

1 Answers1

0

Just to add to Kamyar's comment:

You'll probably also have to use the tbb debug version, which is named tbb_debug.dll, if you are compiling in debug configuration. For OpenCV 2.4.1 for Windows it can be found in your OpenCV directory under build\common\tbb.

flix
  • 609
  • 4
  • 9
  • I put the tbb_debug.dll next to tbb.dll and I get the same result. I have the problem only in Qt, in Visual Studio everything works just fine. – mada_p Aug 24 '12 at 06:21