Version: (using KDE KDE 3.5.6) Installed from: Mandriva RPMs OS: Linux when trying to see the result of a gpssync on a map, I found that points that had been correlated were wrong. I found out that the code taking care of the correlation was: point1 + (point2-point1) * (time2-time1)/(timeCor-time1) (where point can be lat,long or alt) but it should be: point1 + (point2-point1) * (timeCor-time1)/(time2-time1) for example, if you have 2 gps points - at time1 0 : altitude 0 - at time2 3mn : altitude 30meters - a picture taken at timeCor 2mn. if you take the first formula, you correlate the altitude of the picture at: 0 + (30-0) * (3-0)/(2-0) that give = 45meters which is obviously wrong but if you calculate this using the second formula you obtain: 0 + (30-0) * (2-0)/(3-0) that give = 20meters which is correct you can test the following patch that correct formula and rename the t3 variable to tCor to avoid confusion (which occur each time I reread the formula where t3 is after t1 but before t2)
Created attachment 20121 [details] interpolation fix in gpssync patch for fix the interrpolation formula and rename variable t3 to tCor for more readability
Gerhard, Like you have a GPS device, can you confirm this bug ? If yes, can you test the patch and apply it on svn ? Thanks in advance Gilles
SVN commit 648020 by gkulzer: correcting interpolation CCMAIL:caulier.gilles@gmail.com, shadow.walker@free.fr BUG:143594 M +5 -5 gpsdataparser.cpp --- trunk/extragear/libs/kipi-plugins/gpssync/gpsdataparser.cpp #648019:648020 @@ -113,13 +113,13 @@ double lon2 = nextGPSPoint.longitude(); double lat2 = nextGPSPoint.latitude(); uint t2 = nextDateTime.toTime_t(); - uint t3 = cameraGMTDateTime.toTime_t(); + uint tCor = cameraGMTDateTime.toTime_t(); - if (t3-t1 != 0) + if (tCor-t1 != 0) { - gpsData.setAltitude(alt1 + (alt2-alt1) * (t2-t1)/(t3-t1)); - gpsData.setLatitude(lat1 + (lat2-lat1) * (t2-t1)/(t3-t1)); - gpsData.setLongitude(lon1 + (lon2-lon1) * (t2-t1)/(t3-t1)); + gpsData.setAltitude(alt1 + (alt2-alt1) * (tCor-t1)/(t2-t1)); + gpsData.setLatitude(lat1 + (lat2-lat1) * (tCor-t1)/(t2-t1)); + gpsData.setLongitude(lon1 + (lon2-lon1) * (tCor-t1)/(t2-t1)); gpsData.setInterpolated(true); return true; }