From b7fcf872cc28304b564e401a273db02f02925e1f Mon Sep 17 00:00:00 2001
From: dorababu <dorababu@subcom.tech>
Date: Thu, 8 Dec 2022 11:21:58 +0530
Subject: [PATCH] plot sample and get shape of np array

---
 ReadRawData/pyScripts/Merge.py | 77 ++++++++++++++++++++++++++++------
 1 file changed, 65 insertions(+), 12 deletions(-)

diff --git a/ReadRawData/pyScripts/Merge.py b/ReadRawData/pyScripts/Merge.py
index 89cc256..f95826b 100644
--- a/ReadRawData/pyScripts/Merge.py
+++ b/ReadRawData/pyScripts/Merge.py
@@ -40,8 +40,53 @@ def removedot(invertThin):
 
     return temp2
 
-# plot fp sample 
-def plot_sample(fp_image, x, y):
+# plot fp sample
+def plot_sample(fp_image):
+    '''
+    plot the given sample
+    '''
+    print(fp_image)
+    print(fp_image.shape)
+    fp_enhance_image= fingerprint_enhancer.enhance_Fingerprint(fp_image)
+
+    fp_enhance_image[fp_enhance_image == 255] =1
+
+    skeleton = skeletonize(fp_enhance_image)
+    skeleton = np.array(skeleton, dtype=np.uint8)
+    skeleton = removedot(skeleton)
+
+    plt.imshow(skeleton, 'gray')
+    plt.show()
+
+# extract sub array
+def extract_sample(arry):
+    '''
+    plot the given sample
+    '''
+    fp_sample = arry[0:32:1,0:32:1]
+    
+    print(fp_sample)
+    fp_image = np.reshape(fp_sample, (32,32))    
+    
+    print(fp_image.shape)
+
+    
+    # fp_image = np.array(fp_sample).reshape(32,32)
+
+    fp_enhance_image= fingerprint_enhancer.enhance_Fingerprint(fp_image)
+
+    fp_enhance_image[fp_enhance_image == 255] =1
+
+    skeleton = skeletonize(fp_enhance_image)
+    skeleton = np.array(skeleton, dtype=np.uint8)
+    skeleton = removedot(skeleton)
+
+    plt.imshow(skeleton, 'gray')
+    plt.show()
+    
+
+# plot fp samples 
+def plot_samples(fp_image, x, y):
     '''
     plot the given sample
     '''
@@ -64,7 +109,7 @@ if __name__ == "__main__":
     # Read fp data from the text file
 
     temps = np.loadtxt("fpData/fp_image.txt")
-    print(temps)
+    # print(temps)
     
     # shaping array as pixels 160x160 i.e, 25600 samples
     arr1 = np.array(temps[0]).reshape(160,160)
@@ -77,20 +122,28 @@ if __name__ == "__main__":
     arr7 = np.array(temps[6]).reshape(160,160)
     arr8 = np.array(temps[7]).reshape(160,160)
 
+    plot_sample(arr1)
+    
+    # extract_sample(arr1)
+
+    '''
     # plot samples 
-    plot_sample(arr1,2,1)
-    plot_sample(arr2,2,2)
-    plot_sample(arr3,2,3)
-    plot_sample(arr4,2,4)
-
-    plot_sample(arr5,2,5)
-    plot_sample(arr6,2,6)
-    plot_sample(arr7,2,7)
-    plot_sample(arr8,2,8)
+    plot_samples(arr1,2,1)
+    plot_samples(arr2,2,2)
+    plot_samples(arr3,2,3)
+    plot_samples(arr4,2,4)
+
+    plot_samples(arr5,2,5)
+    plot_samples(arr6,2,6)
+    plot_samples(arr7,2,7)
+    plot_samples(arr8,2,8)
   
 
     plt.show()
+    '''
     
+    # Merging all samples to single array 
+
     '''
     fp_array1 = np.concatenate((arr1,arr2), axis=1)
     fp_array2 = np.concatenate((arr3,arr4), axis=1)
-- 
GitLab