Building OpenCV 4.5.2 on Windows to enable GPU but gpu.hpp is not created

After building Opencv 4.5.2 on Windows using cmake 3.20.4 to enable GPU support, the file gpu.hpp was found to be missing. The build created many other files successfully.

Suggestions would be appreciated.

welcome.

the usual requirements apply, same as any bug report on the github: supply all relevant information.

Sorry, I’m a total novice with this, especially cmake.

I followed this set of instructions https://youtu.be/-GY2gT2umpk

FWIW, the code I am trying to compile is:

#include
#include “opencv2/opencv.hpp”
#include "opencv2/gpu/gpu.hpp"

int main (int argc, char* argv[])
{
try
{
cv::Mat src_host = cv::imread(“file.png”, CV_LOAD_IMAGE_GRAYSCALE);
cv::gpu::GpuMat dst, src;
src.upload(src_host);

    cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);

    cv::Mat result_host;
    dst.download(result_host);

    cv::imshow("Result", result_host);
    cv::waitKey();
}
catch(const cv::Exception& ex)
{
    std::cout << "Error: " << ex.what() << std::endl;
}
return 0;

}

I replaced CV_LOAD_IMAGE_GRAYSCALE with cv::IMAGE_GRAYSCALE and CV_THRESH_BINARY with cv::THRESH_BINARY.

Perhaps gpu.hpp has also been deprecated & removed ?

In fact this is looking like it’s a deprecation issue:

in the video, near 23:00, he shows different code, code that uses cv::cuda.

cv::gpu has last been seen in the 2.4 branch, which stopped receiving support years ago.

you should stick with source code that isn’t more than a few years old.