下面就是我用的代码 针对图片没有问题,但在用TIFF格式的时候配准完就变成全黑的了。哪位大侠,斑竹帮帮忙。 刚接触ArcGIS不长时间,有些原理的东西不是很了解,头疼阿 -_-!!!
string originalFilePath = Application.StartupPath + @"\DMTTemplate\a.jpg";
string strOutFile = Application.StartupPath + @"\DMTTemplate\cc.jpg";
//string originalFilePath = Application.StartupPath + @"\DMTTemplate\b.tif";
//string strOutFile = Application.StartupPath + @"\DMTTemplate\cc.tif";
// pixel coords
IPointCollection pSourcePoints = new MultipointClass();
object missing = Type.Missing;
pSourcePoints.AddPoint(MakePoint(0.135, 0), ref missing, ref missing);
pSourcePoints.AddPoint(MakePoint(1023.496, 0), ref missing, ref missing);
pSourcePoints.AddPoint(MakePoint(1023.496, -767.493), ref missing, ref missing);
pSourcePoints.AddPoint(MakePoint(-0.48, -767.493), ref missing, ref missing);
//pSourcePoints.AddPoint(MakePoint(0.135, 0), ref missing, ref missing);
//pSourcePoints.AddPoint(MakePoint(1423.496, 0), ref missing, ref missing);
//pSourcePoints.AddPoint(MakePoint(1423.496, -664.493), ref missing, ref missing);
//pSourcePoints.AddPoint(MakePoint(-0.48, -664.493), ref missing, ref missing);
//decimal degrees
IPointCollection pTargetPoints = new MultipointClass();
pTargetPoints.AddPoint(MakePoint(126959.107, 145736.885), ref missing, ref missing);
pTargetPoints.AddPoint(MakePoint(127106.006, 146251.031), ref missing, ref missing);
pTargetPoints.AddPoint(MakePoint(127674.015, 146662.348), ref missing, ref missing);
pTargetPoints.AddPoint(MakePoint(127987.4, 145506.744), ref missing, ref missing);
IRasterDataset pInRasterDataset = GetRasterDataset(originalFilePath);
IRaster pRaster = GetRaster(pInRasterDataset);
IRasterGeometryProc pRasterGProc = new RasterGeometryProcClass();
//pRasterGProc.TwoPointsAdjust(pSourcePoints, pTargetPoints, pRaster);
pRasterGProc.Warp(pSourcePoints, pTargetPoints, esriGeoTransTypeEnum.esriGeoTransPolyOrder1, pRaster);
//pRasterGProc.Rectify(strOutFile, "TIFF", pRaster);
pRasterGProc.Rectify(strOutFile, "JPG", pRaster);
AddImageLayer(strOutFile);
好像gis是c++搞的(我们公司是这样的),不懂,帮顶!