I have written a code for finding Hough Lines for transmission lines in a PCB. My code:
void MainWindow::houghline()
{
Canny( image, image_output, ui->slider_threshold_canny_1->value(), ui->slider_threshold_canny_2->value(), 3 );
cv::cvtColor(image_output,input_grey_image, CV_GRAY2BGR);
cv::vector<Vec4i> lines;
cv::HoughLinesP(image_output, lines, 1, CV_PI/180, 50, 50, 10 );
for( size_t i = 0; i < lines.size(); i++ )
{
Vec4i l = lines[i];
line( input_grey_image, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0,0,255), 3, CV_AA);
}
QPixmap image_input = cvMatToQPixmap(input_grey_image);
ui->l_image->setPixmap(image_input);
ui->l_image->setScaledContents(true);
ui->l_image->show();
}
The output image has improper hough lines and there is also a hough line for space between a transmission line.
How to get a proper hough lines and hough lines not between the transmission lines of PCB?
Original Image:
Pixel Level of Image: enter image description here Actually I don't want to smoothen the pixels. Just find the pixels parallel to each other and find distance between them.
Is it possible by Hough transform. Is there any other method for finding distance between the edge pixels