I am working on core application in blackberry in which I need to perform OCR task.
Till now I have searched and found out that there are few online API's like ABBY which allows to read image and returns text file, but they are not free, after a few trails they charge a amount.
Can I perform Optical character recognition on device end completely with server implementation. Please suggest me for this task.
EDITED: I am working with the following code
public String serverUrl = "http://cloud.ocrsdk.com";
static final String BOUNDARY = "----------V2ymHFg03ehbqgZCaKO6jy";
public byte[] send() throws Exception
{
HttpConnection hc = null;
InputStream is = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] res = null;
try
{
hc = (HttpConnection) Connector.open(serverUrl+"/processImage/"+"language=en&exportFormat=txt");
hc.setRequestProperty("Content-Type", "multipart/image-JPG; boundary=" + BOUNDARY);
/*hc = (HttpConnection) Connector.open(SERVICE_URL);
hc.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
hc.setRequestProperty(PARAM_IMAGE, "");
hc.setRequestProperty(PARAM_LANGUAGE, lang);
hc.setRequestProperty(PARAM_APIKEY, key);*/
hc.setRequestMethod(HttpConnection.POST);
OutputStream dout = hc.openOutputStream();
dout.write(raw);
dout.close();
int ch;
StringBuffer sb= new StringBuffer();
is = hc.openInputStream();
while ((ch = is.read()) != -1)
{
bos.write(ch);
sb.append(ch);
}
System.out.println(sb);
res = bos.toByteArray();
}
catch(Exception e){
e.printStackTrace();
}
finally
{
try
{
if(bos != null)
bos.close();
if(is != null)
is.close();
if(hc != null)
hc.close();
}
catch(Exception e2)
{
e2.printStackTrace();
}
}
return res;
}
But even with this code its not working. I am getting 200 as response code after making HTTP request. but not getting perfect response as expected the text. In response I am getting ERROR PAGE of ABBYY. http://cloud.ocrsdk.com/GenericError.htm?aspxerrorpath=/processImage/language=English&exportFormat=txt;connectionhandler=httpc
Please suggest me :(