• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

how to convert a bufferedImage into a string

 
Ranch Hand
Posts: 1143
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator




Can Anyone tell me how to convert an BufferedImage into a String, i tried it using the code which in in 'green' text., bt it's an error in the getPixel().
so how can i convert a bufferedImage into a String here???

again here is the code, which i used to convert, that i also have mentioned earlier in the program:

for(int y=0; y<image.getHeight(); y++){
for(int x=0; x<image.getWidth(); x++){
str1+=(String)image.getPixel(x,y);
}
}
 
Saloon Keeper
Posts: 14692
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why would you possibly convert an image to a String?
 
Punit Jain
Ranch Hand
Posts: 1143
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Why would you possibly convert an image to a String?



I have a label in my other class, and that label is converting into image, i want to print the text/string of that label, therefore i need to convert, is it possible to convert??
 
Bartender
Posts: 7488
171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the realm of Optical character recognition; Tesseract is a well-known library for this.
 
Punit Jain
Ranch Hand
Posts: 1143
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:That's the realm of Optical character recognition; Tesseract is a well-known library for this.



I have not used this type of library ever, can you please tell me how can i implement it here??
Here is two other classes i used:



one i have added earlier in this thread.
if is there any other way to get the text of the label, than please let me know.
 
Sheriff
Posts: 22716
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you even looked for the Tesseract library? Also, have you tried searching for java ocr?
 
Punit Jain
Ranch Hand
Posts: 1143
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:Have you even looked for the Tesseract library? Also, have you tried searching for java ocr?



i have not been looked it earlier, is there any other way to get my requirements, i added two classes also, if there is any other way, please tell me..
 
Tim Moores
Bartender
Posts: 7488
171
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not a trivial problem, and it cannot be explained in a short forum posting. You will need to spend a significant amount of time learning about OCR and any OCR library like Tesseract you intend to use. You should not expect to have a solution up and running today or tomorrow, and possibly some time after that. And if you have it running, it may not work, or not work well, for the particular type of image you're using.
 
Punit Jain
Ranch Hand
Posts: 1143
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:This is not a trivial problem, and it cannot be explained in a short forum posting. You will need to spend a significant amount of time learning about OCR and any OCR library like Tesseract you intend to use. You should not expect to have a solution up and running today or tomorrow, and possibly some time after that. And if you have it running, it may not work, or not work well, for the particular type of image you're using.



Thanks for your helpful advice..
 
reply
    Bookmark Topic Watch Topic
  • New Topic