rohanrao619 / Aadhaar_OCR

Extraction, Verification and Masking of Aadhaar UIDs from photos and scanned documents.
MIT License
8 stars 2 forks source link

IndexError: string index out of range #1

Closed rashibudati closed 2 years ago

rashibudati commented 3 years ago

I am passing a jpg file directly. The issue persists even though I pass a pdf file.

IndexError Traceback (most recent call last)

in () 9 # masked_img,possible_UIDs = Extract_and_Mask_UIDs('pdf2img.jpg') 10 # else: ---> 11 masked_img,possible_UIDs = Extract_and_Mask_UIDs(input_path) 12 13 if masked_img!=None and input_path.split('.')[-1]=="pdf": in Regex_Search(bounding_boxes) 8 for character in range(len(bounding_boxes)): 9 # print(bounding_boxes[character]) ---> 10 Result = Result + bounding_boxes[character][0] 11 # print(Result) 12 IndexError: string index out of range
rohanrao619 commented 3 years ago

Hi Rashi,

Glad that you reached out! I am sorry for the late reply. I have fixed the issue on Github now, you can take the new code from there.

To be more specific, Try replacing lines 8-9 in the Regex_Search function cell with the code given below :

for character in range(len(bounding_boxes)): if len(bounding_boxes[character])!=0: Result += bounding_boxes[character][0] else: Result += '?'

Let me know if it worked. If you face any other issues, feel free to mail me.

Regards, Rohan

On Thu, Nov 5, 2020 at 2:52 PM Rashi Budati notifications@github.com wrote:

IndexError Traceback (most recent call last) in () 9 # masked_img,possible_UIDs = Extract_and_Mask_UIDs('pdf2img.jpg') 10 # else: ---> 11 masked_img,possible_UIDs = Extract_and_Mask_UIDs(input_path) 12 13 if masked_img!=None and input_path.split('.')[-1]=="pdf":

in Regex_Search(bounding_boxes) 8 for character in range(len(bounding_boxes)): 9 # print(bounding_boxes[character]) ---> 10 Result = Result + bounding_boxes[character][0] 11 # print(Result) 12

IndexError: string index out of range

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rohanrao619/Aadhaar_OCR/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALF7LJ7TDXJJ2XZVAYVZKMTSOJVG5ANCNFSM4TLDKT3Q .