Extracting line segments from a hough transform
Basically, you'll have to keep track of exactly which points contributed a vote to each Hough bin. You can do this either after you fill the bins (as in the Matlab version) or as you're filling the bins (more efficient, but also more memory intensive which might not be good for an embedded platform). From there, you can follow the pixels along the line to extract the actual segments, creating a new segment when the gap between neighboring pixels is too large.
See this partial description of the Matlab algorithm for more information on how to extract which pixels contributed to a specific Hough bin, including the actual implementation (linked to as hough_bin_pixels.m).
I think this image, showing the Hough Transform for lines and segments will help you to catch what is happening: