-
Notifications
You must be signed in to change notification settings - Fork 148
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
simple detect line using hough transform #99
base: main
Are you sure you want to change the base?
Conversation
mahotas/tests/LineDetectorByHough.py
Outdated
#print result | ||
return result | ||
|
||
class Counter(dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just collections.Counter
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I read the API, and try to using collections.Counter, it do better!
mahotas/tests/LineDetectorByHough.py
Outdated
import math | ||
import numpy as np | ||
|
||
class Line(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be replaced with a namedtuple
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I read the API, and replaced with a namedtuple, it do better!
mahotas/tests/LineDetectorByHough.py
Outdated
return 0 | ||
|
||
class LineDetectorByHough: | ||
countersDICT = Counter(dict()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the countsDICT
be a class-level variable, you must assign to it inside the __init__
constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to do it, but it does not work well - unit test failed
mahotas/tests/LineDetectorByHough.py
Outdated
def __init__(self): | ||
pass | ||
|
||
def find(self,img): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of mahotas uses a simpler functional interface.
It seems to me that this one function could be spun out so that you call "find_hough_lines(im)" and get back the counter? Am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I am enjoy the style of "simpler functional interface", so I add a functional interface, find_hough_lines(im)"
Because I am a new python programmer, mostly a Java programmer for OOP, maybe I will do later.
Thank you very much!
1 similar comment
@luispedro : I have updated these code which you commented! please review it again, thank you! |
I try to rename the file LineDetectorByHough to line_detector_by_hough, but test failed. Would you help me? If you rewrite other codes is my pleasure! Thank you very much!