[Jprogramming] image compression

Brian Schott schott.brian at gmail.com
Mon Dec 31 23:07:27 UTC 2012


 	I developed a small image compression script which 
is applied to a "thresholded" image from the G component 
only of the RGB triplet. (Although my example below is of an 
8x8 thresholded image, in practice it is 52x52.)

    wind=: 2 2$2
    sample=: 4 : 'wind (?x)&{@,;._3"2 y'
    ]specimen=: 8 8?.@$2  NB. the test thresholded image
0 1 0 1 1 1 0 0
0 1 0 1 0 0 1 0
0 0 0 0 1 1 1 0
0 0 0 0 1 1 0 1
1 0 0 1 0 0 1 0
1 0 0 0 0 1 0 1
0 0 1 0 0 1 0 0
1 0 0 1 0 1 0 0
    2 (4&sample) specimen NB. a random resulting compression

 	Eventually I will have to do this compression in C 
and I am very weak in C, so I am looking for an alternative 
calculation that gives approximately the same result but 
using something like matrix multiplication. I am just 
beginning to learn the terminology of image transformation, 
but this may be an example of a "convolution" in that 
discipline.

 	So, my question is (I think) can a random 
convolution matrix be constructed to accomplish a similar 
result using matrix multiplication, for which I have found a 
c code example at rosettacode.org?

http://rosettacode.org/wiki/Matrix_multiplication#C

Thanks,

(B=)


More information about the Programming mailing list