summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2011-01-31 22:22:12 +0100
committerGuillaume Seguin <guillaume@segu.in>2011-01-31 22:22:12 +0100
commit95cce3764b4d425c3456c87823940e685f9bd30d (patch)
treece9929d22306cce1d5cc9252ba7bb305c652325d
parent7889deadd3acbd2e0fdf9d0bf5dd55585d38aa32 (diff)
downloadspacetimemanifolds-95cce3764b4d425c3456c87823940e685f9bd30d.tar.gz
spacetimemanifolds-95cce3764b4d425c3456c87823940e685f9bd30d.tar.bz2
Various fixes and adjustmentsHEADmaster
-rw-r--r--compute.cc12
-rw-r--r--constants.h4
-rw-r--r--utils.cc2
-rw-r--r--xtslice.cc8
4 files changed, 16 insertions, 10 deletions
diff --git a/compute.cc b/compute.cc
index 7bcb56c..7b43ae9 100644
--- a/compute.cc
+++ b/compute.cc
@@ -106,6 +106,9 @@ Path constrained_dijkstra(vector<Mat> & frames, vector<vector<bool> > mask,
for (int strip = 0; strip < cur_width; ++strip)
{
Q.push(ppdii (pdi(0, 0), init_delta + strip));
+ if (strip > 0)
+ prev[init_delta + strip] = init_delta + strip - 1;
+ hops[init_delta + strip] = strip;
dists[init_delta + strip] = 0;
}
int processed = 0;
@@ -209,6 +212,8 @@ Path constrained_dijkstra(vector<Mat> & frames, vector<vector<bool> > mask,
Path path;
int v = best_end;
double prev_cost = best_length;
+ fprintf(stdout, "Processed a total of %d nodes (%.3lfs)\n",
+ processed, toc());
fprintf(stdout, "Path length %.3le\n", best_length);
while (v != -1)
{
@@ -229,7 +234,7 @@ vector<vector<bool> > constant_mask(int frames_count, int strips_count, bool val
vector<vector<bool> > mask;
for (int frame = 0; frame < frames_count; ++frame)
{
- vector<bool> frame_mask(strips_count, true);
+ vector<bool> frame_mask(strips_count, value);
mask.push_back(frame_mask);
}
return mask;
@@ -307,16 +312,15 @@ Mat compute_mosaic(vector<Mat> & frames,
path,
direction,
&length);
- //explore_path(downscaled[i], path);
Mat mosaic = cspace4c_to_rgb(stitch_path(downscaled[i], path));
char buf[200];
sprintf(buf, "mosaic-%d.png", i);
imwrite(buf, mosaic);
- Mat slice = cspace4c_to_rgb(xtslice(downscaled[i], path));
+ Mat slice = xtslice(downscaled[i], path);
sprintf(buf, "xtslice-%d.png", i);
imwrite(buf, slice);
imshow("Slice", slice);
- waitKey(0);
+ explore_path(downscaled[i], path);
paths[i] = path;
mosaics[i] = mosaic;
fprintf(stdout, "Length at scale level %d = %.3le\n", i, length);
diff --git a/constants.h b/constants.h
index e467eff..da142d9 100644
--- a/constants.h
+++ b/constants.h
@@ -3,12 +3,12 @@
const int PYRAMID_LEVELS = 3;
-const int X_DELTA_WIDTH = 7;
+const int X_DELTA_WIDTH = 5;
const int Y_DELTA_WIDTH = 0; /* Unused */
const int T_DELTA_WIDTH = 5;
const int X_SCALE_WIDTH = 7;
const int Y_SCALE_WIDTH = 1; /* Unused */
-const int T_SCALE_WIDTH = 7;
+const int T_SCALE_WIDTH = 5;
const int X_CMP_WIDTH = 12;
const int Y_CMP_WINDOW = 12;
diff --git a/utils.cc b/utils.cc
index 0ba9546..c859c18 100644
--- a/utils.cc
+++ b/utils.cc
@@ -10,7 +10,7 @@ void display_video(vector<Mat> frames)
}
}
-#define USE_LAB 0
+#define USE_LAB 1
Mat rgb_to_cspace4c(Mat src)
{
diff --git a/xtslice.cc b/xtslice.cc
index 1066338..d777226 100644
--- a/xtslice.cc
+++ b/xtslice.cc
@@ -1,4 +1,5 @@
#include "xtslice.h"
+#include "utils.h"
using namespace std;
using namespace cv;
@@ -7,17 +8,18 @@ Mat xtslice(vector<Mat> frames, Path path)
{
int height = frames[0].size().width;
int width = frames.size();
- Mat slice = Mat::zeros(height, width, frames[0].type());
+ Mat slice_base = Mat::zeros(height, width, frames[0].type());
for (int i = 0; i < width; ++i)
{
- Mat dest = slice.col(i);
+ Mat dest = slice_base.col(i);
Mat src = frames[i].row(frames[i].size().height / 2).t();
src.copyTo(dest);
}
+ Mat slice = cspace4c_to_rgb(slice_base);
for (Path::iterator it = path.begin(); it != path.end(); ++it)
{
int frame = it->first, strip = it->second;
- cv::line(slice, Point(frame, strip), Point(frame, strip), CV_RGB(0, 0, 1));
+ cv::line(slice, Point(frame, strip), Point(frame, strip), CV_RGB(0, 255, 0));
}
return slice;
}