How to remove non text part(Background) of the image card

asked 2013-08-28 08:43:38 -0500

aklenka gravatar image

updated 2013-08-29 06:08:35 -0500

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.

  1. Smoothing the cropped image using GaussianBlur( crop, crop, Size(3,3), 0, 0, BORDER_DEFAULT ); cvtColor( crop, crop, CV_RGB2GRAY );
  2. Edge detection using sobel: crop = SobelEdgeDetect(crop);
  3. Converting to bitwise not: cv::bitwise_not(crop,crop);
  4. 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. image description Thanks & regards


edit retag flag offensive close merge delete


Just a remark, you have incorrectly added your images and your links to your data. Could you please fix this?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-29 04:51:21 -0500 )edit

I have updated the image. please recheck.

aklenka gravatar imageaklenka ( 2013-08-29 06:09:40 -0500 )edit

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?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-29 06:16:43 -0500 )edit

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.

aklenka gravatar imageaklenka ( 2013-08-29 08:22:37 -0500 )edit

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 :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-29 08:46:40 -0500 )edit

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.

aklenka gravatar imageaklenka ( 2013-08-29 23:25:03 -0500 )edit

StevenPuttemans, seems you have not heard of Card IO. Read about it here :

Kumar Abhishek gravatar imageKumar Abhishek ( 2014-06-06 06:00:17 -0500 )edit