summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Mavrinac <mavrinac@gmail.com>2009-01-09 11:26:22 -0500
committerAaron Mavrinac <mavrinac@gmail.com>2009-01-09 11:26:22 -0500
commit01dff9c7d50810867f52a6470f75d8899af47554 (patch)
treeb4c8eacc101939d6a86a39daf00ebb425b45e770 /media-libs
parentVersion bump sci-libs/pydsscc to 0.3.1. (diff)
downloadezod-01dff9c7d50810867f52a6470f75d8899af47554.tar.gz
ezod-01dff9c7d50810867f52a6470f75d8899af47554.tar.bz2
ezod-01dff9c7d50810867f52a6470f75d8899af47554.zip
Add Martin Dale's stereo rectification patch to media-libs/opencv.
Diffstat (limited to 'media-libs')
-rw-r--r--media-libs/opencv/Manifest3
-rw-r--r--media-libs/opencv/files/opencv-1.1.0_pre1-stereorectify.patch40
-rw-r--r--media-libs/opencv/opencv-1.1.0_pre1.ebuild2
3 files changed, 44 insertions, 1 deletions
diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 6ff2767..c3cff19 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,4 +1,5 @@
+AUX opencv-1.1.0_pre1-stereorectify.patch 1409 RMD160 0b317df1cb2a2b61be6e673b1b52ecf836b0e7cf SHA1 2a4d841dac0882de2087bcf7c495045b4639d142 SHA256 2a25dd7b7cf968dfbac143a1cfbd1a5afaaafb2fceb62e60d51d21220139c8af
DIST opencv-1.1pre1.tar.gz 22301291 RMD160 d105a97f211637edbbac1eb21dca2b140b1f37be SHA1 4bc4bda92a250adcb82b236161d364c059021a43 SHA256 7e4f0026e5543c38afcf8a4298b1da2bace977499f99b885c925fc784783d812
-EBUILD opencv-1.1.0_pre1.ebuild 2310 RMD160 66ed8a4b66c69bdbd132c2ae9a488e09dd782066 SHA1 29293635ead63fa2d120258553cf6d7f1a2baa5f SHA256 0ee9aae6ed177b100f942573f7b3704fa0f63d134c89ddf6ac56fccfef7eda7b
+EBUILD opencv-1.1.0_pre1.ebuild 2358 RMD160 2530bbe2b099f337c06d506bc7c90a3ef9866b9c SHA1 f2376f472ef0c9fa9c9e54e57d805e03815ef585 SHA256 9c02d6841e8438b801bbde9547e17d7c98a8254f273d926b7f6ee7d3aa191f8d
MISC ChangeLog 247 RMD160 0e6e217a68ed0ab2b33cef486e1d85ce122f4c6f SHA1 d2660a005d7773f779f1060474255bfaf4b36a59 SHA256 92427261739f9cd143793b0de3bff265edc9bb51f9f49ec2f83bc1b398cd3e84
MISC metadata.xml 758 RMD160 bdfc7cd1bf469fe5951429333659946f377faa48 SHA1 812545f8fab4fc2304006b8ebc6bfcb1155cc519 SHA256 7468b2722153f29842e40153f877e1bd980ef617f46a3f438b686b2f1a9f1dea
diff --git a/media-libs/opencv/files/opencv-1.1.0_pre1-stereorectify.patch b/media-libs/opencv/files/opencv-1.1.0_pre1-stereorectify.patch
new file mode 100644
index 0000000..0c16cbe
--- /dev/null
+++ b/media-libs/opencv/files/opencv-1.1.0_pre1-stereorectify.patch
@@ -0,0 +1,40 @@
+--- opencv-1.1.0/cv/src/cvcalibration.cpp.orig
++++ opencv-1.1.0/cv/src/cvcalibration.cpp
+@@ -2337,20 +2337,28 @@
+
+ fc = cvmGet(A,idx^1,idx^1);
+ if( dk1 < 0 )
+- fc *= 1 + 0.2*dk1*(nx*nx + ny*ny)/(8*fc*fc);
++ fc *= 1 + dk1*(nx*nx + ny*ny)/(4*fc*fc);
+ fc_new = MIN(fc_new, fc);
+
+ for( i = 0; i < 4; i++ )
+ {
+- _pts[i].x = (float)(((i % 2) + 0.5)*nx*0.5);
+- _pts[i].y = (float)(((i / 2) + 0.5)*ny*0.5);
+- }
++ int j = (i<2) ? 0 : 1;
++ _pts[i].x = (float)((i % 2)*(nx-1));
++ _pts[i].y = (float)(j*(ny-1));
++ }
+ cvUndistortPoints( &pts, &pts, A, Dk, 0, 0 );
+ cvConvertPointsHomogeneous( &pts, &pts_3 );
+- cvProjectPoints2( &pts_3, k == 0 ? _R1 : _R2, &Z, A, 0, &pts );
++ //Change camera matrix to have cc=[0,0] and fc = fc_new
++ double _a_tmp[3][3];
++ CvMat A_tmp = cvMat(3, 3, CV_64F, _a_tmp);
++ _a_tmp[0][0]=fc_new;
++ _a_tmp[1][1]=fc_new;
++ _a_tmp[0][2]=0.0;
++ _a_tmp[1][2]=0.0;
++ cvProjectPoints2( &pts_3, k == 0 ? _R1 : _R2, &Z, &A_tmp, 0, &pts );
+ CvScalar avg = cvAvg(&pts);
+- cc_new[k].x = avg.val[0];
+- cc_new[k].y = avg.val[1];
++ cc_new[k].x = (nx-1)/2 - avg.val[0];
++ cc_new[k].y = (ny-1)/2 - avg.val[1];
+ }
+
+ // vertical focal length must be the same for both images to keep the epipolar constraint
+
+
diff --git a/media-libs/opencv/opencv-1.1.0_pre1.ebuild b/media-libs/opencv/opencv-1.1.0_pre1.ebuild
index f4fc615..383f3fd 100644
--- a/media-libs/opencv/opencv-1.1.0_pre1.ebuild
+++ b/media-libs/opencv/opencv-1.1.0_pre1.ebuild
@@ -41,6 +41,8 @@ src_unpack() {
# remove the install-hook that runs ldconfig.
sed -i '/install-hook:/,/^$/d' Makefile.am
+ epatch "${FILESDIR}"/${P}-stereorectify.patch
+
eautoreconf || die "eautoreconf failed"
}