Skip to content

Commit

Permalink
Fix calculation of mean error in georeferencer
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@13515 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 17, 2010
1 parent e49a012 commit dc4e766
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/plugins/georeferencer/qgsgeorefplugingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}


Expand Down

0 comments on commit dc4e766

Please sign in to comment.