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);
}
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);
}
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;
}
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);
}
Aggregations