i want to extract text from color images but its not occuring can aspose apis help me to have method to read color images? like this image can be extracted?
Hi Moon,
Thank you for your inquiry and for providing the sample image.
We have investigated the mentioned issue while using the sample image provided by you. We have used the latest version of Aspose.OCR for Java 2.7.0. While testing it was found that the images provided by you has very low DPI value i.e. 72. Please note that the current implementation of the Aspose.OCR APIs perform well with images having resolution of at least 300 DPI and the accuracy rate tends to decrease by decreasing the resolution. Your provided image has resolution of 72 DPI therefore it will not be possible to get 100% accuracy if you wish to scan the complete image. On the other hand, if you intend to get some specific contents from a portion of the image, you can use the custom recognition blocks to get better accuracy.
Please note, the above mentioned solution is useful in scenario when you have documents following the similar structure, that is; the contents to be scanned are always on the same location for each image.
Consider the following code snippet that we used to extract information from image provided by you using custom recognition blocks.
String imagePath = "C:\\omr_files\\b.jpg";
OcrEngine ocrEngine = new OcrEngine();
ocrEngine.setImage(ImageStream.fromFile(imagePath));
ocrEngine.getConfig().setDoSpellingCorrection(true);
ocrEngine.getConfig().setRemoveNonText(true);
ocrEngine.getConfig().addRecognitionBlock(RecognitionBlock.createTextBlock(182, 218, 160, 66));
if (ocrEngine.process())
{
System.out.println(ocrEngine.getText());
}
Following is the Output
A FR n 4ZO
SINDH
Hope the above information helps. In case of any issues, need further clearance please be sure to let us know, we will be glad to assist you.
i used your defined code but using this image but no output came. run successful but no out put just blank out put there.
and the block u provided …there came runtime error.
mun mughal:i used your defined code but using this image but no output came. run successful but no out put just blank out put there.package ocr2;//import com.aspose.ocr.OCRConfig;import com.aspose.ocr.OcrEngine;import com.aspose.ocr.ImageStream;import com.aspose.ocr.RecognitionBlock;/**** @author mun*/public class Ocr2 {/*** @param args the command line arguments*/public static void main(String[] args) {// TODO code application logic hereString imagepath="C:\\Users\\mun\\Desktop\\aspose-ocr-2.7.0-java\\lib\\output.jpg";OcrEngine ocrEngine = new OcrEngine();ocrEngine.setImage(ImageStream.fromFile(imagepath));ocrEngine.getConfig().setDoSpellingCorrection(true);ocrEngine.getConfig().setRemoveNonText(true);ocrEngine.getConfig().addRecognitionBlock(RecognitionBlock.createTextBlock(182, 218, 160, 66));if (ocrEngine.process()){System.out.println(ocrEngine.getText());}}}
mun mughal:and the block u provided ..there came runtime error.Exception in thread "main" class com.aspose.ocr.OcrException: class com.aspose.ocr.OcrException: Error occurred during recognition. ---> class com.aspose.ocr.internal.h: Recognition block right edge exceeds image border.Parameter name: recognition blockcom.aspose.ocr.internal.bnl.a(Unknown Source)com.aspose.ocr.internal.bnl.a(Unknown Source)com.aspose.ocr.OcrEngine.a(Unknown Source)com.aspose.ocr.OcrEngine.process(Unknown Source)ocr3.Ocr3.main(Ocr3.java:53)--- End of inner exception stack trace ---com.aspose.ocr.OcrEngine.a(Unknown Source)com.aspose.ocr.OcrEngine.process(Unknown Source)ocr3.Ocr3.main(Ocr3.java:53) ---> class com.aspose.ocr.OcrException: Error occurred during recognition. ---> class com.aspose.ocr.internal.h: Recognition block right edge exceeds image border.Parameter name: recognition blockcom.aspose.ocr.internal.bnl.a(Unknown Source)com.aspose.ocr.internal.bnl.a(Unknown Source)com.aspose.ocr.OcrEngine.a(Unknown Source)com.aspose.ocr.OcrEngine.process(Unknown Source)ocr3.Ocr3.main(Ocr3.java:53)--- End of inner exception stack trace ---com.aspose.ocr.OcrEngine.a(Unknown Source)com.aspose.ocr.OcrEngine.process(Unknown Source)ocr3.Ocr3.main(Ocr3.java:53)--- End of inner exception stack trace ---com.aspose.ocr.OcrEngine.process(Unknown Source)ocr3.Ocr3.main(Ocr3.java:53)at com.aspose.ocr.OcrEngine.process(Unknown Source)at ocr3.Ocr3.main(Ocr3.java:53)Caused by: class com.aspose.ocr.OcrException: Error occurred during recognition. ---> class com.aspose.ocr.internal.h: Recognition block right edge exceeds image border.Parameter name: recognition blockcom.aspose.ocr.internal.bnl.a(Unknown Source)com.aspose.ocr.internal.bnl.a(Unknown Source)com.aspose.ocr.OcrEngine.a(Unknown Source)com.aspose.ocr.OcrEngine.process(Unknown Source)ocr3.Ocr3.main(Ocr3.java:53)--- End of inner exception stack trace ---com.aspose.ocr.OcrEngine.a(Unknown Source)com.aspose.ocr.OcrEngine.process(Unknown Source)ocr3.Ocr3.main(Ocr3.java:53)at com.aspose.ocr.OcrEngine.a(Unknown Source)... 2 moreCaused by: class com.aspose.ocr.internal.h: Recognition block right edge exceeds image border.Parameter name: recognition blockcom.aspose.ocr.internal.bnl.a(Unknown Source)com.aspose.ocr.internal.bnl.a(Unknown Source)com.aspose.ocr.OcrEngine.a(Unknown Source)com.aspose.ocr.OcrEngine.process(Unknown Source)ocr3.Ocr3.main(Ocr3.java:53)at com.aspose.ocr.internal.bnl.a(Unknown Source)at com.aspose.ocr.internal.bnl.a(Unknown Source)... 3 moreJava Result: 1BUILD SUCCESSFUL (total time: 5 seconds)
how can i know the dpi of image?
- Right Click the image.
- Select Properties menu item at the end.
- Go to Details tab.
is this possible to send text as a message using your apis? im doing this on java platform.