How to remove non text part(Background) of the image card
I am developing an app for extracting number from image card using sample code of android-ocr(tesseract-ocr). I have trained the data as per the card font. It is detecting few card if the card having unique background, but if the card having multi background (attached sample) then the number is not recognizing. Even if the card number little overlapping the background then also not recognition.
I tried to use the below steps to remove the background.
- Smoothing the cropped image using
GaussianBlur( crop, crop, Size(3,3), 0, 0, BORDER_DEFAULT ); cvtColor( crop, crop, CV_RGB2GRAY );
- Edge detection using sobel:
crop = SobelEdgeDetect(crop);
- Converting to bitwise not:
cv::bitwise_not(crop,crop);
- Used adaptiveThreshold to remove shadowed kind of things:
adaptiveThreshold(crop,crop,255,CV_ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY,75,10);
After using these steps I am getting the image (attached bar-Process`png, citi1-Process.png, citi-Process.png), which is coming bold with blank space inside the number. In this case the ocr application is not recognize the number. I do not know how can fill these number with bold letter.
Now the big challenge for me to remove the background from any image card with out disturbing the text part of the card. So please suggest me how can I overcome all the above issue specific how can remove the background of the image.
I have attached few sample & output data for your reference. Thanks & regards
Anil
Just a remark, you have incorrectly added your images and your links to your data. Could you please fix this?
I have updated the image. please recheck.
Actually am I really the only one who finds it disturbing that you are trying to read peoples bank card numbers? Could you explain exactly what could be the purpose of this?
There are multiple uses are there for this activities, how can extract the text from an image and display in text form. I have taken some data of credit card. The main object of this activities is to detect any credit card number through mobile and do some online transaction over this.
It seems a pretty easy way of trying to recover peoples VISA card to do transactions without they knowing it. I find these kind of application pretty dangerous. Some stuff shouldn't be done with computer vision :)
I am just giving one example. My objective is how to remove non text background of any image object. If you have any concept please share.
StevenPuttemans, seems you have not heard of Card IO. Read about it here : http://www.theverge.com/2012/1/19/2719041/cardio-mobile-payment-app-ios-android-released