Fixed some coverity issues

This commit is contained in:
heckflosse
2017-06-12 17:54:34 +02:00
parent e8bbefef7a
commit 97e558a040
21 changed files with 97 additions and 96 deletions

View File

@@ -102,6 +102,9 @@ int calcDistortion(unsigned char* img1, unsigned char* img2, int ncols, int nrow
if (n < 5) {
printf ("Not sufficient features.\n");
distortion = 0.0;
KLTFreeFeatureTable(ft);
KLTFreeFeatureList(fl);
KLTFreeTrackingContext(tc);
return -1;
}
@@ -154,6 +157,9 @@ int calcDistortion(unsigned char* img1, unsigned char* img2, int ncols, int nrow
if (new_n < 5) {
printf ("Not sufficient features.\n");
distortion = 0.0;
KLTFreeFeatureTable(ft);
KLTFreeFeatureList(fl);
KLTFreeTrackingContext(tc);
return -1;
}
@@ -252,17 +258,27 @@ int calcDistortion(unsigned char* img1, unsigned char* img2, int ncols, int nrow
if (total_delta / new_n > DELTA_2) {
printf ("Deviation is too big.\n");
distortion = 0.0;
KLTFreeFeatureTable(ft);
KLTFreeFeatureList(fl);
KLTFreeTrackingContext(tc);
return -2;
}
if (rxy < RXY_LIMIT) {
printf ("Not linear enough\n");
distortion = 0.0;
KLTFreeFeatureTable(ft);
KLTFreeFeatureList(fl);
KLTFreeTrackingContext(tc);
return -3;
}
printf ("distortion amount=%lf scale=%lf deviation=%lf, rxy=%lf\n", a, b, total_delta / n, rxy);
distortion = a;
KLTFreeFeatureTable(ft);
KLTFreeFeatureList(fl);
KLTFreeTrackingContext(tc);
return 1;
}