allopeap commited on
Commit
7eb2ab6
·
verified ·
1 Parent(s): ddafe9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -68,8 +68,18 @@ def detectarCatastro(pdf):
68
  for page_num in range(len(pdf)):
69
  page = pdf.load_page(page_num)
70
  pix = page.get_pixmap()
71
- image_np = np.frombuffer(pix.samples, dtype=np.uint8).reshape((pix.height, pix.width, 4))
72
- images.append(image_np)
 
 
 
 
 
 
 
 
 
 
73
 
74
 
75
  aligned_images = []
 
68
  for page_num in range(len(pdf)):
69
  page = pdf.load_page(page_num)
70
  pix = page.get_pixmap()
71
+
72
+
73
+ img_array = np.frombuffer(pix.samples, dtype=np.uint8)
74
+
75
+
76
+ if pix.alpha:
77
+ img_array = img_array.reshape((pix.height, pix.width, 4))
78
+ else:
79
+ img_array = img_array.reshape((pix.height, pix.width, 3))
80
+
81
+
82
+ images.append(img_array)
83
 
84
 
85
  aligned_images = []