wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes how to convert a bufferedImage into a string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to convert a bufferedImage into a string" Watch "how to convert a bufferedImage into a string" New topic
Author

how to convert a bufferedImage into a string

Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 980
    
    2




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);
}
}
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3595
    
  14

Why would you possibly convert an image to a String?
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 980
    
    2
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??
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
That's the realm of Optical character recognition; Tesseract is a well-known library for this.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 980
    
    2
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.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 980
    
    2
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Aug 20, 2011
Posts: 980
    
    2
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..
 
Consider Paul's rocket mass heater.
 
subject: how to convert a bufferedImage into a string
 
Similar Threads
Paint Drag Preview
Magnifying only a part of the image
Positioning slider relative to word in JtextPane.
Drag and Drop problem
I need a little guidance