Java Matrix Invert invertRegions(int[][] image)

Here you can find the source of invertRegions(int[][] image)

Description

invert Regions

License

Open Source License

Declaration

public static int[][] invertRegions(int[][] image) 

Method Source Code

//package com.java2s;
/*****************************************************************************
 ** ANGRYBIRDS AI AGENT FRAMEWORK/* w w  w .  j a  v a2  s  .  c o  m*/
 ** Copyright (c) 2013,XiaoYu (Gary) Ge, Stephen Gould,Jochen Renz
 **  Sahan Abeyasinghe, Jim Keys, Kar-Wai Lim, Zain Mubashir,  Andrew Wang, Peng Zhang
 ** All rights reserved.
 **This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 
 **To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ 
 *or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
 *****************************************************************************/

public class Main {
    public static int[][] invertRegions(int[][] image) {
        final int height = image.length;
        final int width = height > 0 ? image[0].length : 0;

        for (int y = 0; y < height; y++)
            for (int x = 0; x < width; x++)
                image[y][x] = image[y][x] == 0 ? 1 : 0;

        return image;
    }
}

Related

  1. invert44Matrix(final double[] m, final double[] invOut)
  2. invertDataSet(double[][] dataSet)
  3. invertMatrix(int[][] matrix)
  4. invertMatrix3x3(float[] result, float[] m)
  5. invertMatrix4x4(double[][] A)
  6. invertSymmetric2x2(final double[][] m, final double[][] inverse)
  7. invertSymmetric3x3(final double[][] m, final double[][] inverse)
  8. invertUpperTriangular(double[][] r)