2013-09-02 7 views
0

Je suis en train de compiler ce code (houghlines.cpp à partir d'échantillons de gpu):libopencv_gpu.so.2.4: ne peut pas ouvrir le fichier objet partagé: Aucun fichier ou répertoire

#include <cmath> 
#include <iostream> 

#include "opencv2/core/core.hpp" 
#include "opencv2/highgui/highgui.hpp" 
#include "opencv2/imgproc/imgproc.hpp" 
#include "opencv2/gpu/gpu.hpp" 
#include <stdlib.h> 
#include <stdio.h> 

using namespace std; 
using namespace cv; 
using namespace cv::gpu; 

static void help() 
{ 
    cout << "This program demonstrates line finding with the Hough transform." << endl; 
    cout << "Usage:" << endl; 
    cout << "./gpu-example-houghlines <image_name>, Default is pic1.png\n" << endl; 
} 

int main(int argc, const char* argv[]) 
{ 

    const string filename = argc >= 2 ? argv[1] : "~/Images/skorn00.png"; 

    Mat src = imread(filename, IMREAD_GRAYSCALE); 
    if (src.empty()) 
    { 
     help(); 
     cout << "can not open " << filename << endl; 
     return -1; 
    } 

    Mat mask; 
    Canny(src, mask, 100, 200, 3); 

    Mat dst_cpu; 
    cvtColor(mask, dst_cpu, CV_GRAY2BGR); 
    Mat dst_gpu = dst_cpu.clone(); 

    vector<Vec4i> lines_cpu; 
    { 
     const int64 start = getTickCount(); 

     HoughLinesP(mask, lines_cpu, 1, CV_PI/180, 50, 60, 5); 

     const double timeSec = (getTickCount() - start)/getTickFrequency(); 
     cout << "CPU Time : " << timeSec * 1000 << " ms" << endl; 
     cout << "CPU Found : " << lines_cpu.size() << endl; 
    } 

    for (size_t i = 0; i < lines_cpu.size(); ++i) 
    { 
     Vec4i l = lines_cpu[i]; 
     line(dst_cpu, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 3, CV_AA); 
    } 

    GpuMat d_src(mask); 
    GpuMat d_lines; 
    HoughLinesBuf d_buf; 
    { 
     const int64 start = getTickCount(); 

     gpu::HoughLinesP(d_src, d_lines, d_buf, 1.0f, (float) (CV_PI/180.0f), 50, 5); 

     const double timeSec = (getTickCount() - start)/getTickFrequency(); 
     cout << "GPU Time : " << timeSec * 1000 << " ms" << endl; 
     cout << "GPU Found : " << d_lines.cols << endl; 
    } 
    vector<Vec4i> lines_gpu; 
    if (!d_lines.empty()) 
    { 
     lines_gpu.resize(d_lines.cols); 
     Mat h_lines(1, d_lines.cols, CV_32SC4, &lines_gpu[0]); 
     d_lines.download(h_lines); 
    } 

    for (size_t i = 0; i < lines_gpu.size(); ++i) 
    { 
     Vec4i l = lines_gpu[i]; 
     line(dst_gpu, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0, 0, 255), 3, CV_AA); 
    } 

    imshow("source", src); 
    imshow("detected lines [CPU]", dst_cpu); 
    imshow("detected lines [GPU]", dst_gpu); 
    waitKey(); 

    return 0; 
} 

Mais après l'exécution de ce que je reçois message (excution): /espace de travail/test_opencv/test_opencv/bin/Release/test_opencv: erreur lors du chargement des bibliothèques partagées: libopencv_gpu.so.2.4: ne peut pas ouvrir le fichier objet partagé: Aucun fichier ou répertoire

Voici la construction : -------------- Construire: Version dans test_gpu (compilateur: GNU GCC Compiler) ---------------

g ++ -Wall -fexceptions -O2 -I/usr/local/include -I/usr/local/include/opencv -c /home/thomas/workspace/test_opencv/test_gpu/main.cpp -o obj/Release/main.o g ++ -L/usr/local/include -L/usr/local/include/opencv -o bin/Version/test_gpu obj/Version/main.o -s /usr/local/lib/libopencv_calib3d.so/usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so/usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so/usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.so/usr/local/lib/libopencv_video.so/usr/local/lib/libopencv_video stab.so taille de sortie est 14,44 KB processus terminé avec l'état 0 (0 minutes, 1 seconde) 0 erreurs, 0 avertissements (0 minutes, 1 seconde)

Le houghines.cpp à partir d'échantillons cpu bien travailler . Il semble que cela vient de la compilation de la librairie libopen_gpu. CMAKE ne renvoie pas d'erreur lorsque je compile opencv WITH_CUDA. Qu'est-ce qui ne va pas?

Répondre

0

J'ai trouvé le problème, il est ce que je suis attendu: -je ajouter dans le fichier source: cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice());

Et il est revenu: OpenCV Error: No GPU support (The library is compiled without CUDA support) in getDevice, file /build/buildd/opencv-2.4.2+dfsg/modules/core/src/gpumat.cpp, line 182 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.4.2+dfsg/modules/core/src/gpumat.cpp:182: error: (-216) The library is compiled without CUDA support in function getDevice

Maintenant, je dois compiler OpenCV avec cuda (CKEKE). Mais j'ai déjà fait cette partie ...

Questions connexes