Finish optimizing resize calls
authorAlyssa Rosenzweig <bobbybee@users.noreply.github.com>
Sun, 28 Jun 2015 20:47:16 +0000 (16:47 -0400)
committerAlyssa Rosenzweig <bobbybee@users.noreply.github.com>
Sun, 28 Jun 2015 20:47:16 +0000 (16:47 -0400)
Makefile
src/CommodityTracking.cpp
src/CommodityTracking.h

index 219449e..e4c8d52 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,10 +14,10 @@ ifeq ($(shell uname),Linux)
 endif
 
 all:
-       g++ -o CommodityTracking.o -c -fPIC src/CommodityTracking.cpp -O3 --std=c++11 -pg
+       g++ -o CommodityTracking.o -c -fPIC src/CommodityTracking.cpp -O3 --std=c++11
 
        $(LIBRARY_CLEAN)
        $(LIBRARY_BUILD_ARGS)
 
-       g++ -o bin/demo examples/demo.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -I./src $(LINKLIB) -O3 -pg
-       g++ -o bin/segmentation examples/segmentation.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -I./src $(LINKLIB) -O3 -pg
+       g++ -o bin/demo examples/demo.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -I./src $(LINKLIB) -O3
+       g++ -o bin/segmentation examples/segmentation.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc -I./src $(LINKLIB) -O3
index bb7a23b..dc3be2d 100644 (file)
@@ -6,7 +6,7 @@ using namespace cv;
 namespace ct {
     SkeletonTracker::SkeletonTracker() :
                                         m_stream(new VideoCapture(0)),
-                                        m_history(new FrameHistory(*m_stream, 0.25)),
+                                        m_history(new FrameHistory(*m_stream, 0.5)),
                                         m_minimumArclength(100),
                                         m_userSensitivity(260)
     {
@@ -14,7 +14,7 @@ namespace ct {
     }
 
     vector<Skeleton*> SkeletonTracker::getSkeletons() {
-         vector<Skeleton*> skeletons = getSkeleton(m_oldSkeletons, *m_stream, *m_history, m_userSensitivity, m_minimumArclength, true);
+         vector<Skeleton*> skeletons = getSkeleton(m_oldSkeletons, *m_stream, *m_history, m_userSensitivity, m_minimumArclength, 0.5, true);
          m_oldSkeletons = skeletons;
 
          return skeletons;
@@ -81,7 +81,6 @@ namespace ct {
         m_twoFrame = m_lastFrame;
         m_lastFrame = frame;
         
-        resize(m_lastFrame, m_lastFrame, Size(0, 0), m_scaleFactor, m_scaleFactor);
     }
 
     Mat FrameHistory::motion(Mat frame) {
@@ -441,6 +440,7 @@ namespace ct {
         FrameHistory& history, // history for computing delta
         int userSensitivity, // precalibrated value for thresholding
         int minimumArclength, // threshold for discarding noise contours
+        double scaleFactor, // see FrameHistory constructor
         bool shouldFlip // flip webcam image?
     ) {
         // read a frame and optionally flip it
@@ -455,9 +455,9 @@ namespace ct {
         }
 
         // get motion delta
+        resize(frame, frame, Size(0, 0), scaleFactor, scaleFactor);
         Mat delta = history.motion(frame);
         history.append(frame);
-
         Mat outMask;
 
         // compute mask using Collins et al + delta blur-threshold + watershed + contour discrimination
index ecafe20..505a231 100644 (file)
@@ -249,6 +249,7 @@ namespace ct {
         FrameHistory& history, // history for computing delta
         int userSensitivity, // precalibrated value for thresholding
         int minimumArclength, // threshold for discarding noise contours
+        double scaleFactor, // see FrameHistory constructor
         bool shouldFlip // flip webcam image?
     );
 
This page took 0.030126 seconds and 4 git commands to generate.