summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2014-12-24 18:32:55 +0100
committerFlorian Jung <flo@windfisch.org>2014-12-24 18:32:55 +0100
commitd2770508bf52c7d6184248f537e82c59f76d1e35 (patch)
tree359a24caf86f2a13afef46b1c92c9042c9a49464
parentda823bb3d101fd1f72360ffb8147ab67621e6e69 (diff)
yay
-rw-r--r--client2.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/client2.c b/client2.c
index 83132df..02c0129 100644
--- a/client2.c
+++ b/client2.c
@@ -58,14 +58,15 @@ int main(int argc, const char** argv)
bool go=true;
bool new_vals=true;
- #define N_VALUES 8
+ #define N_VALUES 11
int curr_val=0;
float val[N_VALUES];
- float step[N_VALUES] = {0.05,0.05,0.0,0.0,10,10,10,10};
- Mat map1[3], map2[3];
+ float step[N_VALUES] = {0.05,0.05,0.0,0.0,10,10,10,10,0.002,0.002,0.002};
+ Mat map1A[3], map2A[3], map1B[3], map2B[3];
float &k1=val[0], &k2=val[1], &p1=val[2], &p2=val[3];
float &x1=val[4], &y1=val[5], &x2=val[6], &y2=val[7];
+ float* col=&val[8];
float c1,c2,c1_,c2_;
k1=0.5;
@@ -77,6 +78,9 @@ int main(int argc, const char** argv)
c1_=960/2;
c2_=1080/2;
x1=x2=y1=y2=0.0;
+ col[0]=-0.01;
+ col[1]=0.0;
+ col[2]=0.01;
while ((key = waitKey(1)) != 'x')
{
@@ -91,6 +95,12 @@ int main(int argc, const char** argv)
if (new_vals)
{
+ printf("val = { %f", val[0]);
+ for (int i=1; i< N_VALUES; i++)
+ printf(", %f", val[i]);
+ printf("}\n");
+
+
Mat camera_matrix = Mat::eye(3,3,CV_32FC1);
camera_matrix.at<float>(0,0)=1000;
camera_matrix.at<float>(1,1)=1000;
@@ -99,11 +109,25 @@ int main(int argc, const char** argv)
for (int i=0; i<3; i++)
{
Mat camera_matrix_clone = camera_matrix.clone();
+ camera_matrix_clone.at<float>(0,0)*=(1.+col[i]);
+ camera_matrix_clone.at<float>(1,1)*=(1.+col[i]);
+ camera_matrix_clone.at<float>(0,2)=c1_+x1;
+ camera_matrix_clone.at<float>(1,2)=c2_+y1;
+ initUndistortRectifyMap(camera_matrix, Vec4f(k1,k2,p1,p2), Mat::eye(3,3,CV_32F), camera_matrix_clone, Size(960,1080), CV_32FC1, map1A[i], map2A[i]);
+ }
+
+ camera_matrix.at<float>(0,0)=1000;
+ camera_matrix.at<float>(1,1)=1000;
+ camera_matrix.at<float>(0,2)=c1-x1-x2;
+ camera_matrix.at<float>(1,2)=c2+y1+y2;
+ for (int i=0; i<3; i++)
+ {
+ Mat camera_matrix_clone = camera_matrix.clone();
camera_matrix_clone.at<float>(0,0)*=(1.+(i-1)/100.);
camera_matrix_clone.at<float>(1,1)*=(1.+(i-1)/100.);
- camera_matrix_clone.at<float>(0,2)=c1_+x1;
+ camera_matrix_clone.at<float>(0,2)=c1_-x1;
camera_matrix_clone.at<float>(1,2)=c2_+y1;
- initUndistortRectifyMap(camera_matrix, Vec4f(k1,k2,p1,p2), Mat::eye(3,3,CV_32F), camera_matrix_clone, Size(960,1080), CV_32FC1, map1[i], map2[i]);
+ initUndistortRectifyMap(camera_matrix, Vec4f(k1,k2,p1,p2), Mat::eye(3,3,CV_32F), camera_matrix_clone, Size(960,1080), CV_32FC1, map1B[i], map2B[i]);
}
new_vals=false;
@@ -123,18 +147,28 @@ int main(int argc, const char** argv)
dingens.col(i)=Vec3b(255,192,128);
for (int i=0; i< 768; i+=50)
dingens.row(i)=Vec3b(255,192,128);
- Mat zeuch, zeuch2;
+
+
+ Mat lefteye, righteye, zeuch2;
//remap(dingens, zeuch, map1, map2, INTER_LINEAR);
Mat colors[3];
Mat colors2[3];
+
+ split(dingens, colors);
+
+ for (int i=0; i<3; i++)
+ remap(colors[i], colors2[i], map1A[i], map2A[i], INTER_LINEAR);
+
+ merge(colors2, 3, lefteye);
+
split(dingens, colors);
for (int i=0; i<3; i++)
- remap(colors[i], colors2[i], map1[i], map2[i], INTER_LINEAR);
+ remap(colors[i], colors2[i], map1B[i], map2B[i], INTER_LINEAR);
- merge(colors2, 3, zeuch);
- hconcat(zeuch,zeuch,zeuch2);
+ merge(colors2, 3, righteye);
+ hconcat(lefteye, righteye ,zeuch2);
imshow("dingens",zeuch2);