I loaded an 8bit grayscale image into octave with imread, then I saved it in ascii format and got a giant list of all of it's values. Then I dithered it with a 2x2 matrix in Java and printed out a list of each dithered matrix all on one line.
If the matrix for a pixel in my program turns out to be this:
0 2
3 1
Then the output that my program generates looks like:
0 2 3 1
Then I have all of the matrices for each pixel in that format all on one line. How can I load this into octave to see the final dithered image?
I was messing around with octave and created a simple matrix like the first one I showed and saved that to a file, then I was able to put it all on one line and load it up again just fine. I tried to then replace the matrix in that file with the matrix my program generated, but octave doesn't seem to be loading that in. The matrix it tried to load it to doesn't get changed at all.
I dont think I fully understood your question, but if you are having trouble interacting with the file system, I suggest using the functions dlmread and dlmwrite.
The follow code should provide an example to get you started:
%Random 4 by 4 matrix
M = rand(4,4)
%Write matrix to file system
dlmwrite("filename.txt",M);
%Read it back and store in an other variable
M2 = dlmread("filename.txt")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With