Thursday, November 22, 2012

Using Octave/Matlab for plotting a histogram showing frequency of byte-values in a file


octave:1> myfile = fopen('Pachmarhi3.png', 'rb');
octave:2> mydata = fread(myfile, 'uint8');
octave:3> size(mydata)
ans =
           72181       1
octave:4> hist(mydata, (0:255)');

octave:5> axis([0 255]);

octave:6> xlabel ("Byte value")

octave:7> ylabel ("Counts")
octave:8> title ("A histogram showing frequency of byte-values in a file");



octave:9>

 The file "Pachmarhi3.png":

No comments:

Post a Comment