[Jderobot-admin] jderobot-r1032 - trunk/src/stable/components/openniServer
frivas en jderobot.org
frivas en jderobot.org
Jue Oct 10 16:11:38 CEST 2013
Author: frivas
Date: 2013-10-10 16:10:37 +0200 (Thu, 10 Oct 2013)
New Revision: 1032
Modified:
trunk/src/stable/components/openniServer/myprogeo.cpp
trunk/src/stable/components/openniServer/myprogeo.h
Log:
#66 solved issued with resolutions
Modified: trunk/src/stable/components/openniServer/myprogeo.cpp
===================================================================
--- trunk/src/stable/components/openniServer/myprogeo.cpp 2013-10-10 13:57:26 UTC (rev 1031)
+++ trunk/src/stable/components/openniServer/myprogeo.cpp 2013-10-10 14:10:37 UTC (rev 1032)
@@ -154,14 +154,18 @@
std::cout << w << ", " << h << std::endl;
this->cameras[cam].fdistx=515;
this->cameras[cam].fdisty=515;
- this->cameras[cam].u0=h/2;
- this->cameras[cam].v0=w/2;
+ this->cameras[cam].v0=h/2;
+ this->cameras[cam].u0=w/2;
this->cameras[cam].position.X=0;
this->cameras[cam].position.Y=0;
this->cameras[cam].position.Z=0;
this->cameras[cam].foa.X=0;
this->cameras[cam].foa.Y=1;
this->cameras[cam].foa.Z=0;
+ this->cameras[cam].columns=w;
+ this->cameras[cam].rows=h;
+ this->w=w;
+ this->h=h;
update_camera_matrix(&cameras[cam]);
@@ -185,7 +189,24 @@
display_camerainfo(cameras[cam]);
}
+void myprogeo::pixel2optical(float*x,float*y){
+ int localX=*x;
+ int localY=*y;
+ *x= this->h-1-localY;
+ *y= localX;
+}
+
+void myprogeo::optical2pixel(float*x,float*y){
+
+ int localX=*x;
+ int localY=*y;
+
+ *x= localY;
+ *y= this->h-1-localX;
+}
+
+
void
myprogeo::mybackproject(float x, float y, float* xp, float* yp, float* zp, float* camx, float* camy, float* camz, int cam) {
HPoint2D p;
@@ -194,8 +215,9 @@
- p.x=GRAPHIC_TO_OPTICAL_X(x,y);
- p.y=GRAPHIC_TO_OPTICAL_Y(x,y);
+ pixel2optical(&x, &y);
+ p.x=x;
+ p.y=y;
p.h=1;
backproject(&pro,p,cameras[cam]);
*xp=pro.X;
Modified: trunk/src/stable/components/openniServer/myprogeo.h
===================================================================
--- trunk/src/stable/components/openniServer/myprogeo.h 2013-10-10 13:57:26 UTC (rev 1031)
+++ trunk/src/stable/components/openniServer/myprogeo.h 2013-10-10 14:10:37 UTC (rev 1032)
@@ -29,12 +29,6 @@
#include <stdio.h>
#include <stdlib.h>
-/* GRAPHIC coordenates to OPTICAL coordenates */
-#define WORKING_IMG_HEIGHT 480
-#define GRAPHIC_TO_OPTICAL_X(x,y) (WORKING_IMG_HEIGHT-1-y)
-#define GRAPHIC_TO_OPTICAL_Y(x,y) (x)
-#define OPTICAL_TO_GRAPHIC_X(x,y) (y)
-#define OPTICAL_TO_GRAPHIC_Y(x,y) (WORKING_IMG_HEIGHT-1-x)
#define MAX_CAMERAS 8
#define MAX_BUFFER 1024
@@ -55,7 +49,10 @@
private:
/* cameras */
+ void pixel2optical(float*x,float*y);
+ void optical2pixel(float* x, float* y);
TPinHoleCamera cameras[MAX_CAMERAS];
+ int w,h;
};
} // namespace
More information about the Jderobot-admin
mailing list