use of boofcv.alg.distort.pinhole.PinholePtoN_F32 in project BoofCV by lessthanoptimal.
the class PinholeToEquirectangular_F32 method setPinhole.
/**
* Specifies the pinhole camera
* @param pinhole intrinsic parameters of pinhole camera
*/
public void setPinhole(CameraPinhole pinhole) {
this.pinhole = pinhole;
declareVectors(pinhole.width, pinhole.height);
// computing the 3D ray through each pixel in the pinhole camera at it's canonical
// location
PinholePtoN_F32 pixelToNormalized = new PinholePtoN_F32();
pixelToNormalized.set(pinhole.fx, pinhole.fy, pinhole.skew, pinhole.cx, pinhole.cy);
Point2D_F32 norm = new Point2D_F32();
for (int pixelY = 0; pixelY < pinhole.height; pixelY++) {
for (int pixelX = 0; pixelX < pinhole.width; pixelX++) {
pixelToNormalized.compute(pixelX, pixelY, norm);
Point3D_F32 v = vectors[pixelY * pinhole.width + pixelX];
v.set(norm.x, norm.y, 1);
}
}
}
use of boofcv.alg.distort.pinhole.PinholePtoN_F32 in project BoofCV by lessthanoptimal.
the class ImplPerspectiveOps_F32 method convertPixelToNorm.
public static Point2D_F32 convertPixelToNorm(FMatrixRMaj K, Point2D_F32 pixel, Point2D_F32 norm) {
if (norm == null)
norm = new Point2D_F32();
PinholePtoN_F32 alg = new PinholePtoN_F32();
alg.set(K.get(0, 0), K.get(1, 1), K.get(0, 1), K.get(0, 2), K.get(1, 2));
alg.compute(pixel.x, pixel.y, norm);
return norm;
}
use of boofcv.alg.distort.pinhole.PinholePtoN_F32 in project BoofCV by lessthanoptimal.
the class ImplRectifyImageOps_F32 method transformPixelToRectNorm.
public static Point2Transform2_F32 transformPixelToRectNorm(CameraPinholeRadial param, FMatrixRMaj rectify, FMatrixRMaj rectifyK) {
if (rectifyK.get(0, 1) != 0)
throw new IllegalArgumentException("Skew should be zero in rectified images");
Point2Transform2_F32 remove_p_to_p = narrow(param).undistort_F32(true, true);
PointTransformHomography_F32 rectifyDistort = new PointTransformHomography_F32(rectify);
PinholePtoN_F32 pixelToNorm = new PinholePtoN_F32();
pixelToNorm.set(rectifyK.get(0, 0), rectifyK.get(1, 1), rectifyK.get(0, 1), rectifyK.get(0, 2), rectifyK.get(1, 2));
return new SequencePoint2Transform2_F32(remove_p_to_p, rectifyDistort, pixelToNorm);
}
Aggregations