问题
I have tried Hough on CPU, and it runs fine, just a little slow. So, I am trying to run Hough on OpenCV CUDA, but it shows this error, even if I have GpuMat -
OpenCV Error: The function/feature is not implemented (getGpuMat is available only for cuda::GpuMat and cuda::HostMem) in cv::_InputArray::getGpuMat, file PATH\opencv-sources\modules\core\src\matrix.cpp, line 1454
This is my code (I stream frames from live camera, so inside a while loop) -
Ptr<HoughLinesDetector> houghLines = createHoughLinesDetector(1, CV_PI / 180, 120);
vector<Vec2d> tmpLines;
vector<Vec2d> lines;
GpuMat imgCanny;
...
while(true) {
...
houghLines->detect(imgCanny, tmpLines);
houghLines->downloadResults(tmpLines, lines); // Error occurs here...
...
}
Any help on this?
回答1:
After lots of trials and errors, I finally found the solution. Actually the output in detect
should be a GpuMat
not a vect2d
. I would have figured this out earlier, but the documentation of OpenCV
is very confusing. Here's the edited code -
Ptr<HoughLinesDetector> houghLines = createHoughLinesDetector(1, CV_PI / 180, 120);
GpuMat tmpLines; // This should be GpuMat...
vector<Vec2d> lines;
GpuMat imgCanny;
...
while(true) {
...
houghLines->detect(imgCanny, tmpLines);
houghLines->downloadResults(tmpLines, lines);
...
}
来源:https://stackoverflow.com/questions/35700595/opencv-gpu-error-function-not-implemented-in-hough-transform