/** * Rescales the input image and writes the results into the output image. The scale * factor is determined independently of the width and height. * @param input Input image. Not modified. * @param output Rescaled input image. Modified. * @param borderType Describes how pixels outside the image border should be handled. * @param interpType Which interpolation algorithm should be used. */ @Deprecated public static <T extends ImageBase<T>> void scale(T input, T output, BorderType borderType, InterpolationType interpType) { PixelTransformAffine_F32 model = DistortSupport.transformScale(output, input, null); if( input instanceof ImageGray) { distortSingle((ImageGray) input, (ImageGray) output, model, interpType, borderType); } else if( input instanceof Planar) { distortPL((Planar) input, (Planar) output, model, borderType, interpType); } }
distortSingle((ImageGray) input, (ImageGray) output, model, interpType, borderType); } else if( input instanceof Planar) { distortPL((Planar) input, (Planar) output, model,borderType, interpType);
distortSingle((ImageGray)input, (ImageGray)output, model, interpType, borderType); } else if( input instanceof Planar) { distortPL((Planar) input, (Planar) output, model, borderType, interpType);
/** * Applies a pixel transform to a {@link Planar} image. * * @deprecated As of v0.19. Use {@link FDistort} instead * * @param input Input (source) image. * @param output Where the result of transforming the image image is written to. * @param transform The transform that is being applied to the image * @param borderType Describes how pixels outside the image border should be handled. * @param interpType Which type of pixel interpolation should be used. */ public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>, M extends Planar<Input>,N extends Planar<Output>> void distortPL(M input, N output, PixelTransform2_F32 transform, BorderType borderType, InterpolationType interpType) { Class<Input> inputBandType = input.getBandType(); Class<Output> outputBandType = output.getBandType(); InterpolatePixelS<Input> interp = FactoryInterpolation.createPixelS(0, 255, interpType, borderType, inputBandType); ImageDistort<Input,Output> distorter = FactoryDistort.distortSB(false, interp, outputBandType); distorter.setModel(transform); distortPL(input,output,distorter); }
private void addRectified( final String name , final DMatrixRMaj rect1 , final DMatrixRMaj rect2 ) { FMatrixRMaj rect1_F32 = new FMatrixRMaj(3,3); // TODO simplify code some how FMatrixRMaj rect2_F32 = new FMatrixRMaj(3,3); ConvertMatrixData.convert(rect1, rect1_F32); ConvertMatrixData.convert(rect2, rect2_F32); // Will rectify the image ImageType<GrayF32> imageType = ImageType.single(GrayF32.class); ImageDistort<GrayF32,GrayF32> imageDistortLeft = RectifyImageOps.rectifyImage(param.getLeft(), rect1_F32, BorderType.ZERO, imageType); ImageDistort<GrayF32,GrayF32> imageDistortRight = RectifyImageOps.rectifyImage(param.getRight(), rect2_F32, BorderType.ZERO, imageType); // Fill the image with all black GImageMiscOps.fill(rectLeft, 0); GImageMiscOps.fill(rectRight,0); // Render the rectified image DistortImageOps.distortPL(distLeft, rectLeft, imageDistortLeft); DistortImageOps.distortPL(distRight, rectRight, imageDistortRight); // convert for output final BufferedImage outLeft = ConvertBufferedImage.convertTo(rectLeft, null,true); final BufferedImage outRight = ConvertBufferedImage.convertTo(rectRight, null, true); // Add this rectified image SwingUtilities.invokeLater(new Runnable() { public void run() { gui.addItem(new RectifiedPairPanel(true, outLeft, outRight), name); }}); }