In english: you are breaking your image into 2 by 2 pixel regions and
assigning each pixel in a region a value 0 1 2 3 (upper left, upper
right, lower left, lower right) and then extracting that pixel from
each of the regions, for your result.

In your current implementation, you pick a random value for the pixel
choice, and then you use it on the entire region.  But that value is
not a parameter for the verb 'sample'.  Instead you give a value which
the choice must be less than, and you have sample pick an arbitrary
value from the resulting range.  Why?

-- 
Raul

On Mon, Dec 31, 2012 at 6:07 PM, Brian Schott <[email protected]> wrote:
>         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=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to