An example using the Hough line detector
#include <cmath>
#include <iostream>
static void help()
{
cout << "This program demonstrates line finding with the Hough transform." << endl;
cout << "Usage:" << endl;
cout << "./gpu-example-houghlines <image_name>, Default is ../data/pic1.png\n" << endl;
}
int main(int argc, const char* argv[])
{
const string filename = argc >= 2 ? argv[1] : "../data/pic1.png";
{
help();
cout << "can not open " << filename << endl;
return -1;
}
vector<Vec4i> lines_cpu;
{
cout << "CPU Time : " << timeSec * 1000 << " ms" << endl;
cout << "CPU Found : " << lines_cpu.size() << endl;
}
for (
size_t i = 0;
i < lines_cpu.size(); ++
i)
{
}
{
hough->
detect(d_src, d_lines);
cout << "GPU Time : " << timeSec * 1000 << " ms" << endl;
cout <<
"GPU Found : " << d_lines.
cols << endl;
}
vector<Vec4i> lines_gpu;
{
lines_gpu.resize(d_lines.
cols);
}
for (
size_t i = 0;
i < lines_gpu.size(); ++
i)
{
}
imshow(
"detected lines [CPU]", dst_cpu);
imshow(
"detected lines [GPU]", dst_gpu);
return 0;
}