Repository: opencv
Issue: Problem with opencv_cuda_surf in nvidia jetson Xavier
Labels: category: contrib,category: gpu/cuda (contrib)

##### System information (version)
<!-- Example
- OpenCV => 
- Operating System / Platform => 
- Compiler =>
-->

- OpenCV => :3.4.3
- Operating System / Platform => :Ubuntu 18.04 64 bit(nvidia Jetson Xavier)
- Compiler => :grey_question:Unix makefiles

##### Detailed description

   i had problem with **opencv_cuda surf** when trying to get keypoints from images in nvidia jetson xavier.
   when trying to get keypoints from image with resolution of (W)1600 -1192(H) and (W)1600-900(H) it shows keypoint in image.
  And i try for different  resolution from smaller than(W)1600 and higher than W(1600) and same has for height(1192 and 900)  it doesn't shows keypoints . It didn't shows any error in source.when i debug to sample source of opencv gpu surf_keypoint_matching.cpp it doesn't pass thought  **surf function** based on resolution smaller than(W)1600 and higher than W(1600) and same has for height(smaller<1192> greater and smaller<900>greater) . 
       
##### Steps to reproduce

#include "iostream"
#include "chrono"
#include "opencv2/opencv_modules.hpp"

#ifdef HAVE_OPENCV_XFEATURES2D
#include "opencv2/calib3d.hpp"
#include "opencv2/core.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/cudafeatures2d.hpp"
#include "opencv2/xfeatures2d/cuda.hpp"

using namespace std;
using namespace std::chrono;
using namespace cv;
using namespace cv::cuda;

static void help()
{
    cout << "\nThis program demonstrates using SURF_CUDA features detector, descriptor extractor and BruteForceMatcher_CUDA" << endl;
    cout << "\nUsage:\n\tsurf_keypoint_matcher --left <image1> --right <image2>" << endl;
}

int main(int argc, char* argv[])
{
    if (argc != 5)
    {
        help();
        return -1;
    }

    //start time
    high_resolution_clock::time_point t1 = high_resolution_clock::now();

    GpuMat img1, img2; 
    img1.create(1,1,CV_8U);
    img2.create(1,1,CV_8U);
    //Mat detectImg;
    for (int i = 1; i < argc; ++i)
    {
        if (string(argv[i]) == "--left")
        {
            img1.upload(imread(argv[++i], IMREAD_GRAYSCALE));
            CV_Assert(!img1.empty());
        }
        else if (string(argv[i]) == "--right")
        {
            img2.upload(imread(argv[++i], IMREAD_GRAYSCALE));
	   // detectImg = imread(argv[i], CV_LOAD_IMAGE_COLOR);
            CV_Assert(!img2.empty());
        }
        else if (string(argv[i]) == "--help")
        {
            help();
            return -1;
        }
    }

    cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); 
    cout << "Start GPU" << endl;	

    SURF_CUDA surf;

    // detecting keypoints & computing descriptors
    GpuMat keypoints1GPU, keypoints2GPU;
    GpuMat descriptors1GPU, descriptors2GPU;
    surf(img1, GpuMat(), keypoints1GPU, descriptors1GPU);
    surf(img2, GpuMat(), keypoints2GPU, descriptors2GPU);

    cout << "FOUND " << keypoints1GPU.cols << " keypoints on first image" << endl;
    cout << "FOUND " << keypoints2GPU.cols << " keypoints on second image" << endl;

    
    return 0;
}

#else

int main()
{
    std::cerr << "OpenCV was built without xfeatures2d module" << std::endl;
    return 0;
}

#endif


##### Issue submission checklist

 -[ ] I report the issue, it's not a question
   <!--
   OpenCV team works with answers.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->