Permalink
Browse files

Returns normalized image array from image path

  • Loading branch information...
1 parent b084bf1 commit 7c759e6be6e94298c9efae6d5f794f3d67f34316 @swvist committed Nov 12, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 ocrn/data.py
View
@@ -17,13 +17,17 @@ def normalizeArrayCell(self, array, x, y):
if array[i,j] < array[x,y] and array[i,j] < array[x,y]-0.2*c:
array[i,j]=array[x,y]-0.2*c
- # Returns a Normalized 2D Array.
+ # Returns a Normalized 2D Array from an Input Array.
# normalizeArrayCell is called for all non zero cells
def getNormalizedArray(self, imagearray):
nonzerocells = np.transpose(imagearray.nonzero())
for i in range (0, nonzerocells.shape[0]):
self.normalizeArrayCell(imagearray, nonzerocells[i][0],nonzerocells[i][1])
return imagearray
+ # Returns Normalized 2D array from an Image
+ def getNormalizedImageArray(self, imagepath):
+ return self.getNormalizedArray(self.getImageArray(imagepath))
+

0 comments on commit 7c759e6

Please sign in to comment.