Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Akira originals addon sources... cleaning lib/osx of redundant libs

  • Loading branch information...
commit 60d37b7145d0ff43c6c432e0039ede5eb40ff4d9 1 parent 3192032
@patriciogonzalezvivo patriciogonzalezvivo authored
View
2  README.md
@@ -1,6 +1,4 @@
#ofxPTAM#
-This was addon started by @Akira_At_Asia and continue by @patriciogv
-
You will find that you have to make and copy all the PTAM requierd libraries and soureces. Following you will find here an explanation on how to doit on Snow Leopard and Lion OSX.
##Compiling PTAM and needs libraries on MACOSX 10.6 and 10.7##
View
BIN  lib/osx/lib3ds-2.0.0.0.dylib
Binary file not shown
View
BIN  lib/osx/lib3ds-2.0.dylib
Binary file not shown
View
BIN  lib/osx/lib3ds.a
Binary file not shown
View
BIN  lib/osx/lib3ds.dylib
Binary file not shown
View
35 lib/osx/lib3ds.la
@@ -1,35 +0,0 @@
-# lib3ds.la - a libtool library file
-# Generated by ltmain.sh - GNU libtool 1.5.26 Debian 1.5.26-1ubuntu1 (1.1220.2.493 2008/02/01 16:58:18)
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='lib3ds-2.0.dylib'
-
-# Names of this library.
-library_names='lib3ds-2.0.0.0.dylib lib3ds-2.0.dylib lib3ds.dylib'
-
-# The name of the static archive.
-old_library='lib3ds.a'
-
-# Libraries that this one depends upon.
-dependency_libs=' -lm'
-
-# Version information for lib3ds.
-current=0
-age=0
-revision=0
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/usr/local/lib'
View
BIN  lib/osx/libGVars3-0.dylib
Binary file not shown
View
BIN  lib/osx/libGVars3.dylib
Binary file not shown
View
BIN  lib/osx/libGVars3_headless-0.dylib
Binary file not shown
View
BIN  lib/osx/libGVars3_headless.dylib
Binary file not shown
View
BIN  lib/osx/libcvd-0.dylib
Binary file not shown
View
BIN  lib/osx/libcvd.dylib
Binary file not shown
View
BIN  lib/osx/libcvd_debug-0.8.dylib
Binary file not shown
View
BIN  lib/osx/libcvd_debug-0.dylib
Binary file not shown
View
BIN  lib/osx/libcvd_debug.a
Binary file not shown
View
BIN  lib/osx/libcvd_debug.dylib
Binary file not shown
View
BIN  lib/osx/libjpeg.8.dylib
Binary file not shown
View
BIN  lib/osx/libjpeg.a
Binary file not shown
View
BIN  lib/osx/libjpeg.dylib
Binary file not shown
View
41 lib/osx/libjpeg.la
@@ -1,41 +0,0 @@
-# libjpeg.la - a libtool library file
-# Generated by libtool (GNU libtool) 2.4
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='libjpeg.8.dylib'
-
-# Names of this library.
-library_names='libjpeg.8.dylib libjpeg.dylib'
-
-# The name of the static archive.
-old_library='libjpeg.a'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags=' '
-
-# Libraries that this one depends upon.
-dependency_libs=''
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libjpeg.
-current=11
-age=3
-revision=0
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/usr/local/lib'
View
13 src/ofxATANCamera.cpp 100644 → 100755
@@ -19,7 +19,7 @@ void ofxATANCamera::manualParamUpdate(string cfgFile) {
stream.close();
unsigned int loc = params.find( "=", 0 );
- params.erase(0, loc+1);
+ params.erase(0, loc+1);
vector<char*> tmp;
char *strchar = std::strcpy(new char[params.size() + 1], params.c_str());
char *tp;
@@ -31,20 +31,13 @@ void ofxATANCamera::manualParamUpdate(string cfgFile) {
}
Vector<5> vUpdate;
-
- // For some reason the first value apears as the second and so on
- // I think it´s the [ ]
- //
- unsigned int offset = 0;
- if (atof(tmp[0]) == 0)
- offset = 1;
-
for (int i = 0; i < 5; i++) {
- vUpdate[i] = atof(tmp[i + offset]);
+ vUpdate[i] = atof(tmp[i+1]);
}
(*mgvvCameraParams) = (*mgvvCameraParams) + vUpdate;
RefreshParams();
+
}
// TODO: do complete Test!
View
14 src/ofxATANCamera.h 100644 → 100755
@@ -13,15 +13,19 @@
#include "ofMain.h"
class ofxATANCamera : public ATANCamera {
-public:
+
+ public:
- ofxATANCamera(string sName) : ATANCamera(sName) { };
+ ofxATANCamera(string sName)
+ : ATANCamera(sName)
+ {
+ }
- void manualParamUpdate(string cfgFile);
+ void manualParamUpdate(string cfgFile);
- bool paramTest();
+ bool paramTest();
-private:
+ private:
};
View
145 src/ofxPTAM.cpp 100644 → 100755
@@ -9,6 +9,7 @@
#include "ofxPTAM.h"
#include "ofxATANCamera.h"
+#include "ofMain.h"
#include "cvd/colourspace.h"
#include "gvars3/instances.h"
@@ -20,14 +21,16 @@
using namespace CVD;
using namespace GVars3;
-void ofxPTAM::init(int imgW, int imgH) {
+
+
+void ofxPTAM::initPTAM(int imgW, int imgH) {
imgWidth = imgW;
imgHeight = imgH;
mimFrameBW.resize(ImageRef(imgWidth,imgHeight));
- //mimFrameRGB.resize(ImageRef(imgWidth,imgHeight));
-
+ mimFrameRGB.resize(ImageRef(imgWidth,imgHeight));
+
GV3::get<Vector<NUMTRACKERCAMPARAMETERS> >("Camera.Parameters", ATANCamera::mvDefaultParams, HIDDEN);
mpCamera = new ofxATANCamera("Camera");
mpCamera->manualParamUpdate("camera.cfg");
@@ -47,105 +50,49 @@ void ofxPTAM::init(int imgW, int imgH) {
}
-void ofxPTAM::update(ofPixelsRef _pixelsRef){
- // TODOs
- // - some checks here in order to avoid SEGMENTATION_FALT
-
- int nChannels = _pixelsRef.getNumChannels();
- unsigned char * pixels = _pixelsRef.getPixels();
-
- ImageRef mirSize = ImageRef(imgWidth,imgHeight);
- BasicImage<CVD::byte> imCaptured(pixels, mirSize);
- mimFrameBW.resize(mirSize);
-
- if (nChannels == 1){
- for (int y=0; y<mirSize.y; y++) {
- for (int x=0; x<mirSize.x; x++) {
- mimFrameBW[y][x] = *pixels;
- pixels++;
- }
- }
- } else if (nChannels > 1){
- for (int y=0; y<mirSize.y; y++) {
- for (int x=0; x<mirSize.x; x++) {
- pixels++;
- mimFrameBW[y][x] = *pixels;
- pixels++;
- pixels++;
- }
- }
- } else if (nChannels == 4){
- for (int y=0; y<mirSize.y; y++) {
- for (int x=0; x<mirSize.x; x++) {
- pixels++;
- mimFrameBW[y][x] = *pixels;
- pixels++;
- pixels++;
- pixels++;
- }
- }
- }
-
+void ofxPTAM::updatePTAM(unsigned char *pixels) {
+
+ #ifdef USE_PTAM_VIDEOSRC
+ mVideoSource.GetAndFillFrameBWandRGB(mimFrameBW, mimFrameRGB);
+ #else
+ ImageRef mirSize = ImageRef(imgWidth,imgHeight);
+ BasicImage<CVD::byte> imCaptured(pixels, mirSize);
+ mimFrameBW.resize(mirSize);
+ for (int y=0; y<mirSize.y; y++) {
+ for (int x=0; x<mirSize.x; x++) {
+ pixels++;
+ mimFrameBW[y][x] = *pixels;
+ pixels++;
+ pixels++;
+ }
+ }
+ #endif
mpTracker->TrackFrame(mimFrameBW, false);
- bMapBuildComplete = mpMap->IsGood();
-}
+ bMapBuildComplete = mpMap->IsGood();
-void ofxPTAM::draw() {
- if (bMapBuildComplete)
- mpTracker->drawGrid();
- else
- mpTracker->drawTrail();
}
-void ofxPTAM::resetMap() {
- mpTracker->reset();
-}
-void ofxPTAM::startBuildMap() {
- mpTracker->buildMapBegin();
+#ifdef USE_PTAM_VIDEOSRC
+void ofxPTAM::drawImg() {
+ ofImage img;
+ img.setFromPixels(reinterpret_cast<unsigned char*>(mimFrameRGB.data()), imgWidth, imgHeight, OF_IMAGE_COLOR);
+ img.draw(0,0);
}
+#endif
-ofMatrix4x4 ofxPTAM::getRotationMatrix() const {
- SE3<> cvdMapMatrix = mpTracker->GetCurrentPose();
- Matrix<4> cvdCamMatrix = mpCamera->MakeUFBLinearFrustumMatrix(0.005, 100);
-
- ofMatrix4x4 ofMapMatrix;
- ofMatrix4x4 ofCamMatrix;
-
- ofMapMatrix.set(cvdMapMatrix.get_rotation().get_matrix()[0][0],
- cvdMapMatrix.get_rotation().get_matrix()[0][1],
- cvdMapMatrix.get_rotation().get_matrix()[0][2],
- 0,
- cvdMapMatrix.get_rotation().get_matrix()[1][0],
- cvdMapMatrix.get_rotation().get_matrix()[1][1],
- cvdMapMatrix.get_rotation().get_matrix()[1][2],
- 0,
- cvdMapMatrix.get_rotation().get_matrix()[2][0],
- cvdMapMatrix.get_rotation().get_matrix()[2][1],
- cvdMapMatrix.get_rotation().get_matrix()[2][3],
- 0,
- 0, 0, 0, 1);
-
- //ofMapMatrix.translate(cvdMapMatrix.get_translation()[0], cvdMapMatrix.get_translation()[1], cvdMapMatrix.get_translation()[2]);
-
- ofCamMatrix.set(cvdCamMatrix[0][0], cvdCamMatrix[0][1], cvdCamMatrix[0][2], cvdCamMatrix[0][3],
- cvdCamMatrix[1][0], cvdCamMatrix[1][1], cvdCamMatrix[1][2], cvdCamMatrix[1][3],
- cvdCamMatrix[2][0], cvdCamMatrix[2][1], cvdCamMatrix[2][2], cvdCamMatrix[2][3],
- cvdCamMatrix[3][0], cvdCamMatrix[3][1], cvdCamMatrix[3][2], cvdCamMatrix[3][3]);
-
- //ofMapMatrix.postMult(ofCamMatrix);
-
- ofMapMatrix = ofCamMatrix * ofMapMatrix;
-
- return ofMapMatrix;
+void ofxPTAM::drawTrail() {
+ mpTracker->drawTrail();
}
-/*
+
+
+
void ofxPTAM::beginAR() {
glPushMatrix();
// Set up AR
mpCamera->SetImageSize(ImageRef(imgWidth,imgHeight));
- SE3<> se3CfromW = mpTracker->GetCurrentPose();
+ SE3<> se3CfromW = mpTracker->GetCurrentPose();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMultMatrix(mpCamera->MakeUFBLinearFrustumMatrix(0.005, 100));
@@ -159,6 +106,16 @@ void ofxPTAM::beginAR() {
sCaption = mpTracker->GetMessageForUser();
ofSetWindowTitle(sCaption);
+ // test
+ GLdouble glm[16];
+ glm[0] = se3CfromW.get_rotation().get_matrix()[0][0]; glm[1] = se3CfromW.get_rotation().get_matrix()[1][0]; glm[2] = se3CfromW.get_rotation().get_matrix()[2][0]; glm[3] = 0;
+ glm[4] = se3CfromW.get_rotation().get_matrix()[0][1]; glm[5] = se3CfromW.get_rotation().get_matrix()[1][1]; glm[6] = se3CfromW.get_rotation().get_matrix()[2][1]; glm[7] = 0;
+ glm[8] = se3CfromW.get_rotation().get_matrix()[0][2]; glm[9] = se3CfromW.get_rotation().get_matrix()[1][2]; glm[10] = se3CfromW.get_rotation().get_matrix()[2][2]; glm[11] = 0;
+ glm[12] = 0; glm[13] = 0; glm[14] = 0; glm[15] = 1;
+ //cout << glm << endl;
+ //cout << se3CfromW.get_translation() << endl;
+ //cout << mpCamera->MakeUFBLinearFrustumMatrix(0.005, 100) << endl;
+
}
void ofxPTAM::endAR() {
glMatrixMode(GL_MODELVIEW);
@@ -192,6 +149,14 @@ screenCoord* ofxPTAM::getRndmTargetsPos() {
return sc;
}
+void ofxPTAM::resetMap() {
+ mpTracker->reset();
+}
+void ofxPTAM::startBuildMap() {
+ mpTracker->buildMapBegin();
+}
+
+
double ofxPTAM::mapScrnX(double val) {
double outVal = ((val - (0)) / (imgWidth - 0) * (1.0 - (-1.0)) + (-1.0));
@@ -206,5 +171,5 @@ double ofxPTAM::mapScrnY(double val) {
return -outVal;
}
-*/
+
View
93 src/ofxPTAM.h 100644 → 100755
@@ -9,6 +9,7 @@
#pragma once
+//#define USE_PTAM_VIDEOSRC
#define PTAM_SCALE 0.001
#ifdef USE_PTAM_VIDEOSRC
@@ -19,62 +20,68 @@
#include "cvd/byte.h"
#include <vector>
-#include "ofMain.h"
class ofxATANCamera;
class Map;
class MapMaker;
class ofxTracker;
+
+// we cannot import ofMain.h because of TooN's operator override error.
+// so cannot use core OF.
+// if anyone know workarround, please tell me.
+
struct screenCoord {
-public:
- double x;
- double y;
- double z;
- int level;
+ public:
+ double x;
+ double y;
+ double z;
+ int level;
};
class ofxPTAM {
-public:
- void init(int imgW, int imgH);
- void update(ofPixelsRef _pixelsRef);
- void draw();
-
- void startBuildMap();
- void resetMap();
- bool isMapBuild() const { return bMapBuildComplete; };
+
+ private:
- // TODOS
- // - use the ofxFaceTracking intarfaces
- ofVec2f getPosition() const;
- float getScale() const;
- ofVec3f getOrientation() const;
- ofMatrix4x4 getRotationMatrix() const;
-
- /*
- // Let´s keep the things clean for the moment
- void beginAR();
- void endAR();
-
- screenCoord* getCurrentCamPos(int zDepth);
- screenCoord* getRndmTargetsPos();
-
- double mapScrnX(double val);
- double mapScrnY(double val);*/
-
-private:
- //CVD::Image<CVD::Rgb<CVD::byte> > mimFrameRGB; // No usfull for the moment
- CVD::Image<CVD::byte> mimFrameBW;
+ #ifdef USE_PTAM_VIDEOSRC
+ VideoSource mVideoSource;
+ #endif
+ CVD::Image<CVD::Rgb<CVD::byte> > mimFrameRGB;
+ CVD::Image<CVD::byte> mimFrameBW;
- Map *mpMap;
- MapMaker *mpMapMaker;
- ofxTracker *mpTracker;
- ofxATANCamera *mpCamera;
+ Map *mpMap;
+ MapMaker *mpMapMaker;
+ ofxTracker *mpTracker;
+ ofxATANCamera *mpCamera;
+
+ int imgWidth;
+ int imgHeight;
+
+ public:
+
+ void initPTAM(int imgW, int imgH);
+ void updatePTAM(unsigned char *pixels = 0);
+
+ #ifdef USE_PTAM_VIDEOSRC
+ void drawImg();
+ #endif
+ void drawTrail();
+
+ void beginAR();
+ void endAR();
+
+ screenCoord* getCurrentCamPos(int zDepth);
+ screenCoord* getRndmTargetsPos();
- int imgWidth;
- int imgHeight;
-
- bool bMapBuildComplete;
+ void startBuildMap();
+ void resetMap();
+
+ bool bMapBuildComplete;
+
+ double mapScrnX(double val);
+ double mapScrnY(double val);
+
+
};
View
8 src/ofxTracker.cpp 100644 → 100755
@@ -14,6 +14,10 @@
using namespace CVD;
+void ofxTracker::reset() {
+ Reset();
+}
+
void ofxTracker::buildMapBegin() {
mbUserPressedSpacebar = true;
}
@@ -71,7 +75,5 @@ void ofxTracker::drawTrail() {
}
}
-void ofxTracker::drawGrid() {
- RenderGrid();
-}
+
View
20 src/ofxTracker.h 100644 → 100755
@@ -13,15 +13,17 @@
class ofxTracker : public Tracker {
-public:
+
+ public:
- ofxTracker(CVD::ImageRef irVideoSize, const ATANCamera &c, Map &m, MapMaker &mm) : Tracker(irVideoSize, c, m, mm){ };
+ ofxTracker(CVD::ImageRef irVideoSize, const ATANCamera &c, Map &m, MapMaker &mm)
+ : Tracker(irVideoSize, c, m, mm)
+ {
+ }
- void reset(){ Reset(); };
- void buildMapBegin();
-
- void drawTrail();
- void drawGrid();
-
- vector<int> trail;
+ void reset();
+ void buildMapBegin();
+ void drawTrail();
+
+ vector<int> trail;
};
Please sign in to comment.
Something went wrong with that request. Please try again.