simple detect line using hough transform#99
simple detect line using hough transform#99jasson2001 wants to merge 3 commits intoluispedro:mainfrom
Conversation
mahotas/tests/LineDetectorByHough.py
Outdated
| #print result | ||
| return result | ||
|
|
||
| class Counter(dict): |
There was a problem hiding this comment.
Isn't this just collections.Counter?
There was a problem hiding this comment.
Yes, I read the API, and try to using collections.Counter, it do better!
| import math | ||
| import numpy as np | ||
|
|
||
| class Line(): |
There was a problem hiding this comment.
Could this be replaced with a namedtuple?
There was a problem hiding this comment.
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.
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.
I try to do it, but it does not work well - unit test failed
| def __init__(self): | ||
| pass | ||
|
|
||
| def find(self,img): |
There was a problem hiding this comment.
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.
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!