Skip to content

Example for working with hough lines output #138

Closed
@xavriley

Description

@xavriley

I've been doing some work with hough line transforms in ImageMagick to try to identify and segment tables in scanned documents. This is working great so far with the following output:

You can see the red lines where the hough transform has been applied to the original image.

In the interests of doing this on a larger scale in a more efficient way I'd love to benchmark this against an equivalent vips implementation, but I'm having a hard time working out what to do with the output of the hough_lines command. So far I have:

> require 'vips'
# import the image shown above
> im = Vips::Image.new_from_file "/Users/xriley/Dropbox (Personal)/Public/29_hough.png"
# change the colour space to black and white for the hough_lines method
> im = im.colourspace(:'b-w')
=> #<Image 2359x1709 uchar, 1 bands, b-w>
> im = im.hough_line
=> #<Image 256x256 uint, 1 bands, matrix>

At this point I'd like to use the output from hough_line (assuming it has found the lines) to draw, say, 5px wide red lines onto the original image so that I can validate it. After that point I'd be aiming to segment the image based on those coordinates.

If there's any existing documentation or pointers you could offer I'd really appreciate it. The final aim with this is to make some open data relating to company ownership but that's a long way off yet! Thanks in advance.

p.s. my (very bad) image magick code is here for reference https://gist.github.com/xavriley/cda9ddd393ad43676b64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions