|
From: <mor...@us...> - 2008-05-14 01:42:35
|
Revision: 411
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=411&view=rev
Author: morgan_quigley
Date: 2008-05-13 18:42:37 -0700 (Tue, 13 May 2008)
Log Message:
-----------
tweak 3rdparty makefiles to provide a 'download' target
Modified Paths:
--------------
pkg/trunk/3rdparty/ffmpeg/Makefile
pkg/trunk/3rdparty/newmat10/Makefile
pkg/trunk/3rdparty/opencv/Makefile
pkg/trunk/3rdparty/sdl/Makefile
pkg/trunk/3rdparty/sdl_image/Makefile
pkg/trunk/unported/vision/sharks/src/postprocess/projector/borg.cpp
pkg/trunk/unported/vision/sharks/src/postprocess/projector/mqmat.h
Removed Paths:
-------------
pkg/trunk/util/image_utils/nodes/
Modified: pkg/trunk/3rdparty/ffmpeg/Makefile
===================================================================
--- pkg/trunk/3rdparty/ffmpeg/Makefile 2008-05-14 00:45:49 UTC (rev 410)
+++ pkg/trunk/3rdparty/ffmpeg/Makefile 2008-05-14 01:42:37 UTC (rev 411)
@@ -3,6 +3,8 @@
ffmpeg-latest:
svn export svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg-latest
+download: ffmpeg-latest
+
ffmpeg: ffmpeg-latest
cd ffmpeg-latest && ./configure --prefix=$(PWD)/ffmpeg --enable-shared
cd ffmpeg-latest && make && make install
Modified: pkg/trunk/3rdparty/newmat10/Makefile
===================================================================
--- pkg/trunk/3rdparty/newmat10/Makefile 2008-05-14 00:45:49 UTC (rev 410)
+++ pkg/trunk/3rdparty/newmat10/Makefile 2008-05-14 01:42:37 UTC (rev 411)
@@ -1,8 +1,12 @@
-all: newmat
+all: newmat/newmat10
-newmat:
+newmat/newmat_1.10.4/newmat10.tar.gz:
mkdir -p newmat/newmat_1.10.4
cd newmat/newmat_1.10.4 && wget http://www.robertnz.net/ftp/newmat10.tar.gz
+
+download: newmat/newmat_1.10.4/newmat10.tar.gz
+
+newmat/newmat10: newmat/newmat_1.10.4/newmat10.tar.gz
cd newmat/newmat_1.10.4 && tar xzf newmat10.tar.gz
cd newmat/newmat_1.10.4 && patch -p1 <../../newmat_1.10.4-2build1.diff
cd newmat/newmat_1.10.4 && touch config.h
Modified: pkg/trunk/3rdparty/opencv/Makefile
===================================================================
--- pkg/trunk/3rdparty/opencv/Makefile 2008-05-14 00:45:49 UTC (rev 410)
+++ pkg/trunk/3rdparty/opencv/Makefile 2008-05-14 01:42:37 UTC (rev 411)
@@ -1,9 +1,13 @@
all: opencv
-opencv-1.0.0:
+opencv-1.0.0.tar.gz:
wget http://internap.dl.sourceforge.net/sourceforge/opencvlibrary/opencv-1.0.0.tar.gz
+
+opencv-1.0.0: opencv-1.0.0.tar.gz
tar xzf opencv-1.0.0.tar.gz
+download: opencv-1.0.0.tar.gz
+
FFMPEG := $(shell rospack find ffmpeg)
opencv: opencv-1.0.0
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${FFMPEG}/ffmpeg/lib && cd opencv-1.0.0 && ./configure --without-quicktime --with-ffmpeg --prefix=$(PWD)/opencv CFLAGS="-I${FFMPEG}/ffmpeg/include -I${FFMPEG}/ffmpeg/include/libavutils -I${FFMPEG}/include/libavformat" CPPFLAGS="-I${FFMPEG}/ffmpeg/include -I${FFMPEG}/ffmpeg/include/libavutils -I${FFMPEG}/ffmpeg/include/libavformat" LDFLAGS=-L${FFMPEG}/ffmpeg/lib --with-gnu-ld --with-x
@@ -14,4 +18,4 @@
clean:
-rm -rf opencv opencv-1.0.0 opencv-1.0.0.tar.gz
-.PHONY : clean
+.PHONY : clean download
Modified: pkg/trunk/3rdparty/sdl/Makefile
===================================================================
--- pkg/trunk/3rdparty/sdl/Makefile 2008-05-14 00:45:49 UTC (rev 410)
+++ pkg/trunk/3rdparty/sdl/Makefile 2008-05-14 01:42:37 UTC (rev 411)
@@ -1,7 +1,11 @@
all: SDL
-SDL-1.2.13:
+SDL-1.2.13.tar.gz:
wget http://libsdl.org/release/SDL-1.2.13.tar.gz
+
+download: SDL-1.2.13.tar.gz
+
+SDL-1.2.13: SDL-1.2.13.tar.gz
tar xzf SDL-1.2.13.tar.gz
SDL: SDL-1.2.13
Modified: pkg/trunk/3rdparty/sdl_image/Makefile
===================================================================
--- pkg/trunk/3rdparty/sdl_image/Makefile 2008-05-14 00:45:49 UTC (rev 410)
+++ pkg/trunk/3rdparty/sdl_image/Makefile 2008-05-14 01:42:37 UTC (rev 411)
@@ -1,7 +1,11 @@
all: SDL_image
-SDL_image-1.2.6:
+SDL_image-1.2.6.tar.gz:
wget http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.6.tar.gz
+
+download: SDL_image-1.2.6.tar.gz
+
+SDL_image-1.2.6: SDL_image-1.2.6.tar.gz
tar xzf SDL_image-1.2.6.tar.gz
SDL_image: SDL_image-1.2.6
Modified: pkg/trunk/unported/vision/sharks/src/postprocess/projector/borg.cpp
===================================================================
--- pkg/trunk/unported/vision/sharks/src/postprocess/projector/borg.cpp 2008-05-14 00:45:49 UTC (rev 410)
+++ pkg/trunk/unported/vision/sharks/src/postprocess/projector/borg.cpp 2008-05-14 01:42:37 UTC (rev 411)
@@ -9,21 +9,72 @@
using namespace mqmath;
double ray[3], laser_norm[3], laser_origin[3], cam_point[3], world_point[3];
-const double cam_tilt = 30.0 * units::DEGREES();
+const double cam_tilt = 0.0 * units::DEGREES(); //30
-void intrinsics(double u, double v)
+
+
+//void intrinsics(double u, double v)
+//{
+//// focal length: (393.756 393.798)
+////principal point: (315.432 247.361)
+//
+// //double fx = 949.415, fy = 870.535;
+// //double u0 = 340.7 , v0 = 278.8;
+// double fx = 393.756, fy = 393.798;
+// double u0 = 315.432 , v0 = 247.361;
+// // express the pixel ray in the base kinematic frame
+// ray[0] = 1;
+// ray[1] = -(v - v0) / fy;
+// ray[2] = (u - u0) / fx;
+//
+// double ray_norm = sqrt(ray[0]*ray[0] + ray[1]*ray[1] + ray[2]*ray[2]);
+// ray[0] /= ray_norm;
+// ray[1] /= ray_norm;
+// ray[2] /= ray_norm;
+//}
+
+void intrinsics(double xp, double yp)
{
- double fx = 949.415, fy = 870.535;
- double u0 = 340.7 , v0 = 278.8;
- // express the pixel ray in the base kinematic frame
- ray[0] = 1; //(u - u0) / fx;
- ray[1] = -(v - v0) / fy;
- ray[2] = (u - u0) / fx;
- double ray_norm = sqrt(ray[0]*ray[0] + ray[1]*ray[1] + ray[2]*ray[2]);
- ray[0] /= ray_norm;
- ray[1] /= ray_norm;
- ray[2] /= ray_norm;
+ //394.493 0 318.619
+ //0 394.327 247.207
+ //0 0 1
+ //first two radial distortion coefficients:
+ //-0.344023 0.127415
+ //and the first two tangential distortion coefficients:
+ //-0.000815 -0.000350
+ double fx = 394.493, fy = 394.327;
+ double x0 = 318.619 , y0 = 247.207;
+ double k1 = -0.344023 , k2 = 0.127415 , k3 = -0.000815 , k4 = -0.000350 , k5 = 0;
+
+ // express the pixel ray in the base kinematic frame
+ //ray[0] = 1;
+ //ray[1] = -(y - y0) / fy;
+ //ray[2] = (x - x0) / fx;
+ double zd = 1;
+ double yd = (yp - y0) / fy;
+ double xd = (xp - x0) / fx;
+
+
+ double r2 = pow(xd,2) + pow(yd,2);
+
+ double radialDistortion = 1 + k1 * r2 + k2 * pow(r2,2) + k5 * pow(r2,2) * r2;
+
+ double tangentialX = 2 * k3 * xd * yd + k4 * ( r2 + 2 * pow(xd,2));
+ double tangentialY = k3 * (r2 + 2 * pow(yd,2)) + 2 * k4 * xd * yd;
+
+ double x = (xd - tangentialX) / radialDistortion;
+ double y = (yd - tangentialY) / radialDistortion;
+
+ ray[0] = 1;
+ ray[1] = -y;
+ ray[2] = x;
+
+
+ double ray_norm = sqrt(ray[0]*ray[0] + ray[1]*ray[1] + ray[2]*ray[2]);
+ ray[0] /= ray_norm;
+ ray[1] /= ray_norm;
+ ray[2] /= ray_norm;
}
void extrinsics(const mqmat<4,4> &T)
@@ -73,32 +124,45 @@
printf("LOWER YOUR SHIELDS\n\n");
const double laser_encoder_offset = 150 * units::DEGREES();
- const double baseline = 9.25 * units::INCHES();
- const double stage_tilt = 15 * units::DEGREES();
+ const double baseline = 6.25 * units::INCHES(); //9.25
+ const double stage_tilt = 5 * units::DEGREES();//15
const double stage_back = 0.5 * units::INCHES();
- const double stage_up = 7.5 * units::INCHES();
+ const double stage_up = 8 * units::INCHES();
const double a2 = stage_up * sin(-stage_tilt) + stage_back * cos(-stage_tilt);
const double d2 = stage_up * cos(-stage_tilt) - stage_back * sin(-stage_tilt);
+ // const double laser_encoder_offset = 150 * units::DEGREES();
+ //const double baseline = 6.25 * units::INCHES();
+ //const double stage_tilt = 7 * units::DEGREES();
+ //const double stage_back = 0.5 * units::INCHES();
+ //const double stage_up = 8 * units::INCHES();
+ //const double a2 = stage_up * sin(-stage_tilt) + stage_back * cos(-stage_tilt);
+ //const double d2 = stage_up * cos(-stage_tilt) - stage_back * sin(-stage_tilt);
+
// mqdh T0(0, 0, 0, cam_tilt);
mqdh T0(0, 0, 0, 0);
mqdh T1(0, 0, baseline, stage_tilt);
- mqdh T3(M_PI/2, 0, 0, 0 * units::DEGREES());
+ mqdh T3(M_PI/2, 0, 0, 0 * units::DEGREES()); //M_PI in linux
- const char *laserfile = "laserData.txt";
+ //const char *laserfile = "laserData.txt";
+ char *laserfile = argv[1];
FILE *f = fopen(laserfile, "r");
if (!f)
{
printf("couldn't open [%s]\n", laserfile);
return 1;
}
- FILE *out = fopen("points.txt", "w");
+ //FILE *out = fopen("points.txt", "w");
+ char *pointcloud = argv[2];
+ FILE *out = fopen(pointcloud, "w");
int line = 0;
while (!feof(f))
{
line++;
double laser_ang, row, col;
- if (3 != fscanf(f, "%lf %lf %lf\n", &laser_ang, &row, &col))
+ double r,g,b;
+ //if (3 != fscanf(f, "%lf %lf %lf\n", &laser_ang, &row, &col))
+ if (6 != fscanf(f, "%lf %lf %lf %lf %lf %lf\n", &laser_ang, &row, &col,&r,&g,&b))
{
printf("error in parse\n");
break;
@@ -108,7 +172,7 @@
break;
#endif
double stage = laser_encoder_offset - laser_ang * units::DEGREES();
- mqdh T2(-M_PI/2, a2, d2, stage);
+ mqdh T2(-M_PI/2, a2, d2, stage); //M_PI in linux
mqmat<4,4> T(T0 * T1 * T2 * T3);
extrinsics(T);
intrinsics(col, row);
@@ -125,9 +189,10 @@
printf("\n");
#endif
- fprintf(out, "%f %f %f\n", world_point[0], world_point[1], world_point[2]);
+ //fprintf(out, "%f %f %f\n", world_point[0], world_point[1], world_point[2]);
+ fprintf(out, "%f %f %f %d %d %d %f %f %f %d\n", world_point[0], world_point[1], world_point[2],0,0,0,r,g,b,0);
- }
+ }//while laser points are being read
fclose(f);
fclose(out);
Modified: pkg/trunk/unported/vision/sharks/src/postprocess/projector/mqmat.h
===================================================================
--- pkg/trunk/unported/vision/sharks/src/postprocess/projector/mqmat.h 2008-05-14 00:45:49 UTC (rev 410)
+++ pkg/trunk/unported/vision/sharks/src/postprocess/projector/mqmat.h 2008-05-14 01:42:37 UTC (rev 411)
@@ -16,7 +16,7 @@
template<size_t rows, size_t cols, typename T>
std::ostream &operator<<(std::ostream &, const mqmat<rows, cols, T> &);
-template<size_t rows, size_t cols, typename T = double>
+template<size_t rows, size_t cols = 1, typename T = double>
class mqmat
{
friend std::ostream &operator<< <rows, cols, T>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|