From 8a8178f992d421a20917cea7d25a718bf6154f6f Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Thu, 2 Aug 2012 18:51:30 -0400 Subject: fixed segfault when only using one image --- fly-tools/filter/main.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'fly-tools/filter') diff --git a/fly-tools/filter/main.cpp b/fly-tools/filter/main.cpp index 6cfc5aa..ec7899f 100644 --- a/fly-tools/filter/main.cpp +++ b/fly-tools/filter/main.cpp @@ -15,6 +15,7 @@ int main(int argc, char* argv[]) { int c; int drawNumber = 2; + double ratio; unsigned int result; @@ -49,7 +50,7 @@ int main(int argc, char* argv[]) { break; case 'h': cout << usage << endl; - exit(1); + exit(0); break; default: break; @@ -88,16 +89,11 @@ int main(int argc, char* argv[]) { } // if the ratio of the of the two blobs is smaller than the input ratio. - if( ((double)blobList[blobList.size()-2].second->area / (double)blobList[blobList.size()-1].second->area) < (1/ratio) ) { + if( ((double)blobList[blobList.size()-drawNumber].second->area / (double)blobList[blobList.size()-1].second->area) < (1/ratio) ) { cout << "the second largest blob is smaller than the ratio. only drawing largest blob!" << endl; drawNumber = 1; } - cout << "blob area 1: " << (double)blobList[blobList.size()-2].second->area << endl; - cout << "blob area 2: " << (double)blobList[blobList.size()-1].second->area << endl; - cout << "blobs ratio:" << ((double)blobList[blobList.size()-2].second->area / (double)blobList[blobList.size()-1].second->area)<< endl; - cout << "input ratio:" << (1/ratio ) << endl; - for (int i=blobList.size()-drawNumber; i " << (*blobList[i].second) << endl; -- cgit v1.2.3