/** * Converts a {@link InterleavedS16} into a {@link GrayS16} by computing the average value of each pixel * across all the bands. * * @param input (Input) The ImageInterleaved that is being converted. Not modified. * @param output (Optional) The single band output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 average( InterleavedS16 input , GrayS16 output ) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ConvertInterleavedToSingle.average(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayS8} into a {@link boofcv.struct.image.GrayS16}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 convert(GrayS8 input, GrayS16 output) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayU16} into a {@link boofcv.struct.image.GrayS16}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 convert(GrayU16 input, GrayS16 output) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayF64} into a {@link boofcv.struct.image.GrayS16}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 convert(GrayF64 input, GrayS16 output) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayU8} into a {@link boofcv.struct.image.GrayS16}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 convert(GrayU8 input, GrayS16 output) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayS64} into a {@link boofcv.struct.image.GrayS16}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 convert(GrayS64 input, GrayS16 output) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * Converts a {@link Planar} into a {@link ImageGray} by computing the average value of each pixel * across all the bands. * * @param input Input Planar image that is being converted. Not modified. * @param output (Optional) The single band output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 average( Planar<GrayS16> input , GrayS16 output ) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertPlanarToGray.average(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayS32} into a {@link boofcv.struct.image.GrayS16}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 convert(GrayS32 input, GrayS16 output) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * <p> * Converts an {@link boofcv.struct.image.GrayF32} into a {@link boofcv.struct.image.GrayS16}. * </p> * * @param input Input image which is being converted. Not modified. * @param output (Optional) The output image. If null a new image is created. Modified. * @return Converted image. */ public static GrayS16 convert(GrayF32 input, GrayS16 output) { if (output == null) { output = new GrayS16(input.width, input.height); } else { output.reshape(input.width,input.height); } ImplConvertImage.convert(input, output); return output; }
/** * Computes the Laplacian of input image. * * @param orig Input image. Not modified. * @param deriv Where the Laplacian is written to. Modified. */ public static void process(GrayU8 orig, GrayS16 deriv) { deriv.reshape(orig.width,orig.height); final byte[] data = orig.data; final short[] out = deriv.data; final int width = orig.getWidth(); final int height = orig.getHeight() - 1; final int stride = orig.stride; for (int y = 1; y < height; y++) { int index = orig.startIndex + stride * y + 1; int indexOut = deriv.startIndex + deriv.stride * y + 1; int endX = index + width - 2; for (; index < endX; index++) { int v = data[index - stride] & 0xFF; v += data[index - 1] & 0xFF; v += -4 * (data[index] & 0xFF); v += data[index + 1] & 0xFF; v += data[index + stride] & 0xFF; out[indexOut++] = (short) v; } } }