Thank you!

On Sat, Jun 9, 2018 at 3:23 PM, ShreeDevi Kumar <[email protected]>
wrote:

> For tess4j see
>
> https://github.com/nguyenq/tess4j/blob/master/src/test/
> java/net/sourceforge/tess4j/TessAPI1Test.java
>
>
>
> On Sun 10 Jun, 2018, 12:51 AM Dattatraya Tembare, <[email protected]>
> wrote:
>
>> I have used another method, and it worked perfectly.
>>
>> public static void main(String[] args) {
>>  String fileStr = "C:/EA/mp-out/im/1/3/1-0.png";
>>  File file = new File(fileStr);
>>  //380x45+220+170
>>  int xsize = 0;
>>  int ysize = 0;
>>  BufferedImage bufImage=null;
>>  ByteBuffer buf = null;
>>  try {
>>  bufImage = ImageIO.read(file);
>>  IIOImage image=new IIOImage(bufImage,null,null);
>>  buf = ImageIOHelper.getImageByteBuffer(image);
>>  } catch (IOException e2) {
>>  e2.printStackTrace();
>>  }
>>  Rectangle rect = new Rectangle(220, 170, 380, 45); // define an equal
>> or smaller region of interest on the image
>>  int bpp = 8; //Gray=8, RGB=24
>>
>>  Tesseract in = new ReadImageText().getTesseractInstance("C:/Program
>> Files (x86)/Tesseract-OCR/tessdata/", "hin");
>>  try {
>>  String resultText = in.doOCR(bufImage, rect);
>>  //in.doOCR(xsize, ysize, buf, rect, bpp);
>>  log.info("resultText: {}", resultText);
>>  } catch (TesseractException e) {
>>  e.printStackTrace();
>>  }
>>  }
>>
>>
>> On Saturday, June 9, 2018 at 3:07:02 PM UTC-4, Dattatraya Tembare wrote:
>>>
>>> I'm trying to read the text from an image at some particular location in
>>> an image. I have image dimensions and desired rectangle dometions.
>>> Here is the code implementation:
>>>
>>> public static void main(String[] args) {
>>>  String fileStr = "C:/EA/mp-out/im/1/3/1-0.png";
>>>  File file = new File(fileStr);
>>>  //380x45+220+170
>>>  int xsize = 0;
>>>  int ysize = 0;
>>>  BufferedImage bufImage;
>>>  ByteBuffer buf = null;
>>>  try {
>>>  bufImage = ImageIO.read(file);
>>>  IIOImage image=new IIOImage(bufImage,null,null);
>>>  buf = ImageIOHelper.getImageByteBuffer(image);
>>>  } catch (IOException e2) {
>>>  e2.printStackTrace();
>>>  }
>>>  Rectangle rect = new Rectangle(0, 0, 600, 265); // define an equal or
>>> smaller region of interest on the image
>>>  int bpp = 8; //Gray=8, RGB=24
>>>
>>>  Tesseract in = new ReadImageText().getTesseractInstance("C:/Program
>>> Files (x86)/Tesseract-OCR/tessdata/", "hin");
>>>  try {
>>>  String resultText = in.doOCR(xsize, ysize, buf, rect, bpp);
>>>  log.info("resultText: {}", resultText);
>>>  } catch (TesseractException e) {
>>>  e.printStackTrace();
>>>  }
>>>  }
>>>
>>> When I have executed the code, go below error:
>>>
>>> java.lang.NullPointerException: null
>>>  at net.sourceforge.tess4j.Tesseract.getOCRText(Tesseract.java:434)
>>>  at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:351)
>>>  at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:323)
>>>  at com.ea.ocr.tesseract.ReadImageText.main(ReadImageText.java:74)
>>>
>>> Please look into it and let me know if anyone has any idea.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "tesseract-ocr" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/tesseract-ocr.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/tesseract-ocr/243234f1-405a-45bb-a249-dd8eebd0e9f9%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/tesseract-ocr/243234f1-405a-45bb-a249-dd8eebd0e9f9%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "tesseract-ocr" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/tesseract-ocr.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/tesseract-ocr/CAG2NduUyDSJ%2BvER64TySsg82jaP-UAH1T9BX%
> 3Db_yzJDWnRjjZg%40mail.gmail.com
> <https://groups.google.com/d/msgid/tesseract-ocr/CAG2NduUyDSJ%2BvER64TySsg82jaP-UAH1T9BX%3Db_yzJDWnRjjZg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Best Regards,
Dattatraya Tembare
+1 914 721 6311

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/CAHZwW_8UC_EYjWPgQNEGarAQAVNu2MGT2er5N1TKEOuxcSX%3Dkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to