dilippuri / PAN-Card-OCR

Retrive meaningful information from PAN Card image using tesseract-ocr :sunglasses:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'filter' object has no attribute 'split'

Alkeshm29 opened this issue · comments

lines = text.split('\n')
AttributeError: 'filter' object has no attribute 'split'

how to solve this error

What I had done there that If I grab text from image so it will return like paragraph now we have to process on each and every line of that paragraph so that's why I use "lines = text.split('\n')".

I get none value

put 'print text' statement before "lines = text.split("\n")" and check what you get. Actually, I am assuming that information comes in different lines

I git cloned your project and ran in cmd
E:\PAN-Card-OCR-master\PAN-Card-OCR-master\src>C:\Python27\python.exe crop_morphology.py test.jpg

It gives error as too many values to unpack

Then I gave only path as the second argument and now there is no error but can't see any output, the src folder contains five test images

C:\Python27\Scripts>E:\PAN-Card-OCR-master\PAN-Card-OCR-master\src\crop_morphology.py E:\PAN-Card-OCR-master\PAN-Card-OCR-master\src

C:\Python27\Scripts>E:\PAN-Card-OCR-master\PAN-Card-OCR-master\src\crop_morphology.py E:\PAN-Card-OCR-master\PAN-Card-OCR-master\src\test.jpg

try this one and see

By giving this,

C:\Python27\Scripts>E:\PAN-Card-OCR-master\PAN-Card-OCR-master\src\crop_morphology.py E:\PAN-Card-OCR-master\PAN-Card-OCR-master\src\test.jpg
Still
E:\PAN-Card-OCR-master\PAN-Card-OCR-master\src\test.jpg too many values to unpack

Brother can I get the step by step way to execute as this is an important project for me

let me know what do you wanna do?

there is no need to use crop_morphology.py in case you are extracting text from image

I want to get the name, DOB, pan number from pan card as a string.
Similarly for the Driving License and Aadhaar card.
Can you please share your email id at shahnawaj5488@rediffmail.com

Bro Please help with your email id at shahnawaj5488@rediffmail.com as tried a lot but things are not great.Need help asap.That would be great.

Hi Shahnawaz/Dilip,

I am working on same project, Could you please help me to execute this project.

I thought I need to work on it.
The first thing is that modularization of the program.
A complete change in logic and dependencies.
Tackle the problem in a much better way.

@Alkeshm29 @shahnawaj5488 @pritesh-tiwari

Please help.
What kinds of problems you got and how you tackle them?
Suggestions would be appretiated.

Hi Shahnawaz/Dilip,

I am working on same project, Could you please help me to execute this project, as I am facing the same issues as Shahnawaz faced, please help me out asap.

any solution for this issue??

I am facing the same issue!

I thought I need to work on it.
The first thing is that modularization of the program.
A complete change in logic and dependencies.
Tackle the problem in a much better way.

@Alkeshm29 @shahnawaj5488 @pritesh-tiwari

Please help.
What kinds of problems you got and how you tackle them?
Suggestions would be appretiated.

@dilippuri can you share your approach on the logic, how you are gonna solve this?
I am also stuck with the AttributeError: 'filter' object has no attribute 'split' and looking around the solution for this.

any help will be highly helpful on solving and building this project.

@dilippuri
Hi Dear,
I need to read PAN CARD, ADHAR CARD AND VOTERID CARD and save this data in a csv file or database file. Please help me on this.
I will be greatful to you. I am using your code but getting this error:
Traceback (most recent call last):
File "tpan.py", line 62, in
lines = text.split('\n')
AttributeError: 'filter' object has no attribute 'split'

Please help. I am in difficult situation.

add this line. it should work if using python3.
text = list(filter(lambda x: ord(x) < 128, text))
text = ' '.join([str(s) for s in text])