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