[gdal-dev] NITF Chip

Baker, Anthony W Anthony.W.Baker at boeing.com
Mon Jun 10 13:43:52 PDT 2013


One possible answer seems to be to use ICHIP_OP_**_** and  ICHIP_FI_**_**

Using the _OP_ metadata I form a row-wise 2x2 projection matrix with _12 - _11 as one row and _21 - _11 as the other.  With _FI_ I form a column-wise 2x2 projection matrix with _12 - _11 and _21 - _11 as the columns.   Applying these matrices and the two translations in the right order seems to give ok results.  If I combine this transform with the geoTransform (matrix multi and trans) I seem to get ok results.  The results are different by a little from ArcMap's raster inclusion but close.  Code is included below to show the transforms that I have done.  Does this seem right?

double fi11r = strtod(poDataset->GetMetadataItem("ICHIP_FI_ROW_11", NULL), NULL);
double fi11c = strtod(poDataset->GetMetadataItem("ICHIP_FI_COL_11", NULL), NULL);
double fi12r = strtod(poDataset->GetMetadataItem("ICHIP_FI_ROW_12", NULL), NULL);
double fi12c = strtod(poDataset->GetMetadataItem("ICHIP_FI_COL_12", NULL), NULL);
double fi21r = strtod(poDataset->GetMetadataItem("ICHIP_FI_ROW_21", NULL), NULL);
double fi21c = strtod(poDataset->GetMetadataItem("ICHIP_FI_COL_21", NULL), NULL);
double op11r = strtod(poDataset->GetMetadataItem("ICHIP_OP_ROW_11", NULL), NULL);
double op11c = strtod(poDataset->GetMetadataItem("ICHIP_OP_COL_11", NULL), NULL);
double op12r = strtod(poDataset->GetMetadataItem("ICHIP_OP_ROW_12", NULL), NULL);
double op12c = strtod(poDataset->GetMetadataItem("ICHIP_OP_COL_12", NULL), NULL);
double op21r = strtod(poDataset->GetMetadataItem("ICHIP_OP_ROW_21", NULL), NULL);
double op21c = strtod(poDataset->GetMetadataItem("ICHIP_OP_COL_21", NULL), NULL);

//Column matrix
double pr11, pr12, pr22, pr21;
double npr1, npr2;
npr1 = sqrt((fi12c - fi11c)*(fi12c - fi11c) + (fi12r - fi11r)*(fi12r - fi11r));
npr2 = sqrt((fi21c - fi11c)*(fi21c - fi11c) + (fi21r - fi11r)*(fi21r - fi11r));
pr11 = (fi12c - fi11c)/npr1;
pr12 = (fi21c - fi11c)/npr2;
pr21 = (fi12r - fi11r)/npr1;
pr22 = (fi21r - fi11r)/npr2;

//Row matrix
double br11, br12, br22, br21;
double nbr1, nbr2;
nbr1 = sqrt((op12c - op11c)*(op12c - op11c) + (op12r - op11r)*(op12r - op11r));
nbr2 = sqrt((op21c - op11c)*(op21c - op11c) + (op21r - op11r)*(op21r - op11r));
br11 = (op12c - op11c)/nbr1;
br21 = (op21c - op11c)/nbr2;
br12 = (op12r - op11r)/nbr1;
br22 = (op21r - op11r)/nbr2;

//Transform
double m11, m12, m22, m21;
m11 = pr11*br11 + pr12*br21;
m21 = pr21*br11 + pr22*br21;
m12 = pr11*br12 + pr12*br22;
m22 = pr21*br12 + pr22*br22;

//Compute the translation factor
double a1, a2;
a1 = -(m11*op11c + m12*op11r) + fi11c;
a2 = -(m21*op11c + m22*op11r) + fi11r;

ST[0] = a1;
ST[3] = a2;
ST[1] = m11;
ST[2] = m12;
ST[4] = m21;
ST[5] = m22;



From: gdal-dev-bounces at lists.osgeo.org [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Baker, Anthony W
Sent: Monday, June 10, 2013 12:14 PM
To: gdal-dev at lists.osgeo.org
Subject: [gdal-dev] NITF Chip

I have a NITF file which I can read fine with GDAL.  The issue that it is a chip and using the transformation to determine geolocations fails (for example finding the chip's four corners).  Instead of placing a point based on the chip, it places it based on the whole image.  I can read the metadata and see that the RPC metadata contains the chip offset:
RPC Metadata:
  LINE_OFF=3276
  LINE_SCALE=3276
  SAMP_OFF=2538
  SAMP_SCALE=2538
  LONG_OFF=-106.8927
  LONG_SCALE=0.0542
  LAT_OFF=32.3084
  LAT_SCALE=0.0593
  HEIGHT_OFF=1229
  HEIGHT_SCALE=1214

I am tempted to use the LINE_OFF and SAMP_OFF to make the adjustments to properly get the boundary.  I believe this is only a partial solution (not generic enough) and will just give further problems as I get other NITF chips.  Would someone help me with the proper way of handling the chip transformation?

Thank you,

Anthony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130610/eb8a97eb/attachment.html>


More information about the gdal-dev mailing list