can't run OpenCV samples

Hi, i'm having trouble trying to run some simple code samples that uses OpenCV
i'm using codeblocks 12.11 (just the IDE), Opencv 2.4 and the last version of Mingw, it's all configured properly.

the problem is that all the programs that use openCV libs compile without warning or errors,but when running the program this message appears:

"The application failed to initialize properly - 0xc0000005"

i can't even debug.

this is the code but as i said before, no other code using opencv works either.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <opencv2/opencv.hpp>
 
using namespace cv;
 
int main (int argc, const char * argv[])
{
    VideoCapture cap(0);
    cap.set(CV_CAP_PROP_FRAME_WIDTH, 320);
    cap.set(CV_CAP_PROP_FRAME_HEIGHT, 240);
 
    if (!cap.isOpened())
        return -1;
 
    Mat img;
    namedWindow("opencv", CV_WINDOW_AUTOSIZE);
    HOGDescriptor hog;
    hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
 
    while (true)
    {
        cap >> img;
        if (img.empty())
            continue;
 
        vector<Rect> found, found_filtered;
        hog.detectMultiScale(img, found, 0, Size(8,8), Size(32,32), 1.05, 2);
        size_t i, j;
        for (i=0; i<found.size(); i++) 
        {
            Rect r = found[i];
            for (j=0; j<found.size(); j++) 
                if (j!=i && (r & found[j]) == r)
                    break;
            if (j== found.size())
                found_filtered.push_back(r);
        }
 
        for (i=0; i<found_filtered.size(); i++) 
        {
            Rect r = found_filtered[i];
            r.x += cvRound(r.width*0.1);
		    r.width = cvRound(r.width*0.8);
		    r.y += cvRound(r.height*0.07);
		    r.height = cvRound(r.height*0.8);
		    rectangle(img, r.tl(), r.br(), Scalar(0,255,0), 3);        
        }
 
        imshow("opencv", img);
        if (waitKey(10)>=0)
            break;
    }
    return 0;
}
closed account (Dy7SLyTq)
im just throwing this out there, because i have never used open cv, but could it be that main is an invalid entry point because your using an invalid set of parameters?
what? no i told you, i can't run any code that uses OpenCV, even the most simple sample i can't run it, i can compile but not run the program.

closed account (Dy7SLyTq)
ok your not being clear. can you just not run any program that uses openCV? or can you not run any program at all?
both. i mean i can't run the program i compiled nor the exes from other example that came with .exe file
closed account (Dy7SLyTq)
can you run this program:
1
2
3
4
5
6
7
8
9
#include <iostream>

using std::cout;
using std::endl;

int main(int argc, char *argv[])
{
	cout<<"Hello, world!"<< endl;
}
yes i can run and compile normal c++ programs
closed account (Dy7SLyTq)
ok thank you. then that means that you are probably linking either incorrectly, or mixing compiled files that shouldnt be mixed
Verify that you are linking release libs in release config and debug libs in the debug config.
how i do that?
Topic archived. No new replies allowed.