Java Array Subtract subtractImages(float[][] top, float[][] base)

Here you can find the source of subtractImages(float[][] top, float[][] base)

Description

Subtracts two images from each other

License

Open Source License

Parameter

Parameter Description
top the top image
base the base image

Return

top - base

Declaration

public static float[][] subtractImages(float[][] top, float[][] base) 

Method Source Code

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

public class Main {
    /**//w  ww. ja v  a 2 s  .  c o m
     * Subtracts two images from each other
     * @param top the top image
     * @param base the base image
     * @return top - base
     */
    public static float[][] subtractImages(float[][] top, float[][] base) {
        int row_count = top.length;
        int column_count = top[0].length;
        float[][] subtracted_image_mat = new float[row_count][column_count];

        for (int row = 0; row < row_count; row++) {
            for (int column = 0; column < column_count; column++) {
                subtracted_image_mat[row][column] = top[row][column] - base[row][column];
            }
        }

        return subtracted_image_mat;
    }
}

Related

  1. subtract(int[] a, int[] b)
  2. subtract2(double[] v1, double[] v2, double[] res)
  3. subtractArray(double[] array1, double[] array2)
  4. subtractArray(float[] arr1, float[] arr2)
  5. subtractElementwise(int[] a, int[] b)
  6. subtractInPlace(double[] a, double[] b)
  7. subtractInPlace(double[] first, double[] second)
  8. subtractInPlace(final double[] a, final double[] b)
  9. subtractKeepPositiveValues(float[] dividend, float divisor)