Face Detection with OpenCV4T

Good afternoon,
I’m trying to execute a face detection .cpp file using OpenCV libraries on my Jetson TX1.
I’m able to execute the same file using my PC on which only Jetpack is installed.
On my TX1: I execute the “cmake .” command and the process returns no error, but when I launch the “make” command an error occurs.
http://imageshack.com/a/img921/9604/cmyFwE.png

the code of the facedetection.cpp is:

#include "opencv2/objdetect/objdetect.hpp"
#include "hwloc/cudart.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/gpu/gpu.hpp"

#include <iostream>
#include <stdio.h>

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

int main( )
{
    Mat image;
    image = imread("/home/ubuntu/Desktop/Proj_OpenCV/FaceDetection/prova.jpg");  
    GpuMat d_image(image);
    namedWindow( "window1", 2 );
    imshow( "window1", image );

    // Load Face cascade (.xml file)
    CascadeClassifier face_cascade;
    face_cascade.load( "/usr/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml");

    // Detect faces
    std::vector<Rect> faces;
    face_cascade.detectMultiScale( image, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(100, 100) );


    // Draw circles on the detected faces
    for( int i = 0; i < faces.size(); i++ )
    {
        Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 );
        ellipse( image, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 );
    }
    namedWindow("Detected faces", 2);
    imshow( "Detected faces", image );

    waitKey(0);                 
    return 0;
}

Anyone can fix this?

Thanks!

The error indicates you are missing a library which linking to has been attempted:

libopencv_dep_cudart

I don’t know if it is simply missing from your linker search path, or if it is missing on the system as a whole.

Hi,

With following command, I can run your sample on tx1 successfully.
Please help to check if makefile has the correct path.

g++ test.cpp -o test -L"/usr/local/cuda/lib64/" -lcudart -lcublas -lcurand -L"/usr/local/lib/" -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_objdetect -I"/usr/local/cuda-8.0/include" -I"/usr/local/include"

Cuda library on tx1 located at:
library: /usr/local/cuda/lib64
header: /usr/local/cuda-8.0/include

Thanks