Skip to content

Commit

Permalink
Imperfect fix for dewarp padding bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Braddock Gaskill committed Sep 3, 2015
1 parent 0dabf6f commit be2e6d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ocrolib/lineest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ def measure(self,line):
def dewarp(self,img,cval=0,dtype=dtype('f')):
assert img.shape==self.shape
h,w = img.shape
padded = vstack([cval*ones((h,w)),img,cval*ones((h,w))])
center = self.center+h
# Changed pad to two times height to "fix" center
# exceeding pad height resulting in the error:
# ValueError: setting an array element with a sequence.
# -braddock
padded = vstack([cval*ones((2*h,w)),img,cval*ones((2*h,w))])
center = self.center + 2 * h
dewarped = [padded[center[i]-self.r:center[i]+self.r,i] for i in range(w)]
dewarped = array(dewarped,dtype=dtype).T
return dewarped
Expand Down

0 comments on commit be2e6d1

Please sign in to comment.