summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2014-12-24 01:32:13 +0100
committerFlorian Jung <flo@windfisch.org>2014-12-24 01:32:13 +0100
commit27b9f435a65cf270ef1f320736f2d6ae7347cfe4 (patch)
tree141a7f93f285dfe9230660a467f5234953f497be
parent449cf1bbf0df985e43f7ac4f362c961b15ebe5d2 (diff)
yayz
-rw-r--r--client2.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/client2.c b/client2.c
index d968c9f..2707b87 100644
--- a/client2.c
+++ b/client2.c
@@ -44,10 +44,29 @@ int main(int argc, const char** argv)
if (connect(sockfd, (struct sockaddr*) &my_sockaddr, sockaddrlen) == -1)
die("connect");
-
+
+ Mat camera_matrix = Mat::eye(3,3,CV_32FC1);
+ camera_matrix.at<float>(0,0)=1000;
+ camera_matrix.at<float>(1,1)=1000;
+ camera_matrix.at<float>(0,2)=800;
+ camera_matrix.at<float>(1,2)=300;
+ Mat map1[3], map2[3];
+ for (int i=0; i<3; i++)
+ {
+ Mat camera_matrix_clone = camera_matrix.clone();
+ camera_matrix_clone.at<float>(0,0)*=(1.+i/100.);
+ camera_matrix_clone.at<float>(1,1)*=(1.+i/100.);
+ initUndistortRectifyMap(camera_matrix, Vec4f(0.5,0.1,0,0), Mat::eye(3,3,CV_32F), camera_matrix_clone, Size(1600,600), CV_32FC1, map1[i], map2[i]);
+ }
+ printf("GO!!\n");
time_t t = time(NULL);
int nframes=0;
+ write(sockfd,"get\n",4);
+ read_completely(sockfd, buffer, 4);
+ int framelen = ((buffer[0]*256+buffer[1])*256+buffer[2])*256+buffer[3];
+ if (framelen > sizeof(buffer)) suicide("buffer too small");
+ read_completely(sockfd, buffer, framelen);
while (waitKey(1) != 'x')
{
write(sockfd,"get\n",4);
@@ -58,7 +77,23 @@ int main(int argc, const char** argv)
//Mat dingens=Mat::eye(100,100,CV_8UC1) * 244;
Mat dingens(600,1600,CV_8UC3, buffer);
- imshow("dingens",dingens);
+ for (int i=0; i< 1600; i+=50)
+ dingens.col(i)=Vec3b(255,192,128);
+ for (int i=0; i< 600; i+=50)
+ dingens.row(i)=Vec3b(255,192,128);
+ Mat zeuch;
+ //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], map1[i], map2[i], INTER_LINEAR);
+
+ merge(colors2, 3, zeuch);
+
+ imshow("dingens",zeuch);
time_t tmp = time(NULL);
if (tmp!=t)