zombee11 commited on
Commit
bcc2f7d
·
verified ·
1 Parent(s): 04338e2

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -11
main.py CHANGED
@@ -48,19 +48,20 @@ def apply_mask(img, bbox, ratio):
48
  cv2.rectangle(img, p1, (p1[0] + mask_width, p3[1]), (0,0,0), -1)
49
  return img
50
 
 
51
  # -------------------------------
52
  # QR Mask
53
  # -------------------------------
54
- #def mask_qr_code(img):
55
- detector = cv2.QRCodeDetector()
56
- data, bbox, _ = detector.detectAndDecode(img)
57
-
58
- #if bbox is not None:
59
- bbox = bbox[0].astype(int)
60
- x1, y1 = bbox[0]
61
- x2, y2 = bbox[2]
62
- cv2.rectangle(img, (x1, y1), (x2, y2), (0,0,0), -1)
63
-
64
  #return img
65
 
66
  # -------------------------------
@@ -75,7 +76,7 @@ async def process_document(file: UploadFile = File(...)):
75
  # ✅ QR Mask (before resize)
76
  img = mask_qr_code(img)
77
 
78
- Resize
79
  h, w = img.shape[:2]
80
  img = cv2.resize(img, (1200, int(h * (1200/w))))
81
 
 
48
  cv2.rectangle(img, p1, (p1[0] + mask_width, p3[1]), (0,0,0), -1)
49
  return img
50
 
51
+ # -------------------------------
52
  # -------------------------------
53
  # QR Mask
54
  # -------------------------------
55
+ # def mask_qr_code(img):
56
+ # detector = cv2.QRCodeDetector()
57
+ # data, bbox, _ = detector.detectAndDecode(img)
58
+ #
59
+ # if bbox is not None:
60
+ # bbox = bbox[0].astype(int)
61
+ # x1, y1 = bbox[0]
62
+ # x2, y2 = bbox[2]
63
+ # cv2.rectangle(img, (x1, y1), (x2, y2), (0,0,0), -1)
64
+ #
65
  #return img
66
 
67
  # -------------------------------
 
76
  # ✅ QR Mask (before resize)
77
  img = mask_qr_code(img)
78
 
79
+ #Resize
80
  h, w = img.shape[:2]
81
  img = cv2.resize(img, (1200, int(h * (1200/w))))
82