Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
The Hough transformation can take some fiddling to get right for your use case. The two problems here, it seems, are that it is connecting disparate lines just because they line up and that you are only getting the most significant of these. As you simplified your problem by preprocessing the image, you can lower your threshold a lot to bring in more lines. Also, perhaps a sliding window based approach would give better detail. We shouldn't have a long conversation here though, if the Hough transform brings up questions you'll find lots of folks willing to answer specifics on here. Cheers.