Search in sources :

Example 16 with PointToPixelTransform_F32

use of boofcv.struct.distort.PointToPixelTransform_F32 in project BoofCV by lessthanoptimal.

the class LensDistortionOps method changeCameraModel.

/**
 * Creates a distortion for modifying the input image from one camera model into another camera model. If
 * requested the camera model can be further modified to ensure certain visibility requirements are meet
 * and the adjusted camera model will be returned.
 *
 * @param type How it should modify the image model to ensure visibility of pixels.
 * @param borderType How the image border is handled
 * @param original The original camera model
 * @param desired The desired camera model
 * @param modified (Optional) The desired camera model after being rescaled. Can be null.
 * @param imageType Type of image.
 * @return Image distortion from original camera model to the modified one.
 */
public static <T extends ImageBase<T>, O extends CameraPinhole, D extends CameraPinhole> ImageDistort<T, T> changeCameraModel(AdjustmentType type, BorderType borderType, O original, D desired, @Nullable D modified, ImageType<T> imageType) {
    Class bandType = imageType.getImageClass();
    boolean skip = borderType == BorderType.SKIP;
    // it has to process the border at some point, so if skip is requested just skip stuff truly outside the image
    if (skip)
        borderType = BorderType.EXTENDED;
    InterpolatePixelS interp = FactoryInterpolation.createPixelS(0, 255, InterpolationType.BILINEAR, borderType, bandType);
    Point2Transform2_F32 undistToDist = LensDistortionOps_F32.transformChangeModel(type, original, desired, true, modified);
    ImageDistort<T, T> distort = FactoryDistort.distort(true, interp, imageType);
    distort.setModel(new PointToPixelTransform_F32(undistToDist));
    distort.setRenderAll(!skip);
    return distort;
}
Also used : InterpolatePixelS(boofcv.alg.interpolate.InterpolatePixelS) PointToPixelTransform_F32(boofcv.struct.distort.PointToPixelTransform_F32) Point2Transform2_F32(boofcv.struct.distort.Point2Transform2_F32)

Example 17 with PointToPixelTransform_F32

use of boofcv.struct.distort.PointToPixelTransform_F32 in project BoofCV by lessthanoptimal.

the class VisOdomPixelDepthPnP_to_DepthVisualOdometry method setCalibration.

@Override
public void setCalibration(CameraPinholeBrown paramVisual, Point2Transform2_F32 visToDepth) {
    PointToPixelTransform_F32 visToDepth_pixel = new PointToPixelTransform_F32(visToDepth);
    sparse3D.configure(narrow(paramVisual), visToDepth_pixel);
    alg.setCamera(paramVisual);
    distance.setIntrinsic(0, paramVisual);
}
Also used : PointToPixelTransform_F32(boofcv.struct.distort.PointToPixelTransform_F32)

Aggregations

PointToPixelTransform_F32 (boofcv.struct.distort.PointToPixelTransform_F32)17 Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)8 Point2D_F32 (georegression.struct.point.Point2D_F32)7 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)5 BufferedImage (java.awt.image.BufferedImage)5 LensDistortionPinhole (boofcv.alg.distort.pinhole.LensDistortionPinhole)3 Planar (boofcv.struct.image.Planar)3 LensDistortionNarrowFOV (boofcv.alg.distort.LensDistortionNarrowFOV)2 NarrowToWidePtoP_F32 (boofcv.alg.distort.NarrowToWidePtoP_F32)2 ImagePanel (boofcv.gui.image.ImagePanel)2 FMatrixRMaj (org.ejml.data.FMatrixRMaj)2 ConfigDeformPointMLS (boofcv.abst.distort.ConfigDeformPointMLS)1 PointDeformKeyPoints (boofcv.abst.distort.PointDeformKeyPoints)1 LensDistortionWideFOV (boofcv.alg.distort.LensDistortionWideFOV)1 PointTransformHomography_F32 (boofcv.alg.distort.PointTransformHomography_F32)1 LensDistortionUniversalOmni (boofcv.alg.distort.universal.LensDistortionUniversalOmni)1 InterpolatePixelS (boofcv.alg.interpolate.InterpolatePixelS)1 ListDisplayPanel (boofcv.gui.ListDisplayPanel)1 CameraPinhole (boofcv.struct.calib.CameraPinhole)1 CameraUniversalOmni (boofcv.struct.calib.CameraUniversalOmni)1