Performs a horizontal 1D convolution which computes the mean value of elements
inside the kernel.

@param input The original image. Not modified.
@param output Where the resulting image is written to. Modified.
@param radius Kernel size.
195468
public static void horizontal(GrayF32 input, GrayF32 output, int radius) {

		boolean processed = BOverrideConvolveImageMean.invokeNativeHorizontal(input, output, radius);

		if( !processed ) {
			Kernel1D_F32 kernel = FactoryKernel.table1D_F32(radius, true);
			if (kernel.width > input.width) {
				ConvolveImageNormalized.horizontal(kernel, input, output);
			} else {
				InputSanityCheck.checkSameShape(input, output);
				ConvolveNormalized_JustBorder_SB.horizontal(kernel, input, output);
				if(BoofConcurrency.USE_CONCURRENT) {
					ImplConvolveMean_MT.horizontal(input, output, radius);
				} else {
					ImplConvolveMean.horizontal(input, output, radius);
				}
			}
		}
	}
365978
void applyGaussian(GrayF32 input, GrayF32 output, Kernel1D kernel) {
		tempBlur.reshape(input.width, input.height);
		GConvolveImageOps.horizontalNormalized(kernel, input, tempBlur);
		GConvolveImageOps.verticalNormalized(kernel, tempBlur,output);
	}
15699
public static void horizontal(Kernel1D_F32 kernel, InterleavedF32 src, InterleavedF32 dst ) {
		InputSanityCheck.checkSameShapeB(src, dst);

		boolean processed = BOverrideConvolveImageNormalized.invokeNativeHorizontal(kernel,src,dst);
		
		if( !processed ) {
			if( kernel.width >= src.width ) {
				ConvolveNormalizedNaive_IL.horizontal(kernel,src,dst);
			} else {
				if( Math.abs(kernel.computeSum() - 1.0f) > 1e-4f ) {
					Kernel1D_F32 k = kernel.copy();
					KernelMath.normalizeSumToOne(k);
					kernel = k;
				}
				ConvolveImageNoBorder.horizontal(kernel,src,dst);
				ConvolveNormalized_JustBorder_IL.horizontal(kernel,src,dst);
			}
		}
	}
900709
public static void grayToBitmap( GrayU8 input , Bitmap output , byte[] storage) {
		if( output.getWidth() != input.getWidth() || output.getHeight() != input.getHeight() ) {
			throw new IllegalArgumentException("Image shapes are not the same");
		}
		
		if( storage == null )
			storage = declareStorage(output,null);
		
		ImplConvertBitmap.grayToArray(input, storage,output.getConfig());
		output.copyPixelsFromBuffer(ByteBuffer.wrap(storage));
	}
3694
public static void minimum(Planar<GrayF64> input, GrayF64 output) {
		output.reshape(input.width,input.height);
		if (BoofConcurrency.USE_CONCURRENT) {
			ImplImageBandMath_MT.minimum(input, output, 0, input.getNumBands() - 1);
		} else {
			ImplImageBandMath.minimum(input, output, 0, input.getNumBands() - 1);
		}
	}
937815
public static <T extends ImageGray<T>> void stdDev(Planar<T> input, T output, @Nullable T avg) {
		stdDev(input, output, avg, 0, input.getNumBands() - 1);
	}
420808
public static <T extends ImageGray<T>>
	void scaleDown2(T input , T output ) {
		if( input instanceof GrayF32) {
			ImplPyramidOps.scaleDown2((GrayF32)input,(GrayF32)output);
		} else if( input instanceof GrayU8) {
			ImplPyramidOps.scaleDown2((GrayU8)input,(GrayU8)output);
		} else {
			throw new IllegalArgumentException("Image type not yet supported");
		}
	}
1034672
public static void scaleDown2(GrayF32 input , GrayF32 output ) {
		
		output.reshape(input.width / 2, input.height / 2);

		for (int y = 0; y < output.height; y++) {
			int indexInput = 2*y*input.stride;
			int indexOutput = y*output.stride;
			for (int x = 0; x < output.width; x++,indexInput+=2) {
				output.data[indexOutput++] = input.data[indexInput];
			}
		}
	}
278841
@Override
    public int[] predict(INDArray input) {
        INDArray output = activate(input, false, LayerWorkspaceMgr.noWorkspacesImmutable());
        int[] ret = new int[input.rows()];
        for (int i = 0; i < ret.length; i++)
            ret[i] = Nd4j.getBlasWrapper().iamax(output.getRow(i));
        return ret;
    }
1083852
public static <T extends ImageGray<T>> void minimum(Planar<T> input, T output) {
		minimum(input, output, 0, input.getNumBands() - 1);
	}
618173
function computeInputData(manager, input) {
  var session = manager.session;
  var pointers = input.pointers;
  var pointersLength = pointers.length;

  // store the first input to calculate the distance and direction
  if (!session.firstInput) {
    session.firstInput = simpleCloneInputData(input);
  }

  // to compute scale and rotation we need to store the multiple touches
  if (pointersLength > 1 && !session.firstMultiple) {
    session.firstMultiple = simpleCloneInputData(input);
  } else if (pointersLength === 1) {
    session.firstMultiple = false;
  }

  var firstInput = session.firstInput;
  var firstMultiple = session.firstMultiple;
  var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;

  var center = input.center = getCenter(pointers);
  input.timeStamp = now();
  input.deltaTime = input.timeStamp - firstInput.timeStamp;

  input.angle = getAngle(offsetCenter, center);
  input.distance = getDistance(offsetCenter, center);

  computeDeltaXY(session, input);
  input.offsetDirection = getDirection(input.deltaX, input.deltaY);

  input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
  input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;

  computeIntervalInputData(session, input);

  // find the correct target
  var target = manager.element;
  if (hasParent(input.srcEvent.target, target)) {
    target = input.srcEvent.target;
  }
  input.target = target;
}
215671
@Override
    public ImageSource apply(ImageSource input) {
        if (input.isGrayscale()) {
            return input;
        }
        if (!isAlgorithm) {
            double r, g, b, gray;

            for (int i = 0; i < EffectHelper.getSize(input); i++) {
                r = EffectHelper.getRed(i, input);
                g = EffectHelper.getGreen(i, input);
                b = EffectHelper.getBlue(i, input);
                int a = EffectHelper.getAlpha(i, input);

                gray = (r * redCoefficient + g * greenCoefficient + b * blueCoefficient);

                EffectHelper.setRGB(i, (int) gray, (int) gray, (int) gray, a, input);
            }
            return input;
        } else {
            return apply(input, grayscaleMethod);
        }
    }
995450
public static INDArray conv2d(INDArray input, INDArray kernel, Type type) {
        return Nd4j.getConvolution().conv2d(input, kernel, type);
    }
176
@Override
    public ImageSource apply(ImageSource input) {
        int w = input.getWidth();
        int h = input.getHeight();

        MatrixSource output = new MatrixSource(input);

        Vector3 n = new Vector3(0, 0, 1);

        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {

                if (x < border || x == w - border || y < border || y == h - border) {
                    output.setRGB(x, y, VectorHelper.Z_NORMAL);
                    continue;
                }

                float s0 = input.getR(x - 1, y + 1);
                float s1 = input.getR(x, y + 1);
                float s2 = input.getR(x + 1, y + 1);
                float s3 = input.getR(x - 1, y);
                float s5 = input.getR(x + 1, y);
                float s6 = input.getR(x - 1, y - 1);
                float s7 = input.getR(x, y - 1);
                float s8 = input.getR(x + 1, y - 1);

                float nx = -(s2 - s0 + 2 * (s5 - s3) + s8 - s6);
                float ny = -(s6 - s0 + 2 * (s7 - s1) + s8 - s2);

                n.set(nx, ny, scale);
                n.nor();

                int rgb = VectorHelper.vectorToColor(n);
                output.setRGB(x, y, rgb);
            }
        }

        return new MatrixSource(output);
    }
647553
public void setInput( I input ) {
		derivX.reshape(input.width,input.height);
		derivY.reshape(input.width,input.height);

		// pixel gradient
		gradient.process(input,derivX,derivY);
	}
1296443
public static <T extends ImageBase<T>> void abs( T input , T output )
	{
		if( input instanceof ImageGray) {
			if (GrayS8.class == input.getClass()) {
				PixelMath.abs((GrayS8) input, (GrayS8) output);
			} else if (GrayS16.class == input.getClass()) {
				PixelMath.abs((GrayS16) input, (GrayS16) output);
			} else if (GrayS32.class == input.getClass()) {
				PixelMath.abs((GrayS32) input, (GrayS32) output);
			} else if (GrayS64.class == input.getClass()) {
				PixelMath.abs((GrayS64) input, (GrayS64) output);
			} else if (GrayF32.class == input.getClass()) {
				PixelMath.abs((GrayF32) input, (GrayF32) output);
			} else if (GrayF64.class == input.getClass()) {
				PixelMath.abs((GrayF64) input, (GrayF64) output);
			}
			// otherwise assume it is an unsigned image type
		} else if( input instanceof ImageInterleaved ) {
			if (InterleavedS8.class == input.getClass()) {
				PixelMath.abs((InterleavedS8) input, (InterleavedS8) output);
			} else if (InterleavedS16.class == input.getClass()) {
				PixelMath.abs((InterleavedS16) input, (InterleavedS16) output);
			} else if (InterleavedS32.class == input.getClass()) {
				PixelMath.abs((InterleavedS32) input, (InterleavedS32) output);
			} else if (InterleavedS64.class == input.getClass()) {
				PixelMath.abs((InterleavedS64) input, (InterleavedS64) output);
			} else if (InterleavedF32.class == input.getClass()) {
				PixelMath.abs((InterleavedF32) input, (InterleavedF32) output);
			} else if (InterleavedF64.class == input.getClass()) {
				PixelMath.abs((InterleavedF64) input, (InterleavedF64) output);
			}
		} else {
			Planar in = (Planar)input;
			Planar out = (Planar)output;

			for (int i = 0; i < in.getNumBands(); i++) {
				abs(in.getBand(i),out.getBand(i));
			}
		}
	}
364471
public static void rotateCW( GrayS32 input , GrayS32 output ) {
		if( input.width != output.height || input.height != output.width )
			throw new IllegalArgumentException("Incompatible shapes");

		int h = input.height-1;

		for( int y = 0; y < input.height; y++ ) {
			int indexIn = input.startIndex + y*input.stride;
			for (int x = 0; x < input.width; x++) {
				output.unsafe_set(h-y,x,input.data[indexIn++]);
			}
		}
	}