This forum is disabled, please visit https://forum.opencv.org

1 | initial version |

Altough the approach by @Balaji will probably work without any problems, I do think this can be done much easier. From an angle and a starting point one can use mathematics to derive the function that represents the line. Once you have done that the following steps are quite easy.

- Define for each border (edge of mat) the value of the function. For example if your top border equals the equation
`x = 0`

, then you can define the y value of your line equation and see if that still falls within the range of your top edge. - For each line you want to draw there will be only 2 points possible on your matrix. This also allows you only to draw lines for 180 degrees and get all 360 degree segments. Then use those two matching points to draw your line.

Necessary equation: http://stackoverflow.com/questions/1571294/line-equation-with-angle

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.