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

Wrapped polygon methods, faster copy and new skeletonization algorithm #256

Merged
merged 6 commits into from
Sep 13, 2019

Conversation

valillon
Copy link
Contributor

@valillon valillon commented Dec 18, 2018

Hi @kylemcdonald ,

Recently using your addon, I come across with some needs and finally ended up implementing them.
Major changes in this request:

  • Added wrappers for fillConvexPoly() and pointPolygonTest().
  • Faster cv::Mat copy in CLD method by using opencv pointers.
  • New skeletonization algorithm based on the Zhang-Suen method. It's slower but more robust. Actually I found some wrong behavior in the current ofxCv::thin(). I leave it there in the commit since it is faster and can works fine for simple cases.

ofxcv_thin

zhang_suen

@roymacdonald
Copy link
Contributor

Hi @valillon,
I found this same odd behavior some time ago, made some fixes but ended up agreeing with @kylemcdonald that it was not a good fix.
look here #183
and it's related PR #184
What's currently implemented is not doing the skeletonization properly It is not doing all the iterations it needs, so that's probably the reason for such a big difference in the processing times.
I'll try out your pr and let you know.
cheers

@valillon
Copy link
Contributor Author

valillon commented Apr 8, 2019

Hi Roy!,

Actually Kyle already mentioned the same Zhang-Suen algorithm in this comment.
Thanks for testing.

@roymacdonald
Copy link
Contributor

Hey @valillon
much better then!
I will test soon and let you know.
best!

@valillon
Copy link
Contributor Author

valillon commented Apr 8, 2019

Hi again! I just did some simple optimizations to the Nash's skeletonize code in my local branch here.
It depends much on the complexity of the binary image, but at least for the images in example-coherent-lines it performs about x2 faster.

@kylemcdonald
Copy link
Owner

thank you! this generally looks good. thanks for checking @roymacdonald since i know you've thought about this before.

@kylemcdonald kylemcdonald merged commit fd79707 into kylemcdonald:master Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants