Hey I just tried using the OpenCV for the past few hours but I keep on failing.

I am a Windows 7 user with Visual Studio 2008.

I followed the instructions for OpenCV2.2 (whilst downloading the newest stable version 2.4)
did the CMAKE phase exactly the way it says .

Finaly I added the libraries and includes as showed ( except the folders detinations are different )
and tried using the example code

// OpenCV_Helloworld.cpp : Defines the entry point for the console application.
// Created for build/install tutorial, Microsoft Visual Studio and OpenCV 2.2.0

#include "stdAfx.h"

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

int _tmain(int argc, _TCHAR* argv[])
{
        // Open the file.
        IplImage *img = cvLoadImage("photo.jpg");
        if (!img) {
                printf("Error: Couldn't open the image file.\n");
                return 1;
        }

        // Display the image.
        cvNamedWindow("Image:", CV_WINDOW_AUTOSIZE);
        cvShowImage("Image:", img);

        // Wait for the user to press a key in the GUI window.
        cvWaitKey(0);

        // Free the resources.
        cvDestroyWindow("Image:");
        cvReleaseImage(&img);

        return 0;
}

But I get the following errors:
fatal error C1083: Cannot open include file: 'stdAfx.h': No such file or directory
but thats not the worst because I read that this file isnt a must so I removed it and got this one:
fatal error C1083: Cannot open include file: 'opencv2/core/core_c.h': No such file or directory

kept doing so , removing includs and kept on getting the "cant open" errors
once I checked the opencv folders I found out there are hardly any files in the opencv2 folder

need an advice .
(prefered not to download an old version since there are less options)
thanks!

Dani AI

Generated

Two separate issues are showing up in your errors, — one from Visual Studio and one from OpenCV. The stdafx.h message is Visual C++’s precompiled-header behaviour: either every source file must #include "stdafx.h" as the very first include, or you must turn precompiled headers off for the project (Project → Properties → C/C++ → Precompiled Headers → “Not Using Precompiled Headers”). This is a common Visual Studio setup pitfall. (stackoverflow.com)

The opencv2/core/core_c.h error is a missing-header/include-path problem (or an incomplete install of OpenCV headers). Make sure your project’s Additional Include Directories points at the OpenCV include tree (the build\include folder and the module subfolders such as include\opencv and include\opencv2), and not an unrelated folder. If those folders don’t actually contain headers, the OpenCV “install” step didn’t finish. (stackoverflow.com)

If you used CMake to generate a Visual Studio solution, open that solution and build the INSTALL target (or run the equivalent CMake install command) so headers/libs are copied into the install layout that your project should reference. Example command-line install (from the build directory):

cmake --build . --target install --config Release

That step is what populates the include and lib/bin folders your compiler/linker expect. (cmake.org)

Finally, for VS2008 use the compiler-specific subfolders (e.g. build\x86\vc9\lib and build\x86\vc9\bin), add the correct lib files to Linker → Additional Dependencies, and put the matching bin folder on PATH or copy DLLs next to your .exe. Quick checklist: (1) disable or satisfy precompiled headers, (2) point include dirs at OpenCV’s build\include and subfolders, (3) build/install with CMake or use the matching prebuilt package, (4) set lib directories to the vc9 folder and add DLLs to PATH. (stackoverflow.com)

Good call by to use the official docs for the precise layout and current steps — the OpenCV tutorials cover the Visual Studio/CMake workflow in detail. (docs.opencv.org)

Well I would suggest you to try http://opencv.org/
I guess willowgarage is an older link. And from what you have written ,seems that its an installation problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.