get Pixel Deviate Weights Array - Android Graphics

Android examples for Graphics:Bitmap Byte Array

Description

get Pixel Deviate Weights Array

Demo Code


//package com.book2s;

import android.graphics.Color;

public class Main {
    public static int[] getPixelDeviateWeightsArray(int[] pixels,
            final int averageColor) {
        int[] dest = new int[pixels.length];
        for (int i = 0; i < pixels.length; i++) {
            dest[i] = Color.red(pixels[i]) - averageColor > 0 ? 1 : 0;
        }//from   ww w  .  j a  v a2  s  . co m
        return dest;
    }
}

Related Tutorials