Search in sources :

Example 11 with PointToPixelTransform_F32

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

the class ImplRectifyImageOps_F32 method fullViewLeft.

public static void fullViewLeft(CameraPinholeRadial paramLeft, FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight, FMatrixRMaj rectifyK) {
    // need to take in account the order in which image distort will remove rectification later on
    paramLeft = new CameraPinholeRadial(paramLeft);
    Point2Transform2_F32 tranLeft = transformPixelToRect(paramLeft, rectifyLeft);
    RectangleLength2D_F32 bound = DistortImageOps.boundBox_F32(paramLeft.width, paramLeft.height, new PointToPixelTransform_F32(tranLeft));
    float scaleX = paramLeft.width / bound.width;
    float scaleY = paramLeft.height / bound.height;
    float scale = (float) Math.min(scaleX, scaleY);
    adjustCalibrated(rectifyLeft, rectifyRight, rectifyK, bound, scale);
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) PointToPixelTransform_F32(boofcv.alg.distort.PointToPixelTransform_F32) RectangleLength2D_F32(georegression.struct.shapes.RectangleLength2D_F32) SequencePoint2Transform2_F32(boofcv.struct.distort.SequencePoint2Transform2_F32) Point2Transform2_F32(boofcv.struct.distort.Point2Transform2_F32)

Example 12 with PointToPixelTransform_F32

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

the class ImplRectifyImageOps_F32 method fullViewLeft.

public static void fullViewLeft(int imageWidth, int imageHeight, FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight) {
    Point2Transform2_F32 tranLeft = new PointTransformHomography_F32(rectifyLeft);
    RectangleLength2D_F32 bound = DistortImageOps.boundBox_F32(imageWidth, imageHeight, new PointToPixelTransform_F32(tranLeft));
    float scaleX = imageWidth / bound.width;
    float scaleY = imageHeight / bound.height;
    float scale = (float) Math.min(scaleX, scaleY);
    adjustUncalibrated(rectifyLeft, rectifyRight, bound, scale);
}
Also used : PointTransformHomography_F32(boofcv.alg.distort.PointTransformHomography_F32) PointToPixelTransform_F32(boofcv.alg.distort.PointToPixelTransform_F32) RectangleLength2D_F32(georegression.struct.shapes.RectangleLength2D_F32) SequencePoint2Transform2_F32(boofcv.struct.distort.SequencePoint2Transform2_F32) Point2Transform2_F32(boofcv.struct.distort.Point2Transform2_F32)

Example 13 with PointToPixelTransform_F32

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

the class RectifyImageOps method rectifyImage.

/**
 * 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;
}
Also used : PointToPixelTransform_F32(boofcv.alg.distort.PointToPixelTransform_F32) Point2Transform2_F32(boofcv.struct.distort.Point2Transform2_F32)

Example 14 with PointToPixelTransform_F32

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

the class VisOdomPixelDepthPnP_to_DepthVisualOdometry method setCalibration.

@Override
public void setCalibration(CameraPinholeRadial paramVisual, Point2Transform2_F32 visToDepth) {
    PointToPixelTransform_F32 visToDepth_pixel = new PointToPixelTransform_F32(visToDepth);
    sparse3D.configure(LensDistortionOps.narrow(paramVisual), visToDepth_pixel);
    Point2Transform2_F64 leftPixelToNorm = narrow(paramVisual).undistort_F64(true, false);
    Point2Transform2_F64 leftNormToPixel = narrow(paramVisual).distort_F64(false, true);
    alg.setPixelToNorm(leftPixelToNorm);
    alg.setNormToPixel(leftNormToPixel);
    distance.setIntrinsic(paramVisual.fx, paramVisual.fy, paramVisual.skew);
}
Also used : PointToPixelTransform_F32(boofcv.alg.distort.PointToPixelTransform_F32) Point2Transform2_F64(boofcv.struct.distort.Point2Transform2_F64)

Aggregations

PointToPixelTransform_F32 (boofcv.alg.distort.PointToPixelTransform_F32)14 Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)5 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)4 RectangleLength2D_F32 (georegression.struct.shapes.RectangleLength2D_F32)4 BufferedImage (java.awt.image.BufferedImage)4 PointTransformHomography_F32 (boofcv.alg.distort.PointTransformHomography_F32)3 SequencePoint2Transform2_F32 (boofcv.struct.distort.SequencePoint2Transform2_F32)3 GrayF32 (boofcv.struct.image.GrayF32)3 Point2D_F32 (georegression.struct.point.Point2D_F32)3 PixelTransformCached_F32 (boofcv.alg.distort.PixelTransformCached_F32)2 ImagePanel (boofcv.gui.image.ImagePanel)2 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)2 Point2Transform3_F32 (boofcv.struct.distort.Point2Transform3_F32)2 Point3Transform2_F32 (boofcv.struct.distort.Point3Transform2_F32)2 Point3D_F32 (georegression.struct.point.Point3D_F32)2 ConfigDeformPointMLS (boofcv.abst.distort.ConfigDeformPointMLS)1 PointDeformKeyPoints (boofcv.abst.distort.PointDeformKeyPoints)1 LensDistortionPinhole (boofcv.alg.distort.pinhole.LensDistortionPinhole)1 PixelTransform2_F32 (boofcv.struct.distort.PixelTransform2_F32)1 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)1