Results 1 to 5 of 5
- 01-28-2009, 09:20 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 5
- Rep Power
- 0
- 01-29-2009, 07:46 AM #2
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 13
Use javax.imageio.ImageIO to read/write images. To create an image from raw data, first create a java.awt.image.BufferedImage of the desired size, then call it's getRaster method to get a WritableRaster. Then call one of the setPixels methods on the WritableRaster with your data. Now you can persist the BufferedImage to a jpeg, or png, or whatever using ImageIO.
There are other ways to do it as well, but this is probably the easiest.
- 01-29-2009, 08:47 AM #3
Member
- Join Date
- Jan 2009
- Posts
- 5
- Rep Power
- 0
hello
thanks 4 reply
plz if u can mail me the simple code to do the same
and i have the byte stream coming from a hardware device and the byte stream are as following
0B01010101
0B00000000
0B00000000
0B00000000
0B00000000
0B00000000
0B00000000
0B00000000
0B00000000
upto 65 times
then again
0B01010101
again 65 readings
when any change then
0B00000100
now to explain
0B01010101 ------ marks starting of one frame
we have 65 readings in a frame
0B ---is header
now each 0 stands for a section of frame
0 stands for black and 1 stands for white
now the problem is convert it into an image
plz help me out
- 04-01-2009, 06:58 PM #4
Member
- Join Date
- Apr 2009
- Posts
- 1
- Rep Power
- 0
converting a colored image to a binary image
hello,
i am an engineering student
I need to convert the colored image to its binary image so as to apply Euclidean distance transform on the binary image...
i would be grateful if someone could tell me the code for conversion of a colored image to binary image.
- 04-01-2009, 08:27 PM #5
Germinius - Please don't hijack other people's threads. You probably want to take the average of the RGB values and apply a simple threshold (127 for example).
Nupurashi - If there are only 3 options then just detect which one it is and show whichever image you want. Otherwise, create a binary format BufferedImage of the correct size (8x8) and draw directly onto it, or cut off the 01010101 header and pass the trimmed array to the BufferedImage constructor.
Similar Threads
-
[SOLVED] passing array between main and method,vice-versa
By blueyan in forum New To JavaReplies: 5Last Post: 10-04-2008, 12:13 PM -
Converting to ASCII and vice-versa
By pheonix in forum New To JavaReplies: 2Last Post: 09-09-2008, 05:43 AM -
How do we exchange data between Java and JavaScript and vice-versa
By freddieMaize in forum Advanced JavaReplies: 0Last Post: 04-07-2008, 08:44 AM -
Converting multiple banded image into single banded image... Image enhancement
By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 06:29 PM -
Document conversion PDF to MS doc and vice versa
By abintoms in forum New To JavaReplies: 1Last Post: 08-08-2007, 01:45 AM
Bookmarks