我正在申请使用库BoofCV修正鱼眼图像。我找到了example但我不知道如何在校正之后显示所有校正图像,如this.
static public BufferedImage calibrationCircular(BufferedImage image, CameraUniversalOmni fisheyeModel) {
logger.info("Called function calibrationCircular()");
// Specify what the pinhole camera should look like
CameraPinhole pinholeModel = new CameraPinhole(400,400,0,300,300,600,600);
// Create the transform from pinhole to fisheye views
LensDistortionNarrowFOV pinholeDistort = new LensDistortionPinhole(pinholeModel);
LensDistortionWideFOV fisheyeDistort = new LensDistortionUniversalOmni(fisheyeModel);
NarrowToWidePtoP_F32 transform = new NarrowToWidePtoP_F32(pinholeDistort,fisheyeDistort);
// Load fisheye RGB image
Planar<GrayU8> fisheyeImage = ConvertBufferedImage.convertFrom(
image, true, ImageType.pl(3,GrayU8.class));
// Create the image distorter which will render the image
InterpolatePixel<Planar<GrayU8>> interp = FactoryInterpolation.
createPixel(0, 255, InterpolationType.BILINEAR, BorderType.ZERO, fisheyeImage.getImageType());
ImageDistort<Planar<GrayU8>,Planar<GrayU8>> distorter =
FactoryDistort.distort(false,interp,fisheyeImage.getImageType());
// Pass in the transform created above
distorter.setModel(new PointToPixelTransform_F32(transform));
// Render the image. The camera will have a rotation of 0 and will thus be looking straight forward
Planar<GrayU8> pinholeImage = fisheyeImage.createNew(pinholeModel.width, pinholeModel.height);
distorter.apply(fisheyeImage,pinholeImage);
BufferedImage bufferedPinhole0 = ConvertBufferedImage.convertTo(pinholeImage,null,true);
distorter.apply(fisheyeImage,pinholeImage);
BufferedImage bufferedPinhole1 = ConvertBufferedImage.convertTo(pinholeImage,null,true);
return ConvertBufferedImage.convertTo(pinholeImage, null, true);
}