if( input instanceof ImageGray ) { if (GrayU8.class == input.getClass()) { PixelMath.boundImage((GrayU8) input, (int) min, (int) max); } else if (GrayS8.class == input.getClass()) { PixelMath.boundImage((GrayS8) input, (int) min, (int) max); } else if (GrayU16.class == input.getClass()) { PixelMath.boundImage((GrayU16) input, (int) min, (int) max); } else if (GrayS16.class == input.getClass()) { PixelMath.boundImage((GrayS16) input, (int) min, (int) max); } else if (GrayS32.class == input.getClass()) { PixelMath.boundImage((GrayS32) input, (int) min, (int) max); } else if (GrayS64.class == input.getClass()) { PixelMath.boundImage((GrayS64) input, (long) min, (long) max); } else if (GrayF32.class == input.getClass()) { PixelMath.boundImage((GrayF32) input, (float) min, (float) max); } else if (GrayF64.class == input.getClass()) { PixelMath.boundImage((GrayF64) input, min, max); } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName());
public static void magnitudeAbs(ImageFlow flowImage, float maxValue, BufferedImage out) { GrayF32 magnitude = new GrayF32(flowImage.width,flowImage.height); for( int y = 0; y < flowImage.height; y++ ) { for( int x = 0; x < flowImage.width; x++ ) { ImageFlow.D f = flowImage.unsafe_get(x,y); if( !f.isValid() ) { out.setRGB(x,y,0xFF); } else { float m = Math.max(Math.abs(f.x),Math.abs(f.y)); magnitude.unsafe_set(x, y, m); } } } PixelMath.multiply(magnitude, 255 / maxValue, magnitude); PixelMath.boundImage(magnitude,0,255); ConvertBufferedImage.convertTo(magnitude,out); }
public static void magnitudeAbs(ImageFlow flowImage, float maxValue, BufferedImage out) { GrayF32 magnitude = new GrayF32(flowImage.width,flowImage.height); for( int y = 0; y < flowImage.height; y++ ) { for( int x = 0; x < flowImage.width; x++ ) { ImageFlow.D f = flowImage.unsafe_get(x,y); if( !f.isValid() ) { out.setRGB(x,y,0xFF); } else { float m = Math.max(Math.abs(f.x),Math.abs(f.y)); magnitude.unsafe_set(x, y, m); } } } PixelMath.multiply(magnitude, 255 / maxValue, magnitude); PixelMath.boundImage(magnitude,0,255); ConvertBufferedImage.convertTo(magnitude,out); }
PixelMath.boundImage(output, minValue, maxValue); return; PixelMath.boundImage(output, minValue, maxValue);
PixelMath.boundImage(output, minValue, maxValue); return; PixelMath.boundImage(output, minValue, maxValue);
PixelMath.boundImage(output,minValue,maxValue);
PixelMath.boundImage(output,minValue,maxValue);