Ask Your Question
0

First Time User - What am I doing wrong?

asked 2015-11-27 16:20:50 -0600

zipzit gravatar image

updated 2015-11-30 02:49:25 -0600

pklab gravatar image

So I'm trying to understand how to use OpenCV. I'm using:

Heres my program, copied from this video tutorial from Kyle Hounslow entitled OpenCV (All Versions) - Easy Installation Guide and Sample Project -- VS 2010 C++

//#include<opencv\cv.h>   // couldn't get this one VideoCapture class to function with this.
#include<opencv\highgui.h>
#include <opencv2/opencv.hpp>

using namespace cv;

int main() {
    Mat image;          //Create Matrix to store image
    VideoCapture cap;          //initialize capture
    cap.open(0);
    namedWindow("window", 1);          //create window to show image
    while (1) {
        cap >> image;          //copy webcam stream to image
        imshow("window", image);          //print image to screen
        waitKey(33);          //delay 33ms
    }
    return 0;
}

The linker tools are using the libraries @ C:\opencv_3_0_0\build\x86\vc12\staticlib (Its not clear on which of the six directories I should be using, vc12 or vc11, bin, lib or staticlib. I'm looking at a whole lot of errors.

Note: I've tried using Cmake and the latest version of github's opencv library from https://github.com/Itseez/opencv . I can build both 32 debug and 32 release libraries up fine, but when I do that a whole lot of tools (which should be in the directory C:\opencv_3_0_0\build\include\opencv2) are missing. It looks like they aren't there in the github repository at all. (What's up with that?)

Anybody know how to use current tools (win10 & visual studio) to run opencv?

Note: I'm looking at qty: 500 errors, generally unresolved external symbol too many to list here...

Update: So I'm figuring out that using the pre-configured library with my version of Visual Library is out. So I'm looking again at the Cmake version I built up from the Github version. Not sure what I was thinking before, in my Cmake generated "mybuild" directory, I do see all the classes and headers I missed before. Cmake created the directories C:\opencv_git\mybuild\install\x86\vc14... and I can see the bin and lib and samples and staticlib directories there.

Unfortunately I'm seeing very few .lib files and a whole lot of .exe files Was that something I did wrong with my Cmake setup? Or perhaps a new feature of the Windows compiler tools? Are .exe files the new .lib files?

edit retag flag offensive close merge delete

Comments

If you use cmake to build opencv (good idea) you have to use cmake to build your program. you can use this sample that you should find in C:\opencv_git\samples\cpp\example_cmake

LBerger gravatar imageLBerger ( 2015-11-28 03:06:34 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2015-11-29 16:53:08 -0600

zipzit gravatar image

updated 2015-11-29 21:56:53 -0600

I had many slight mistakes and false starts. I found some hints on this. I've sinced learned a lot about Visual Studio, about CMake and about OpenCV. Got it all working now, took me a day or two.

It turns out you have to compile the openCV library from git repository in order to be compatible with Visual Studio (VS14) 2015.

I've organized what I've learned, placed it online here in case anybody else has the same frustrations. Its pretty detailed, too much content to post here.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-11-27 16:20:50 -0600

Seen: 709 times

Last updated: Nov 29 '15