Created
November 14, 2011 00:09
-
-
Save gourneau/1362950 to your computer and use it in GitHub Desktop.
BeardDetector using SimpleCV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SimpleCV | |
| import time | |
| c = SimpleCV.Camera(1) | |
| js = SimpleCV.JpegStreamer() | |
| while(1): | |
| img = c.getImage() | |
| img = img.smooth() | |
| img = img.dilate() | |
| img = img.erode() | |
| lines = img.findLines(threshold=25,minlinelength=20,maxlinegap=20) | |
| [line.draw(color=(255,0,0)) for line in lines] | |
| sum = 0 | |
| for line in lines: | |
| sum = line.length() + sum | |
| if sum: | |
| print sum / len(lines) | |
| else: | |
| print "No beard found!" | |
| img.save(js.framebuffer) | |
| time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment