Java Byte Create toByte(float[][] in, byte[] out, float min, float max)

Here you can find the source of toByte(float[][] in, byte[] out, float min, float max)

Description

to Byte

License

Open Source License

Declaration

public static void toByte(float[][] in, byte[] out, float min, float max) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void toByte(float[][] in, byte[] out, float min, float max) {
        int width = in[0].length;
        int height = in.length;
        for (int yy = 0; yy < height; yy++) {
            for (int xx = 0; xx < width; xx++) {
                out[yy * width + xx] = (byte) (255 * (in[yy][xx] - min) / (max - min));
            }/* ww w  .j  ava 2 s. c o  m*/
        }
    }

    public static void toByte(float[] in, byte[] out, float min, float max) {
        int height = in.length;
        for (int yy = 0; yy < height; yy++) {
            out[yy] = (byte) (255 * (in[yy] - min) / (max - min));
        }
    }

    public static void toByte(double[] in, byte[] out, float min, float max) {
        int height = in.length;
        for (int yy = 0; yy < height; yy++) {
            out[yy] = (byte) (255 * (in[yy] - min) / (max - min));
        }
    }
}

Related

  1. toByte(final byte[] buffer, final int offset)
  2. toByte(final int highNibble, final int lowNibble)
  3. toByte(final String bitString)
  4. toByte(final String strHexa)
  5. toByte(final String value)
  6. toByte(int i)
  7. toByte(int n)
  8. toByte(int rgb)
  9. toByte(long l)