Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add implementation of Hough transforms #512

Merged
merged 39 commits into from
Jan 25, 2021

Conversation

simmplecoder
Copy link
Contributor

@simmplecoder simmplecoder commented Aug 4, 2020

Description

Adds Hough line, circle and ellipse transforms. Also adds support for line and circle rasterization

References

http://groups.csail.mit.edu/graphics/classes/6.837/F02/lectures/6.837-7_Line.pdf

https://en.wikipedia.org/wiki/Hough_transform#:~:text=The%20Hough%20transform%20is%20a,shapes%20by%20a%20voting%20procedure.

Tasklist

  • Implement Hough line transform
  • Test Hough line transform
  • Implement line rasterization
  • Test line rasterization
  • Implement Hough circle transform
  • Test Hough circle transform
    - [ ] Implement Hough ellipse transform
  • [ ] Test Hough ellipse transform
  • Ensure all CI builds pass - RIP Travis CI. Long live our GitHub Actions setup!
  • Review and approve

@simmplecoder simmplecoder marked this pull request as draft August 4, 2020 21:05
@simmplecoder simmplecoder marked this pull request as ready for review August 23, 2020 20:22
@mloskot mloskot added the google-summer-of-code All items related to GSoC activities label Aug 24, 2020
@mloskot mloskot changed the title Hough transform Add implementation of Hough transforms Aug 24, 2020
@mloskot mloskot added cat/feature New feature or functionality core boost/gil labels Aug 24, 2020
Copy link
Member

@mloskot mloskot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simmplecoder Here is my first round of comments to this PR. See also my question on Slack

example/circle.cpp Outdated Show resolved Hide resolved
example/circle.cpp Outdated Show resolved Hide resolved
example/line.cpp Outdated Show resolved Hide resolved
example/hough_circle_transform.cpp Outdated Show resolved Hide resolved
example/hough_line_transform.cpp Outdated Show resolved Hide resolved
include/boost/gil/rasterization/line.hpp Outdated Show resolved Hide resolved
test/core/rasterization/CMakeLists.txt Outdated Show resolved Hide resolved
test/core/rasterization/line.cpp Outdated Show resolved Hide resolved
test/core/rasterization/line.cpp Outdated Show resolved Hide resolved
test/core/rasterization/circle.cpp Outdated Show resolved Hide resolved
@simmplecoder
Copy link
Contributor Author

@mloskot, TravisCI seems a bit confused due to force push (I accidentally confused diffusion branch with Hough transform). The changes did pass tests on my repo: https://travis-ci.org/github/simmplecoder/gil/builds/721137117

@mloskot
Copy link
Member

mloskot commented Aug 26, 2020

@simmplecoder

TravisCI seems a bit confused due to force push

I re-started builds on Travis CI and AzP. I am not able to restart builds on AppVeyor (it's owned by @stefanseefeld and I'm still not a member there :-)). Let's see how the restarted ones go.

You could make a dummy change, a comment or re-format (e.g. east-const cleanup) and push to kickstart rebuild.
We will squash-merge this PR eventually, so fixup commits are fine.

@mloskot
Copy link
Member

mloskot commented Jan 24, 2021

@simmplecoder Looks like recent merges created some conflicts for this PR. Would you be able to resolve them? If not, I can do it, just let me know. Other than that, I think it's ready to be merged.

@mloskot mloskot added this to the Boost 1.76+ milestone Jan 24, 2021
@simmplecoder
Copy link
Contributor Author

simmplecoder commented Jan 25, 2021

@mloskot turns out I had some local work I didn't push, I believe I should be able to sort it out tomorrow evening. I'll write back when it is ready.

Turns out I have been mistaken. I rebased off of current develop, shouldn't have problems with merge now.

Support construction from step_size,
step_count, and a function for angles
Implement angle and radious version of
Hough line transform and adds a demo
with static line that goes over
secondary diagonal
Also account for case of zero
coefficient
Naive and incremental algorithms were
removed because they are supposed
to produce the same results anyway.
The reason for diverging results
is inaccuracy of floating point numbers
Trigonometric circle rasterizer does
not follow circle equation, but still
produces very round shapes. A new
testing methodology needs to be devised
for this rasterizer
Fix improper mirroring in rasterization
Fix overflow bug
Implement proper image sizing
The line test used old free function
version of the rasterization
The new version accepts start and
points inclusively and tries to use
canonic representation during
computations
Slope decided to be is
(diff_y + 1) / (diff_x + 1). License
headers were also added
Copy link
Member

@mloskot mloskot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @simmplecoder for your great efforts!

@mloskot mloskot merged commit a37f12b into boostorg:develop Jan 25, 2021
meshtag pushed a commit to meshtag/gil that referenced this pull request Apr 21, 2021
Support construction from step_size, step_count, and a function for angles

Implement angle and radious version of Hough line transform and adds a demo
with static line that goes over secondary diagonal.

Implement incremental line raster
Implement naive line raster
Implement Bresenham line raster
Leave only Bresenham line rasterization

Naive and incremental algorithms were removed because they are supposed
to produce the same results anyway.
The reason for diverging results is inaccuracy of floating point numbers

Add circle rendering through trigonometric functions, using
arctan(1 / (radius + 1)) as minimal angle step.

Trigonometric circle rasterizer does not follow circle equation, but still
produces very round shapes.
A new testing methodology needs to be devised for this rasterizer.

The new version accepts start and points inclusively and tries to use
canonic representation during computations.

Slope decided to be is (diff_y + 1) / (diff_x + 1).
meshtag pushed a commit to meshtag/gil that referenced this pull request Apr 22, 2021
Support construction from step_size, step_count, and a function for angles

Implement angle and radious version of Hough line transform and adds a demo
with static line that goes over secondary diagonal.

Implement incremental line raster
Implement naive line raster
Implement Bresenham line raster
Leave only Bresenham line rasterization

Naive and incremental algorithms were removed because they are supposed
to produce the same results anyway.
The reason for diverging results is inaccuracy of floating point numbers

Add circle rendering through trigonometric functions, using
arctan(1 / (radius + 1)) as minimal angle step.

Trigonometric circle rasterizer does not follow circle equation, but still
produces very round shapes.
A new testing methodology needs to be devised for this rasterizer.

The new version accepts start and points inclusively and tries to use
canonic representation during computations.

Slope decided to be is (diff_y + 1) / (diff_x + 1).
@mloskot mloskot mentioned this pull request May 12, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat/feature New feature or functionality core boost/gil google-summer-of-code All items related to GSoC activities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants