You can use the OpenCV library in Python to achieve this task. Here is an example code that does the following:
main.py823 chars32 lines
Note that you may need to adjust the parameters of Canny edge detection and HoughLine transform for your specific image.
gistlibby LogSnag