Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: opencv (Qt Creator) wilt niet builden  (gelezen 1095 keer)

opencv (Qt Creator) wilt niet builden
« Gepost op: 2014/02/15, 15:38:16 »
ik ben bezig op mezelf opencv te lezen gebruiken adhv qt creator
nu heb ik volgende code die niet wilt compileren en zou totaal niet weten hoe het komt:

#include <cstdio>
//#include "opencv/cv.hpp"
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"



#include <stdio.h>
#include <iostream>
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include <string>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <opencv2/core/core.hpp>



using namespace cv;

int main(int argc, char **argv){
    if (argc < 2){
        printf("error no image");
          return 0;}
    Mat image = imread(argv[1]);            //Inlezen bestand
    Mat destination = image;
    namedWindow("testje",WINDOW_AUTOSIZE);    //Venster aanmaken
    imshow("testje",image);     //afbeelding naar Venster schrijven
    cvtColor(image,destination,CV_BGR2GRAY);
    threshold(image,destination,50,THRESH_BINARY,THRESH_BINARY);
    imwrite("image_gray.png",destination);
    namedWindow("2de",WINDOW_AUTOSIZE);    //Venster aanmaken
    imshow("2de",destination);     //afbeelding naar Venster schrijven
    //printf("ja hoor");                      // testprint
    waitKey(0);
    return 0;
}

errors:
:-1: error: CMakeFiles/opg1.dir/src/opgave1.o: undefined reference to symbol 'cv::threshold(cv::_InputArray const&, cv::_OutputArray const&, double, double, int)'
:-1: error: note: 'cv::threshold(cv::_InputArray const&, cv::_OutputArray const&, double, double, int)' is defined in DSO /usr/local/lib/libopencv_imgproc.so.2.4 so try adding it to the linker command line
/usr/local/lib/libopencv_imgproc.so.2.4:-1: error: could not read symbols: Invalid operation
:-1: error: collect2: ld gaf exit-status 1 terug

fout die ik krijg als ik //#include "opencv/cv.hpp" uit commentaar haal:

/home/fre/Documenten/S/src/opgave1.cpp:2: In file included from /home/fre/Documenten/S/src/opgave1.cpp:2:0:
/usr/local/include/opencv/cv.hpp:50: fatale fout: cv.h: Bestand of map bestaat niet
:-1: error: [CMakeFiles/opg1.dir/src/Frederick_Roels_opgave1.o] Fout 1
Windows, the only virus with manual and recovery disk
Proud Ubuntu 14.04 gebruiker
Laptop: i5 + 4 gb ram & ati radeon hd5600 (17")/ 2*500Gb

Re: opencv (Qt Creator) wilt niet builden
« Reactie #1 Gepost op: 2014/02/15, 19:31:01 »
In je CMakeLists, link je wel met de opencv-libraries?
I use a Unix-based system, that means I'll get laid as often as I have to reboot.
LibSylph
SeySayux.net

Re: opencv (Qt Creator) wilt niet builden
« Reactie #2 Gepost op: 2014/02/15, 19:36:23 »
Meerweten,

Niet dat ik een programmeur bent...
Maar zijn de nodige libopencv-*-dev pakketten ook ge-installeerd?

De foutmelding is typisch voor het ontbreken van de bibliotheek devel pakketten.
MvG,
MauRice
Registered Linux user: 473556

Re: opencv (Qt Creator) wilt niet builden
« Reactie #3 Gepost op: 2014/02/15, 21:00:32 »
In je CMakeLists, link je wel met de opencv-libraries?

mij CMakeLists.txt, of er juist gelinkt is weet ik niet:

cmake_minimum_required(VERSION 2.4)


PROJECT(LABO1)

# paths
INCLUDE_DIRECTORIES(src)
INCLUDE_DIRECTORIES(/usr/local/include)
LINK_DIRECTORIES(/usr/local/lib)
LINK_DIRECTORIES(/usr/lib)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
SET(CMAKE_CXX_FLAGS "-o3 -w")
SET(CMAKE_CXX_LINK_FLAGS "-pg")
SET(OpenCV_LIBRARIES opencv_core opencv_highgui)

ADD_EXECUTABLE(opg1 src/opgave1.cpp)
TARGET_LINK_LIBRARIES(opg1 ${OpenCV_LIBRARIES})

SET(CMAKE_BUILD_TYPE Release)

Meerweten,

Niet dat ik een programmeur bent...
Maar zijn de nodige libopencv-*-dev pakketten ook ge-installeerd?

De foutmelding is typisch voor het ontbreken van de bibliotheek devel pakketten.


daar heb ik naar gekeken en deze zijn aanwezig op de schijf onder /usr/local/include/
« Laatst bewerkt op: 2014/02/15, 21:03:22 door Meerweten »
Windows, the only virus with manual and recovery disk
Proud Ubuntu 14.04 gebruiker
Laptop: i5 + 4 gb ram & ati radeon hd5600 (17")/ 2*500Gb

Re: opencv (Qt Creator) wilt niet builden
« Reactie #4 Gepost op: 2014/02/16, 10:31:10 »
Je linkt met opencv_core en opencv_highgui, maar de error zegt dat je ook opencv_imgproc nodig hebt.

Tip: gebruik een CMake package finder module: http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
I use a Unix-based system, that means I'll get laid as often as I have to reboot.
LibSylph
SeySayux.net

Re: opencv (Qt Creator) wilt niet builden
« Reactie #5 Gepost op: 2014/02/16, 13:15:41 »
Je linkt met opencv_core en opencv_highgui, maar de error zegt dat je ook opencv_imgproc nodig hebt.

Tip: gebruik een CMake package finder module: http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries

ha thx, dat was het inderdaad merci!
Windows, the only virus with manual and recovery disk
Proud Ubuntu 14.04 gebruiker
Laptop: i5 + 4 gb ram & ati radeon hd5600 (17")/ 2*500Gb