Hi
I have data of an image of size 640 * 480 pixels, the data is in the format of 0s and 1s, in a txt file. Therefore there are 640*480=307200 characters (0s and 1s) in a text file. The catch is that 0 means that there was nothing in the original image (say black background) and 1 means there is (say a user is standing and it is pertaining to the user blob) and hence its NOT to be mistaken with RGB or byte data.
I need to read and convert this into an image of size 640*480 pixels in java,where pixels indicated by 0 may be set to one color (say black) and 1 to other (say white).
How do I do it??? thanks for help.
解决方案
First, you need to read it in. If you know it's width, you can do something like this:
BufferedReader in = new BufferedReader(new FileReader("myfile.txt"));
boolean[][] mask = new boolean[640][480];