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

simple detect line using hough transform #99

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jasson2001
Copy link

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!

#print result
return result

class Counter(dict):
Copy link
Owner

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?

Copy link
Author

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!

import math
import numpy as np

class Line():
Copy link
Owner

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?

Copy link
Author

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!

return 0

class LineDetectorByHough:
countersDICT = Counter(dict())
Copy link
Owner

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

Copy link
Author

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

def __init__(self):
pass

def find(self,img):
Copy link
Owner

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?

Copy link
Author

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!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 87.783% when pulling 9c7b3a0 on jasson2001:master into a8404d5 on luispedro:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 87.783% when pulling 9c7b3a0 on jasson2001:master into a8404d5 on luispedro:master.

@jasson2001
Copy link
Author

@luispedro : I have updated these code which you commented! please review it again, thank you!

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.

None yet

3 participants