Created
October 26, 2012 18:40
-
-
Save oostendo/3960617 to your computer and use it in GitHub Desktop.
This file contains 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
def findShaftTransition(self,img,left_guess,right_guess,top_cutoff): | |
""" | |
Walk the line on the shaft find where it starts to bulge out | |
""" | |
def transformFromROI(roi, points): | |
return np.array([(p[0] + roi[0], p[1] + roi[1]) for p in points]) | |
right_guess = sorted(right_guess, key = lambda l: l[1]) #make sure it's bottom, top | |
roi_delta = 50 | |
right_roi = [right_guess[0][0] - roi_delta, top_cutoff, roi_delta * 2, img.height] | |
right_crop = img.crop(*right_roi) | |
edge_locations = np.where(right_crop.getGrayNumpy() > 127) | |
right_points = transformFromROI(right_roi, zip(*edge_locations)) | |
rhs = np.sort(right_points[right_points[:,0] == right_guess[0][0]], axis = 1)[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment