===== RP → Register =====
Image registration is establishment of correspondence
between images of the same scene. Many
image processing applications like remote sensing for
change detection, estimation of wind speed
and direction for weather forecasting, fusion of medical images need
image registration. Image registration is a process
of aligning two images acquired by
same/different sensors, at different times or from
different viewpoint. To register images, we need
to determine geometric transformation that aligns images with respect to the reference image.
The most common transformations are rigid (RST), affine, and perspective.
The parameters of the geometric transformation are calculated based on a given set of tie-points.
The tie-points can be obtained manually or automatically as follows:
==== Manual method ====
This is the case where the algorithm will generate the registered image based on manually selected tie-points .
== Example of use ==
// Openning a input RGB image
...
...
te::rst::Raster inputRaster;
...
...
// Creating the algorithm parameters
te::rp::Register::InputParameters algoInputParams;
algoInputParams.m_inputRasterPtr = &inputRaster;
algoInputParams.m_inputRasterBands.push_back( 0 );
algoInputParams.m_inputRasterBands.push_back( 1 );
algoInputParams.m_inputRasterBands.push_back( 2 );
// Defining the tie-points
te::gm::GTParameters::TiePoint tiePoint1;
tiePoint1.first.x = 0;
tiePoint1.first.y = 0;
tiePoint1.second.x = 249584;
tiePoint1.second.y = -94249584;
algoInputParams.m_tiePoints.push_back( tiePoint1 );
te::gm::GTParameters::TiePoint tiePoint2;
tiePoint2.first.x = 35;
tiePoint2.first.y = 43;
tiePoint2.second.x = 8577463;
tiePoint2.second.y = -8587874;
algoInputParams.m_tiePoints.push_back( tiePoint2 );
// For this case, the output raster can be generated with the same spatial reference system used by the input raster
algoInputParams.m_outputSRID = inputRaster.getSRID();
// For this case, the output raster can be generated with the same spatial resolution used by the input raster
algoInputParams.m_outputResolutionX = inputRaster.getResolutionX();
algoInputParams.m_outputResolutionY = inputRaster.getResolutionY();
algoInputParams.m_geomTransfName = "RST";
te::rp::Register::OutputParameters algoOutputParams;
algoOutputParams.m_rInfo["URI"] = "Registered.tif";
algoOutputParams.m_rType = "GDAL";
// Executing the algorithm
te::rp::Register algorithmInstance;
algorithmInstance.initialize( algoInputParams );
algorithmInstance.execute( algoOutputParams );
==== Automatic method ====
This is the case where tie-points are automatically generated by other algorithm ( te::rp::TiePointsLocator ) comparing the input image with another reference image. The generated tie-points are later used by the register algorithm to generate the registered image.
== Example of use ==
// Openning 2 input RGB images
te::rst::Raster adjustRaster;
...
te::rst::Raster referenceRaster;
...
// Creating the tie-points locator algorithm parameters
te::rp::TiePointsLocator::InputParameters locatorAlgoInputParams;
locatorAlgoInputParams.m_interesPointsLocationStrategy =
te::rp::TiePointsLocator::InputParameters::SurfStrategyT;
locatorAlgoInputParams.m_inRaster1Ptr = &adjustRaster;
locatorAlgoInputParams.m_inRaster1Bands.push_back( 0 );
locatorAlgoInputParams.m_inRaster2Ptr = &referenceRaster;
locatorAlgoInputParams.m_inRaster2Bands.push_back( 0 );
te::rp::TiePointsLocator::OutputParameters locatorAlgoOutputParams;
// Executing the tie points locator algorithm
te::rp::TiePointsLocator locatorAlgorithmInstance;
locatorAgorithmInstance.initialize( locatorAlgoInputParams ) );
locatorAlgorithmInstance.execute( locatorAlgoOutputParams ) );
// Creating the register algorithm parameters
te::rp::Register::InputParameters registerAlgoInputParams;
registerAlgoInputParams.m_inputRasterPtr = &adjustRaster;
registerAlgoInputParams.m_inputRasterBands.push_back( 0 );
registerAlgoInputParams.m_inputRasterBands.push_back( 1 );
registerAlgoInputParams.m_inputRasterBands.push_back( 2 );
// Generating the register input tie-points
for( unsigned int tiePointIndex = 0 ; tiePointIndex < locatorAlgoOutputParams.m_transformationPtr->getParameters().m_tiePoints.size() ; ++tiePointIndex )
{
te::gm::GTParameters::TiePoint locatorTiePoint = locatorAlgoOutputParams.m_transformationPtr->getParameters().m_tiePoints[ tiePointIndex ];
te::gm::GTParameters::TiePoint registerTiePoint;
registerTiePoint.first.x = locatorTiePoint.first.x;
registerTiePoint.first.y = locatorTiePoint.first.y;
// Converting the reference raster line/column coodinates to reference raster SRS coordinates
referenceRaster.getGrid()->gridToGeo( locatorTiePoint.second.x, locatorTiePoint.second.y, registerTiePoint.second.x, registerTiePoint.second.y );
registerAlgoInputParams.m_tiePoints.push_back( registerTiePoint );
}
// For this case, the output raster can be generated with the same spatial reference system used by the reference raster
registerAlgoInputParams.m_outputSRID = referenceRaster.getSRID();
// For this case, the output raster can be generated with the same spatial resolution used by the reference raster
registerAlgoInputParams.m_outputResolutionX = referenceRaster.getResolutionX();
registerAlgoInputParams.m_outputResolutionY = referenceRaster.getResolutionY();
registerAlgoInputParams.m_geomTransfName = "Affine";
te::rp::Register::OutputParameters registerAlgoOutputParams;
registerAlgoOutputParams.m_rInfo["URI"] = "Registered.tif";
registerAlgoOutputParams.m_rType = "GDAL";
// Executing the algorithm
te::rp::Register registerAlgorithmInstance;
registerAlgorithmInstance.initialize( registerAlgoInputParams );
registerAlgorithmInstance.execute( registerAlgoOutputParams );
==== References ====
Manjusha Deshmukh, A SURVEY OF IMAGE REGISTRATION