0

I installed opencv and configure it from tutorials, but when I am trying a code implementing it, all what is related to opencv is shown as an error as shown in the figure. Can you please help me? I really need it enter image description here

#include "stdafx.h"
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace std;    
using namespace cv;

int Main( void)
{
    CvCapture* capture = 0;

    // Start Capture From WebCam
    capture = cvCaptureFromCAM( CV_CAP_ANY );
    if( !capture )
    {
        cout << "No camera Detected" << endl;
    }
    // Create New Window
    cvNamedWindow( "My OpenCV WebCam", CV_WINDOW_AUTOSIZE );

    if( capture )
    {
        cout << "WebCam Is In capture" << endl;
        for(;;)
        {
            // Get Captured Image And Show It In The New Window 
            // You Can Do Save It Or Filter It
            IplImage* iplImg = cvQueryFrame( capture );

            // Use This To Filter Image
            //cvNot(iplImg, iplImg);

            cvShowImage( "My OpenCV WebCam", iplImg );

            if( waitKey( 10 ) >= 0 )
                break;
        } 
    } 


    cvReleaseCapture( &capture );
    cvDestroyWindow( "My OpenCV WebCam" );

    return 0;

}

enter image description here

Miki
  • 40,887
  • 13
  • 123
  • 202
user3552658
  • 115
  • 1
  • 11

1 Answers1

0

From the comments to the question it turned out that the OP was linking to OpenCV 2.4.8, instead of OpenCV 3.0.0.

Correcting the linked libraries name, as well as the library path, solved the issue.

Miki
  • 40,887
  • 13
  • 123
  • 202
  • I just correct them .. But I have one more question plz.. The code I have to test has imports like this : #include #include #include #include "opencv2/features2d/features2d.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/nonfree/nonfree.hpp" How can I deal with them for opencv3? Since those who give an error now – user3552658 Oct 27 '15 at 18:42
  • @user3552658 be sure that the inlcude directory is /build/include – Miki Oct 27 '15 at 18:45
  • it won't work for `nonfree`, see [here](http://stackoverflow.com/questions/27418668/nonfree-module-is-missing-in-opencv-3-0) – Miki Oct 27 '15 at 18:47
  • Miki can you help me here plz http://stackoverflow.com/questions/33387227/the-program-has-exited-with-code-1-0xffffffff – user3552658 Oct 28 '15 at 09:34