Skip to content
Permalink
Browse files
Fix calculation of mean error in georeferencer
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13515 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 17, 2010
1 parent bb8f954 commit faffd8b7c18892898211162a1e9f46472a72e967
Showing with 13 additions and 8 deletions.
  1. +13 −8 src/plugins/georeferencer/qgsgeorefplugingui.cpp
@@ -1245,32 +1245,37 @@ bool QgsGeorefPluginGui::writePDFReportFile( const QString& fileName, const QgsG
parameterLabel->setSceneRect( QRectF( 2, composerMap->rect().bottom() + composerMap->transform().dy() + 5, composition->paperWidth(), 8 ) );
parameterLabel->setFrame( false );

int nPointsEnabled = 0;
QgsGCPList::const_iterator gcpIt = mPoints.constBegin();
for ( ; gcpIt != mPoints.constEnd(); ++gcpIt )
{
if (( *gcpIt )->isEnabled() )
{
++nPointsEnabled;
}
}

//calculate mean error (in map units)
double meanError = 0;
if ( mPoints.size() > 4 )
if ( nPointsEnabled > 2 )
{
double sumVxSquare = 0;
double sumVySquare = 0;
double resXMap, resYMap;

int nPointsEnabled = 0;
QgsGCPList::const_iterator gcpIt = mPoints.constBegin();
for ( ; gcpIt != mPoints.constEnd(); ++gcpIt )
{
if (( *gcpIt )->isEnabled() )
{
resXMap = ( *gcpIt )->residual().x() * wldScaleX;
resYMap = ( *gcpIt )->residual().x() * wldScaleY;
resYMap = ( *gcpIt )->residual().y() * wldScaleY;
sumVxSquare += ( resXMap * resXMap );
sumVySquare += ( resYMap * resYMap );
++nPointsEnabled;
}
}

if ( nPointsEnabled > 4 )
{
meanError = sqrt(( sumVxSquare + sumVySquare ) / ( 2 * nPointsEnabled - 4 ) ) * sqrt( 2.0 );
}
meanError = sqrt(( sumVxSquare + sumVySquare ) / ( 2 * nPointsEnabled - 4 ) ) * sqrt( 2.0 );
}


0 comments on commit faffd8b

Please sign in to comment.