- -# And then you display the result by drawing the lines.
- @code{.cpp}
- for( size_t i = 0; i < lines.size(); i++ )
- {
- float rho = lines[i][0], theta = lines[i][1];
- Point pt1, pt2;
- double a = cos(theta), b = sin(theta);
- double x0 = a*rho, y0 = b*rho;
- pt1.x = cvRound(x0 + 1000*(-b));
- pt1.y = cvRound(y0 + 1000*(a));
- pt2.x = cvRound(x0 - 1000*(-b));
- pt2.y = cvRound(y0 - 1000*(a));
- line( cdst, pt1, pt2, Scalar(0,0,255), 3, LINE_AA);
- }
- @endcode
--# **Probabilistic Hough Line Transform**
- -# First you apply the transform:
- @code{.cpp}
- vector<Vec4i> lines;
- HoughLinesP(dst, lines, 1, CV_PI/180, 50, 50, 10 );
- @endcode
- with the arguments:
+And then you display the result by drawing the lines.
+@add_toggle_cpp
+@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp draw_lines
+@end_toggle
+
+@add_toggle_java
+@snippet samples/java/tutorial_code/ImgTrans/HoughLine/HoughLines.java draw_lines
+@end_toggle
+
+@add_toggle_python
+@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py draw_lines
+@end_toggle
+
+#### Probabilistic Hough Line Transform
+First you apply the transform:
+
+@add_toggle_cpp
+@snippet samples/cpp/tutorial_code/ImgTrans/houghlines.cpp hough_lines_p
+@end_toggle
+
+@add_toggle_java
+@snippet samples/java/tutorial_code/ImgTrans/HoughLine/HoughLines.java hough_lines_p
+@end_toggle
+
+@add_toggle_python
+@snippet samples/python/tutorial_code/ImgTrans/HoughLine/hough_lines.py hough_lines_p
+@end_toggle
+
+- with the arguments: