use of boofcv.struct.distort.Point2Transform2_F64 in project BoofCV by lessthanoptimal.
the class ExampleStereoTwoViewsOneCamera method convertToNormalizedCoordinates.
/**
* Convert a set of associated point features from pixel coordinates into normalized image coordinates.
*/
public static List<AssociatedPair> convertToNormalizedCoordinates(List<AssociatedPair> matchedFeatures, CameraPinholeRadial intrinsic) {
Point2Transform2_F64 p_to_n = LensDistortionOps.narrow(intrinsic).undistort_F64(true, false);
List<AssociatedPair> calibratedFeatures = new ArrayList<>();
for (AssociatedPair p : matchedFeatures) {
AssociatedPair c = new AssociatedPair();
p_to_n.compute(p.p1.x, p.p1.y, c.p1);
p_to_n.compute(p.p2.x, p.p2.y, c.p2);
calibratedFeatures.add(c);
}
return calibratedFeatures;
}
use of boofcv.struct.distort.Point2Transform2_F64 in project BoofCV by lessthanoptimal.
the class ImplRectifyImageOps_F64 method transformPixelToRect.
public static Point2Transform2_F64 transformPixelToRect(CameraPinholeRadial param, DMatrixRMaj rectify) {
Point2Transform2_F64 remove_p_to_p = narrow(param).undistort_F64(true, true);
PointTransformHomography_F64 rectifyDistort = new PointTransformHomography_F64(rectify);
return new SequencePoint2Transform2_F64(remove_p_to_p, rectifyDistort);
}
use of boofcv.struct.distort.Point2Transform2_F64 in project narchy by automenta.
the class ExampleStereoTwoViewsOneCamera method drawInliers.
/**
* Draw inliers for debugging purposes. Need to convert from normalized to pixel coordinates.
*/
public void drawInliers(CameraPinholeRadial intrinsic, List<AssociatedPair> normalized) {
Point2Transform2_F64 n_to_p = LensDistortionOps.narrow(intrinsic).distort_F64(false, true);
List<AssociatedPair> pixels = new ArrayList<>(normalized.size());
for (AssociatedPair n : normalized) {
AssociatedPair p = new AssociatedPair();
n_to_p.compute(n.p1.x, n.p1.y, p.p1);
n_to_p.compute(n.p2.x, n.p2.y, p.p2);
pixels.add(p);
}
// display the results
assocPanel.setAssociation(pixels);
assocPanel.setImages(ConvertBufferedImage.extractBuffered(distortedPrev), ConvertBufferedImage.extractBuffered(distortedNext));
assocPanel.repaint();
assocPanel.setSize(500, 100);
}
use of boofcv.struct.distort.Point2Transform2_F64 in project BoofCV by lessthanoptimal.
the class CameraToEquirectangular_F64 method setCameraModel.
public void setCameraModel(CameraPinholeBrown camera) {
Point2Transform2_F64 pixelToNormalized = new LensDistortionBrown(camera).undistort_F64(true, false);
setCameraModel(camera.width, camera.height, pixelToNormalized);
}
use of boofcv.struct.distort.Point2Transform2_F64 in project BoofCV by lessthanoptimal.
the class QrCodeDetectorPnP method setLensDistortion.
@Override
public void setLensDistortion(@Nullable LensDistortionNarrowFOV distortion, int width, int height) {
super.setLensDistortion(distortion, width, height);
if (distortion == null) {
poseUtils.setLensDistortion(null, null);
// Yes this shouldn't be hard coded to that type. It feels dirty adding lens distortion to the
// generic QR Code detector... deal with this later if there is more than one detector
((QrCodePreciseDetector) detector).setLensDistortion(width, height, null);
} else {
Point2D_F64 test = new Point2D_F64();
Point2Transform2_F64 undistToDist = distortion.distort_F64(true, true);
undistToDist.compute(0, 0, test);
poseUtils.setLensDistortion(distortion.undistort_F64(true, false), undistToDist);
// If there's no actual distortion don't undistort the image while processing. Faster this way
if (test.norm() <= UtilEjml.TEST_F32) {
((QrCodePreciseDetector) detector).setLensDistortion(width, height, null);
} else {
((QrCodePreciseDetector) detector).setLensDistortion(width, height, distortion);
}
}
}
Aggregations