TMtx.PixelDownSample Method

void PixelDownSample(TMtx Dst, Int32 Pixels, TPixelDownSample mode)

Creates a reduced size dense matrix for screen display (bitmap) to show the matrix pattern.

#NameTypeDescription
1DstTMtxsource TMtx
2PixelsInt32
3modeTPixelDownSample

Result: stored in self (calling object)

Remarks:

Creates a reduced size dense matrix for screen display (bitmap) to show the matrix pattern. Pixels parameter defines the target number of pixels to reduce Dew.Math.TMtx.Rows and Dew.Math.TMtx.Cols to. The size reduction method depends on what you want to see:

  • pdsPattern , Returns 1 for all areas with at least one nonzero value regardless of its amplitude.
  • pdsAverage, Average all values within an area (pixel).
  • pdsPeak, Return only the maximum absolute value within an area (region will become one pixel).
Examples
TMtx Mtx;
TMtx ReducedMtx;
MtxVec.CreateIt(out Mtx, out ReducedMtx);
try
    {
        Mtx.Size(1000,1000,false);
        Mtx.RandGauss;
        // we're interested in averages, not pattern
        Mtx.PixelDownSample(ReducedMtx,200,pdsAverage);
        DrawIt(ReducedMtx);
    }
finally
    {
        MtxVec.FreeIt(ref Mtx, ref ReducedMtx);
    }