aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormutantturkey <mutantturke@gmail.com>2012-10-02 20:12:12 -0400
committermutantturkey <mutantturke@gmail.com>2012-10-02 20:12:12 -0400
commitc2eefdd85b4b093f29ab9e83ad76a6e62c388da1 (patch)
tree58ca71f64e8c3f3a881a32f018b1f8e6542e0b82
parentf9006166b69ffc0a70b2351bd942b17f0e72f1a9 (diff)
cleaning up FlyTrackingMain
-rw-r--r--fly-tools/FlyTrackingMain.cpp50
1 files changed, 18 insertions, 32 deletions
diff --git a/fly-tools/FlyTrackingMain.cpp b/fly-tools/FlyTrackingMain.cpp
index 7ae34f8..c68fe3c 100644
--- a/fly-tools/FlyTrackingMain.cpp
+++ b/fly-tools/FlyTrackingMain.cpp
@@ -38,10 +38,12 @@ vector<FrameInfo > fIForHeadVector;
// since for the first time the head is automatically need to be set
int startIndexToFindNewHead=0;
int endIndexToFindNewHead;
+
double initLargeLocationX=-1;
double initLargeLocationY=-1;
double initSmallLocationX=-1;
double initSmallLocationY=-1;
+
pair<double, double> largeCollisionBeforeDirection;
pair<double, double> smallCollisionBeforeDirection;
@@ -144,24 +146,21 @@ void writeHist(const char* filename, map<unsigned int, unsigned int> dataMap)
unsigned int first = front->first, last = back->first;
*output << "Min: " << first << " " << "Max: " << last << " " << "Count: " << last-first << endl;
- //vector<unsigned int> hist(last-first, 0);
vector<unsigned int> hist(last+1, 0);
-// *output << "hist size: " << hist.size() << endl;
- try{
- for(unsigned int j = 0; j<first; j++) {
+ try {
+ for (unsigned int j = 0; j<first; j++) {
hist[j] = 0;
}
- for (unsigned int j = first; j<=last; j++)
- {
+ for (unsigned int j = first; j<=last; j++) {
hist[j] = dataMap[j];
}
}
- catch (...)
- { cerr << "Bad histogram bucketing" << endl; }
+ catch (...) {
+ cerr << "Bad histogram bucketing" << endl;
+ }
- try
- {
+ try {
ofstream fout(filename);
for (unsigned int i = 0; i<hist.size(); i++) {
fout << hist[i] << endl;
@@ -169,8 +168,10 @@ void writeHist(const char* filename, map<unsigned int, unsigned int> dataMap)
fout << first << " " << last << " " << hist.size() << endl;
fout.close();
}
- catch (...)
- { cerr << "Bad memory loc for opening file" << endl; }
+ catch (...) {
+ cerr << "Bad memory loc for opening file" << endl;
+ }
+
}
void findObj(Image* img, int x, int y, vector<pair<int,int> > & shape ,bool eightCon=true, bool colorLookingFor=true);
@@ -735,7 +736,6 @@ int draw_line_bm(Image* maskImage, int x0, int y0, int x1, int y1) {
putPixel(maskImage,x, y);
if (isInFemaleBlob == true)
return 1;
-
}
break;
@@ -1001,32 +1001,24 @@ int sequenceCondition(FrameInfo prevFI,FrameInfo currentFI) {
void drawTheSequence(int startIndex, int endIndex, int isFirst, bool singleBlob, bool unprocessed) {
*output << "Should draw "<<isFirst<<endl;
- //ifstream inputFile;
- //inputFile.open(inputFileName.c_str());
- /*if (inputFile.fail() ) {
- *output << "cannot open the input file that contains name of the input images\n";
- exit(1);
- }*/
string fileName = fnVector[startIndex];
- //inputFile>>fileName;
- //inputFileName = "*output/identified/"+fileName;
FrameInfo prevFI = fIVector[startIndex];
- cout << "Extracting information for image "<< fnVector[startIndex] << endl;
+
+ *output << "Extracting information for image "<< fnVector[startIndex] << endl;
+
*output<<prevFI;
+
drawTheFlyObject(prevFI, fileName, isFirst, singleBlob, unprocessed);
+
for (int i=startIndex+1; i<=endIndex; i++) {
FrameInfo nextFI = fIVector[i];
cout << "Extracting information for image "<< fnVector[i] << endl;
- //FrameInfo na = &nextFI;
*output<<nextFI;
- //inputFile>>fileName;
fileName = fnVector[i];
- // inputFileName = "*output/identified/"+fileName;
drawTheFlyObject(nextFI, fileName, isFirst, singleBlob, unprocessed);
}
- //inputFile.close();
}
@@ -1253,12 +1245,6 @@ void velocityDirections(int stIndex, int endIndex) {
*output << "From index "<<stIndex<<" to "<<endIndex<<endl;
*output << "From "<<fnVector[stIndex]<<" to "<<fnVector[endIndex]<<endl;
- /*overAllVelocityF.first = 0;
- overAllVelocityF.second = 0;
- overAllVelocityS.first = 0;
- overAllVelocityS.second = 0;
- */
-
for (i=stIndex; i<endIndex; i=i++) {
pair<double, double > velDirectionF;