我正在尝试使用 JAI 创建由 4 个 TIF 图像组成的单个马赛克,每个图像都是 5000 x 5000。我编写的代码如下..
RenderedOp mosaic=null;
ParameterBlock pbMosaic=new ParameterBlock();
pbMosaic.add(MosaicDescriptor.MOSAIC_TYPE_OVERLAY);
RenderedOp in=null;
// Get 4 tiles and add them to the Mosaic
in=returnRenderedOp(path,"northwest.tif");
pbMosaic.addSource(in);
in=returnRenderedOp(path,"northeast.tif");
pbMosaic.addSource(in);
in=returnRenderedOp(path,"southwest.tif");
pbMosaic.addSource(in);
in=returnRenderedOp(path,"southeast.tif");
pbMosaic.addSource(in);
// Setup the ImageLayout
ImageLayout imageLayout=new ImageLayout(0,0,10000,10000);
imageLayout.setTileWidth(5000);
imageLayout.setTileHeight(5000);
imageLayout.setColorModel(in.getColorModel());
imageLayout.setSampleModel(in.getSampleModel());
mosaic=JAI.create("mosaic",pbMosaic,new RenderingHints(JAI.KEY_IMAGE_LAYOUT,imageLayout));
问题是所有 4 个图像都位于马赛克左上角的同一位置,因此其他四分之三是空的。谁能告诉我如何选择构成马赛克的每张图片的位置,以便每张图片都出现在正确的位置?
谢谢
伊恩