Wednesday, 15 February 2012

Line detection in a binary image using opencv -



Line detection in a binary image using opencv -

i trying observe crossing lines in in next binary image:

using houghline detection isn't producing right results

any pointers or direction appreciated. thanks

using image straight input, have invert (white = lines detect).

i'll results houghlinesp

and if dilate inverted image 1 time result:

with code:

int main() { cv::mat color = cv::imread("../inputdata/linedetectioncrosses.png"); cv::mat gray; // convert grayscale cv::cvtcolor(color, gray, cv_bgr2gray); cv::mat mask = 255-gray; //cv::dilate(mask, mask, cv::mat()); // observe houghlinesp std::vector<cv::vec4i> lines; cv::houghlinesp(mask, lines, 1, cv_pi/2880, 50, 300, 10 ); for( size_t = 0; < lines.size(); i++ ) { cv::vec4i l = lines[i]; cv::line( color, cv::point(l[0], l[1]), cv::point(l[2], l[3]), cv::scalar(0,0,255), 3, cv_aa); } // display results cv::imshow("mask",mask); cv::imshow("output", color); cv::waitkey(0); }

but if project, i'd seek observe circles first , find/extract lines known center point!

opencv line hough-transform

No comments:

Post a Comment