A common problem in image processing is to locate edges that form straight lines in an image. The Hough Transform is a well-known technique for achieving this. Here is my code for doing Hough Lines in Processing. To process a natural image you first need to extract the edges and then threshold the result.
My code is an adaptation of Olly Oechsle’s Java implementation.