diff options
author | mutantturkey <mutantturke@gmail.com> | 2012-08-02 18:51:30 -0400 |
---|---|---|
committer | mutantturkey <mutantturke@gmail.com> | 2012-08-02 18:51:30 -0400 |
commit | 8a8178f992d421a20917cea7d25a718bf6154f6f (patch) | |
tree | 9374b05a1be962314efc9b06b4803591fb58ff0c | |
parent | d0e43aba2d491ba0b28a29c59205e611debfa2e2 (diff) |
fixed segfault when only using one image
-rw-r--r-- | fly-tools/filter/main.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
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.size(); i++) { largeBlobs.insert( CvLabelBlob(blobList[i].first, blobList[i].second) ); cout << "Blob #" << blobList[i].first << " -> " << (*blobList[i].second) << endl; |