@Override public void setRenderAll(boolean renderAll) { layerDistort.setRenderAll(renderAll); }
/** * Applies a pixel transform to a single band image. More flexible but order to use function. * * @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 renderAll true it renders all pixels, even ones outside the input image. * @param transform The transform that is being applied to the image * @param interp Interpolation algorithm. */ public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>> void distortSingle(Input input, Output output, boolean renderAll, PixelTransform2_F32 transform, InterpolatePixelS<Input> interp) { Class<Output> inputType = (Class<Output>)input.getClass(); ImageDistort<Input,Output> distorter = FactoryDistort.distortSB(false, interp, inputType); distorter.setRenderAll(renderAll); distorter.setModel(transform); distorter.apply(input,output); }
/** * Applies a pixel transform to a single band image. Easier to use function. * * @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 interpType Which type of pixel interpolation should be used. BILINEAR is in general recommended * @param borderType Specifies how to handle image borders. */ public static <Input extends ImageGray<Input>,Output extends ImageGray<Output>> void distortSingle(Input input, Output output, PixelTransform2_F32 transform, InterpolationType interpType, BorderType borderType) { boolean skip = borderType == BorderType.SKIP; if( skip ) borderType = BorderType.EXTENDED; Class<Input> inputType = (Class<Input>)input.getClass(); Class<Output> outputType = (Class<Output>)input.getClass(); InterpolatePixelS<Input> interp = FactoryInterpolation.createPixelS(0, 255, interpType, borderType, inputType); ImageDistort<Input,Output> distorter = FactoryDistort.distortSB(false, interp, outputType); distorter.setRenderAll(!skip); distorter.setModel(transform); distorter.apply(input,output); }
FactoryInterpolation.createPixel(0, 255, InterpolationType.BILINEAR,borderType, imageType); distortImage = FactoryDistort.distort(true, interp, imageType); distortImage.setRenderAll(true);
/** * Creates an {@link ImageDistort} for rectifying an image given its radial distortion and * rectification matrix. * * @param param Intrinsic parameters. * @param rectify Transform for rectifying the image. * @param imageType Type of single band image the transform is to be applied to. * @return ImageDistort for rectifying the image. */ public static <T extends ImageBase> ImageDistort<T,T> rectifyImage(CameraPinholeRadial param, DenseMatrix64F rectify , BorderType borderType, ImageType<T> imageType) { boolean skip = borderType == BorderType.SKIP; if( skip ) { borderType = BorderType.EXTENDED; } InterpolatePixel<T> interp = FactoryInterpolation.createPixel(0,255, InterpolationType.BILINEAR,borderType,imageType); // only compute the transform once ImageDistort<T,T> ret = FactoryDistort.distort(true, interp, imageType); ret.setRenderAll(!skip); Point2Transform2_F32 transform = transformRectToPixel_F32(param, rectify); ret.setModel(new PointToPixelTransform_F32(transform)); return ret; }
/** * Creates an {@link ImageDistort} for rectifying an image given its radial distortion and * rectification matrix. * * @param param Intrinsic parameters. * @param rectify Transform for rectifying the image. * @param imageType Type of single band image the transform is to be applied to. * @return ImageDistort for rectifying the image. */ public static <T extends ImageBase<T>> ImageDistort<T,T> rectifyImage(CameraPinholeRadial param, FMatrixRMaj rectify , BorderType borderType, ImageType<T> imageType) { boolean skip = borderType == BorderType.SKIP; if( skip ) { borderType = BorderType.EXTENDED; } InterpolatePixel<T> interp = FactoryInterpolation.createPixel(0,255, InterpolationType.BILINEAR,borderType,imageType); // only compute the transform once ImageDistort<T,T> ret = FactoryDistort.distort(true, interp, imageType); ret.setRenderAll(!skip); Point2Transform2_F32 transform = transformRectToPixel(param, rectify); ret.setModel(new PointToPixelTransform_F32(transform)); return ret; }
FactoryInterpolation.createPixel(0, 255, InterpolationType.BILINEAR,borderType, imageType); distortImage = FactoryDistort.distort(true, interp, imageType); distortImage.setRenderAll(true);
distort.setRenderAll(!skip );
FactoryInterpolation.createPixel(0, 255, InterpolationType.BILINEAR,borderType, imageType); distortImage = FactoryDistort.distort(true, interp, imageType); distortImage.setRenderAll(true);
/** * Creates an {@link ImageDistort} for rectifying an image given its rectification matrix. * Lens distortion is assumed to have been previously removed. * * @param rectify Transform for rectifying the image. * @param imageType Type of single band image the transform is to be applied to. * @return ImageDistort for rectifying the image. */ public static <T extends ImageGray> ImageDistort<T,T> rectifyImage( DenseMatrix64F rectify , BorderType borderType, Class<T> imageType) { boolean skip = borderType == BorderType.SKIP; if( skip ) { borderType = BorderType.EXTENDED; } InterpolatePixelS<T> interp = FactoryInterpolation.bilinearPixelS(imageType, borderType); DenseMatrix64F rectifyInv = new DenseMatrix64F(3,3); CommonOps.invert(rectify,rectifyInv); PointTransformHomography_F32 rectifyTran = new PointTransformHomography_F32(rectifyInv); // don't bother caching the results since it is likely to only be applied once and is cheap to compute ImageDistort<T,T> ret = FactoryDistort.distortSB(false, interp, imageType); ret.setRenderAll(!skip); ret.setModel(new PointToPixelTransform_F32(rectifyTran)); return ret; }
/** * Creates an {@link ImageDistort} for rectifying an image given its rectification matrix. * Lens distortion is assumed to have been previously removed. * * @param rectify Transform for rectifying the image. * @param imageType Type of single band image the transform is to be applied to. * @return ImageDistort for rectifying the image. */ public static <T extends ImageGray<T>> ImageDistort<T,T> rectifyImage( FMatrixRMaj rectify , BorderType borderType, Class<T> imageType) { boolean skip = borderType == BorderType.SKIP; if( skip ) { borderType = BorderType.EXTENDED; } InterpolatePixelS<T> interp = FactoryInterpolation.bilinearPixelS(imageType, borderType); FMatrixRMaj rectifyInv = new FMatrixRMaj(3,3); CommonOps_FDRM.invert(rectify,rectifyInv); PointTransformHomography_F32 rectifyTran = new PointTransformHomography_F32(rectifyInv); // don't bother caching the results since it is likely to only be applied once and is cheap to compute ImageDistort<T,T> ret = FactoryDistort.distortSB(false, interp, imageType); ret.setRenderAll(!skip); ret.setModel(new PointToPixelTransform_F32(rectifyTran)); return ret; }
FactoryInterpolation.createPixel(0, 255, InterpolationType.BILINEAR,borderType, imageType); distortImage = FactoryDistort.distort(true, interp, imageType); distortImage.setRenderAll(true);
distort.setRenderAll(!skip );