Ask Your Question

jimyangboy's profile - activity

2014-04-13 04:09:09 -0600 asked a question opencv with CUDA hough transform

I use the opencv2.4.3 and the CUDA4.2 in VS2005,and I want to implement the Hough Transform on GPU.Here is the code:

include <opencv2 opencv.hpp="">



using namespace std;
static cv::Mat drawHoughLinesOnMat (cv::gpu::GpuMat hough_Mat, cv::gpu::GpuMat houghLines) { cv::Mat output_Mat; cv::cvtColor(cv::Mat(hough_Mat), output_Mat, CV_GRAY2BGR);

std::vector<cv::Vec4i> lines_vector;
if (!houghLines.empty())
    cv::Mat temp_Mat (1, houghLines.cols,CV_32SC4, &lines_vector[0]); (temp_Mat);

for (size_t i=0; i<lines_vector.size(); ++i)
    cv::Vec4i l = lines_vector[i];
    cv::line(output_Mat, cv::Point(l[0], l[1]), cv::Point(l[2], l[3]), cv::Scalar(0, 0, 255), 1, 8);
return output_Mat;


int main() { cv::Mat input = cv::imread("D:\test\Canny_CUDA\Redocn_2012040603045996.jpg", CV_LOAD_IMAGE_GRAYSCALE); //std::string imageType=getImgType(input.type());

cv::gpu::GpuMat mat_input(input), bil_out, mat_thresh, hough_lines;
cv::gpu::HoughLinesBuf hough_buffer;

int bilateral_thresh = 15; // 5 == 0.085s; 15 == 0.467s at run-time
cv::gpu::bilateralFilter(mat_input, bil_out, bilateral_thresh, bilateral_thresh*2, bilateral_thresh/2);
//cv::gpu::threshold(bil_out, mat_thresh, 10, 255, CV_THRESH_BINARY);
cv::gpu::Canny(bil_out, mat_thresh, 10, 60, 5);

cv::gpu::HoughLines(mat_thresh, hough_lines, hough_buffer, 1.0f, (float)(CV_PI/180.0f), 5, 1);
//cv::Mat test_hough(hough_lines);
cv::Mat hough_Mat = drawHoughLinesOnMat(mat_input, hough_lines);
cv::gpu::HoughLines(mat_thresh, hough_lines,  1.0f, (float)(CV_PI/180.0f),   1, true);
/*cv::Mat */hough_Mat = drawHoughLinesOnMat(mat_input, hough_lines);



but it doesn't work.Can anyone help me?

2014-04-13 03:56:20 -0600 commented question Using opencv2.4.3 and the CUDA4.2

but the CMake says that the version is request at least 4.1

2014-04-10 06:47:10 -0600 received badge  Editor (source)
2014-04-10 06:46:08 -0600 asked a question Using opencv2.4.3 and the CUDA4.2

I use the opencv2.4.3 and the CUDA4.2 in VS2005,my GPU is NVida GeForce 8800GT,when I am Testing the OpenCV GPU Module of the function cv::gpu::canny,the compiling is ok,But the linking has some error.It says the device doesn't support shared atomics.My operating system is Windows XP.Can anyone help me about this question?Thanks!