error: (-217:Gpu API call) unspecified launch failure in function 'HarrisResponses_gpu'

47 Views Asked by At

I want to use my opencv work on gpu using cuda, but when I run my project after compiling my code with cmake, I get this error. Can you help me?
jetsonTX2
ubuntu 18.04
opencv 4.1.1 cuda 10.2

my error:((((((((

/home/nvidia/CLionProjects/untitled3/cmake-build-debug/untitled3
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.1.1) /tmp/build_opencv/opencv_contrib/modules/cudafeatures2d/src/cuda/orb.cu:160: error: (-217:Gpu API call) unspecified launch failure in function 'HarrisResponses_gpu'


Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

my code:

#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/xfeatures2d/cuda.hpp"
#include "opencv2/xfeatures2d.hpp"
using namespace cv;
using namespace std;
int main()
{
    Mat h_image = imread("/home/nvidia/Desktop/indir.jpeg", cv::IMREAD_GRAYSCALE);
    cv::Ptr<cv::cuda::ORB> detector = cv::cuda::ORB::create(100, true,2);

    std::vector<cv::KeyPoint> keypoints;
    cv::cuda::GpuMat d_image, d_keypoints, d_descriptor;



    d_image.upload(h_image);
    detector->detectAndComputeAsync(d_image, cv::noArray(), d_keypoints, d_descriptor);

    detector->convert(d_keypoints, keypoints);

    cv::drawKeypoints(h_image, keypoints, h_image);
    imshow("Final Result", h_image);
    waitKey(0);
    return 0;
}

and my cmakeList:

cmake_minimum_required(VERSION 3.10)
project(untitled3)
set(CMAKE_CXX_STANDARD 17)
# OpenCV paketini bul ve bağla
find_package(OpenCV REQUIRED)
find_package(CUDA REQUIRED)
# CUDA kullanarak OpenCV'yi derle
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -arch compute_50 -code sm_50)# Projenin ana hedefi ve kaynak dosyaları
add_executable(untitled3 main.cpp)
# OpenCV ve CUDA kütüphanelerini hedefe bağla
target_link_libraries(untitled3 ${OpenCV_LIBS} ${CUDA_LIBRARIES})

cmake_minimum_required(VERSION 3.10)



I compiled opencv correctly with CUDA, it runs fast detector, but I got an error like this on ORB

0

There are 0 best solutions below