PixelMath.minus((int) value, (GrayU8) input, (int) lower, (int) upper, (GrayU8) output); } else if (GrayS8.class == input.getClass()) { PixelMath.minus((int) value, (GrayS8) input, (int) lower, (int) upper, (GrayS8) output); } else if (GrayU16.class == input.getClass()) { PixelMath.minus((int) value, (GrayU16) input, (int) lower, (int) upper, (GrayU16) output); } else if (GrayS16.class == input.getClass()) { PixelMath.minus((int) value, (GrayS16) input, (int) lower, (int) upper, (GrayS16) output); } else if (GrayS32.class == input.getClass()) { PixelMath.minus((int) value, (GrayS32) input, (int) lower, (int) upper, (GrayS32) output); } else if (GrayS64.class == input.getClass()) { PixelMath.minus((long) value, (GrayS64) input, (long) lower, (long) upper, (GrayS64) output); } else if (GrayF32.class == input.getClass()) { PixelMath.minus((float) value, (GrayF32) input, (float) lower, (float) upper, (GrayF32) output); } else if (GrayF64.class == input.getClass()) { PixelMath.minus(value, (GrayF64) input, lower, upper, (GrayF64) output); } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); PixelMath.minus((int) value, (InterleavedU8) input, (int) lower, (int) upper, (InterleavedU8) output); } else if (InterleavedS8.class == input.getClass()) { PixelMath.minus((int) value, (InterleavedS8) input, (int) lower, (int) upper, (InterleavedS8) output); } else if (InterleavedU16.class == input.getClass()) { PixelMath.minus((int) value, (InterleavedU16) input, (int) lower, (int) upper, (InterleavedU16) output); } else if (InterleavedS16.class == input.getClass()) { PixelMath.minus((int) value, (InterleavedS16) input, (int) lower, (int) upper, (InterleavedS16) output); } else if (InterleavedS32.class == input.getClass()) { PixelMath.minus((int) value, (InterleavedS32) input, (int) lower, (int) upper, (InterleavedS32) output); } else if (InterleavedS64.class == input.getClass()) { PixelMath.minus((long) value, (InterleavedS64) input, (long) lower, (long) upper, (InterleavedS64) output);
if( input instanceof ImageGray) { if( GrayU8.class == input.getClass() ) { PixelMath.minus((int) value, (GrayU8) input, (GrayU8) output); } else if( GrayS8.class == input.getClass() ) { PixelMath.minus((int) value, (GrayS8) input, (GrayS8) output); } else if( GrayU16.class == input.getClass() ) { PixelMath.minus((int) value, (GrayU16) input, (GrayU16) output); } else if( GrayS16.class == input.getClass() ) { PixelMath.minus((int) value, (GrayS16) input, (GrayS16) output); } else if( GrayS32.class == input.getClass() ) { PixelMath.minus((int) value, (GrayS32) input, (GrayS32) output); } else if( GrayS64.class == input.getClass() ) { PixelMath.minus((long) value, (GrayS64) input, (GrayS64) output); } else if( GrayF32.class == input.getClass() ) { PixelMath.minus((float) value, (GrayF32) input, (GrayF32) output); } else if( GrayF64.class == input.getClass() ) { PixelMath.minus(value, (GrayF64) input, (GrayF64) output); } else { throw new IllegalArgumentException("Unknown image Type: "+input.getClass().getSimpleName()); PixelMath.minus((int) value, (InterleavedU8) input, (InterleavedU8) output); } else if( InterleavedS8.class == input.getClass() ) { PixelMath.minus((int) value, (InterleavedS8) input, (InterleavedS8) output); } else if( InterleavedU16.class == input.getClass() ) { PixelMath.minus((int) value, (InterleavedU16) input, (InterleavedU16) output); } else if( InterleavedS16.class == input.getClass() ) { PixelMath.minus((int) value, (InterleavedS16) input, (InterleavedS16) output); } else if( InterleavedS32.class == input.getClass() ) { PixelMath.minus((int) value, (InterleavedS32) input, (InterleavedS32) output);
if( input instanceof ImageGray) { if (GrayU8.class == input.getClass()) { PixelMath.minus((GrayU8) input, (int) value, (GrayU8) output); } else if (GrayS8.class == input.getClass()) { PixelMath.minus((GrayS8) input, (int) value, (GrayS8) output); } else if (GrayU16.class == input.getClass()) { PixelMath.minus((GrayU16) input, (int) value, (GrayU16) output); } else if (GrayS16.class == input.getClass()) { PixelMath.minus((GrayS16) input, (int) value, (GrayS16) output); } else if (GrayS32.class == input.getClass()) { PixelMath.minus((GrayS32) input, (int) value, (GrayS32) output); } else if (GrayS64.class == input.getClass()) { PixelMath.minus((GrayS64) input, (long) value, (GrayS64) output); } else if (GrayF32.class == input.getClass()) { PixelMath.minus((GrayF32) input, (float) value, (GrayF32) output); } else if (GrayF64.class == input.getClass()) { PixelMath.minus((GrayF64) input, value, (GrayF64) output); } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); PixelMath.minus((InterleavedU8) input, (int) value, (InterleavedU8) output); } else if (InterleavedS8.class == input.getClass()) { PixelMath.minus((InterleavedS8) input, (int) value, (InterleavedS8) output); } else if (InterleavedU16.class == input.getClass()) { PixelMath.minus((InterleavedU16) input, (int) value, (InterleavedU16) output); } else if (InterleavedS16.class == input.getClass()) { PixelMath.minus((InterleavedS16) input, (int) value, (InterleavedS16) output); } else if (InterleavedS32.class == input.getClass()) { PixelMath.minus((InterleavedS32) input, (int) value, (InterleavedS32) output);
PixelMath.minus((GrayU8) input, (int) value, (int) lower, (int) upper, (GrayU8) output); } else if (GrayS8.class == input.getClass()) { PixelMath.minus((GrayS8) input, (int) value, (int) lower, (int) upper, (GrayS8) output); } else if (GrayU16.class == input.getClass()) { PixelMath.minus((GrayU16) input, (int) value, (int) lower, (int) upper, (GrayU16) output); } else if (GrayS16.class == input.getClass()) { PixelMath.minus((GrayS16) input, (int) value, (int) lower, (int) upper, (GrayS16) output); } else if (GrayS32.class == input.getClass()) { PixelMath.minus((GrayS32) input, (int) value, (int) lower, (int) upper, (GrayS32) output); } else if (GrayS64.class == input.getClass()) { PixelMath.minus((GrayS64) input, (long) value, (long) lower, (long) upper, (GrayS64) output); } else if (GrayF32.class == input.getClass()) { PixelMath.minus((GrayF32) input, (float) value, (float) lower, (float) upper, (GrayF32) output); } else if (GrayF64.class == input.getClass()) { PixelMath.minus((GrayF64) input, value, lower, upper, (GrayF64) output); } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); PixelMath.minus((InterleavedU8) input, (int) value, (int) lower, (int) upper, (InterleavedU8) output); } else if (InterleavedS8.class == input.getClass()) { PixelMath.minus((InterleavedS8) input, (int) value, (int) lower, (int) upper, (InterleavedS8) output); } else if (InterleavedU16.class == input.getClass()) { PixelMath.minus((InterleavedU16) input, (int) value, (int) lower, (int) upper, (InterleavedU16) output); } else if (InterleavedS16.class == input.getClass()) { PixelMath.minus((InterleavedS16) input, (int) value, (int) lower, (int) upper, (InterleavedS16) output); } else if (InterleavedS32.class == input.getClass()) { PixelMath.minus((InterleavedS32) input, (int) value, (int) lower, (int) upper, (InterleavedS32) output); } else if (InterleavedS64.class == input.getClass()) { PixelMath.minus((InterleavedS64) input, (long) value, (long) lower, (long) upper, (InterleavedS64) output);
@Override public void setInputImage(GrayF32 image) { enlargedTemplate.reshape(image.width,image.height); fftImage.reshape(image.width,image.height); fftTemplate.reshape(image.width,image.height); fftMult.reshape(image.width,image.height); correlation.reshape(image.width,image.height); normalizedImage.reshape(image.width,image.height); maxValue = ImageStatistics.max(image)+0.0001f;// avoid divide by zero errors mean = ImageStatistics.mean(image); PixelMath.divide(image,maxValue,normalizedImage); PixelMath.minus(normalizedImage,mean/maxValue,normalizedImage); dft.forward(normalizedImage, fftImage); }
PixelMath.minus(normalizedTemplate,mean/maxValue,normalizedTemplate);