-1

I'm asked to create an Android application using OCR and Zxing to scan a code bar. The result should have the "Codebar image" in an ImageView and the "scan result" and "OCR result" in the a TextView.

Could any one please explain me how to do it, as I'm new to Android development.

I have added the code below to the captureActivity of the zxing2.1. I also addes the Tess-two.jar to the Zxing. And when i executed the application stopped. can any one please tell me how to add the OCR code to zxing. Here is the code that i added to Zxing.

 private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
    statusView.setVisibility(View.GONE);
    viewfinderView.setVisibility(View.GONE);
    resultView.setVisibility(View.VISIBLE);

String textocrResult;


ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
if (barcode == null) {
  barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
      R.drawable.launcher_icon));
} else {
  barcodeImageView.setImageBitmap(barcode);
  baseApi.setImage(ReadFile.readBitmap(barcode));
  textocrResult = baseApi.getUTF8Text();
  ocrResult = new OcrResult();
  ocrResult.setText(textocrResult);
  ocrResult.setBitmap(barcode);
  TextView ocrResultTextView = (TextView) findViewById(R.id.ocr_result_text_view);
  ocrResultTextView.setText(textocrResult);

}
Praful Bhatnagar
  • 7,425
  • 2
  • 36
  • 44
Sarumathi
  • 1
  • 1
  • 2
  • i have imported the zxing 2.1 to the eclipse and added the core.jar to it. and when i executed it,i got the result of the Barcode image and the scan result.Now can i add the OCR function to the same Zxing2.1? if so how to do it. Thanks in advance. Its urgent.. please help from any of you. – Sarumathi Mar 27 '13 at 13:42
  • 1
    what is your question? – Qadir Hussain Mar 28 '13 at 10:12
  • Qadir Hussain, My question is how to get the OCR result from the Zxing Appli.I have got the imageresult of the Barcode and the scan result of the barcode using zxing.Now how to use the same imageresult to read the numbers below the barcode. above is the code tht i have used to OCR the imageresult but it fails. please help me if u can. Its very urgent please. – Sarumathi Mar 29 '13 at 11:17

1 Answers1

0

There is a sample that comes with Zxing that can detect if there is a barcode with matched parameters that you selected or no, then it decodes it. You can start from there, note that I'm not sure if ZXing API can let you get the image of the barcode itself or you do it yourself by some computer vision code. ZXing With Android

andre_lamothe
  • 2,171
  • 2
  • 41
  • 74
  • i just added the zxing 2.1 and added the core.jar to it and when i executed i got the image of the barcode and its result. Now how to ocr the image of the barcode?? any help please... – Sarumathi Mar 27 '13 at 14:58
  • you need to do image processing using opencv. – andre_lamothe Mar 27 '13 at 15:42
  • Thank u Ahmed Saleh for ur response. should i do image processing to the image of the barcode. I have got the image using Zxing now i should use OCR on that image to read the nubers below the Barcode.Please tell me if u have any idea how to proceed.. – Sarumathi Mar 28 '13 at 09:48
  • @Sarumathi This can help http://stackoverflow.com/questions/9413216/simple-digit-recognition-ocr-in-opencv-python – andre_lamothe Mar 28 '13 at 11:52