Skip to content

Commit dc4e766

Browse files
author
mhugent
committedMay 17, 2010
Fix calculation of mean error in georeferencer
git-svn-id: http://svn.osgeo.org/qgis/trunk@13515 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent e49a012 commit dc4e766

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed
 

‎src/plugins/georeferencer/qgsgeorefplugingui.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,32 +1245,37 @@ bool QgsGeorefPluginGui::writePDFReportFile( const QString& fileName, const QgsG
12451245
parameterLabel->setSceneRect( QRectF( 2, composerMap->rect().bottom() + composerMap->transform().dy() + 5, composition->paperWidth(), 8 ) );
12461246
parameterLabel->setFrame( false );
12471247

1248+
int nPointsEnabled = 0;
1249+
QgsGCPList::const_iterator gcpIt = mPoints.constBegin();
1250+
for ( ; gcpIt != mPoints.constEnd(); ++gcpIt )
1251+
{
1252+
if (( *gcpIt )->isEnabled() )
1253+
{
1254+
++nPointsEnabled;
1255+
}
1256+
}
1257+
12481258
//calculate mean error (in map units)
12491259
double meanError = 0;
1250-
if ( mPoints.size() > 4 )
1260+
if ( nPointsEnabled > 2 )
12511261
{
12521262
double sumVxSquare = 0;
12531263
double sumVySquare = 0;
12541264
double resXMap, resYMap;
12551265

1256-
int nPointsEnabled = 0;
12571266
QgsGCPList::const_iterator gcpIt = mPoints.constBegin();
12581267
for ( ; gcpIt != mPoints.constEnd(); ++gcpIt )
12591268
{
12601269
if (( *gcpIt )->isEnabled() )
12611270
{
12621271
resXMap = ( *gcpIt )->residual().x() * wldScaleX;
1263-
resYMap = ( *gcpIt )->residual().x() * wldScaleY;
1272+
resYMap = ( *gcpIt )->residual().y() * wldScaleY;
12641273
sumVxSquare += ( resXMap * resXMap );
12651274
sumVySquare += ( resYMap * resYMap );
1266-
++nPointsEnabled;
12671275
}
12681276
}
12691277

1270-
if ( nPointsEnabled > 4 )
1271-
{
1272-
meanError = sqrt(( sumVxSquare + sumVySquare ) / ( 2 * nPointsEnabled - 4 ) ) * sqrt( 2.0 );
1273-
}
1278+
meanError = sqrt(( sumVxSquare + sumVySquare ) / ( 2 * nPointsEnabled - 4 ) ) * sqrt( 2.0 );
12741279
}
12751280

12761281

0 commit comments

Comments
 (0)
Please sign in to comment.