Commit 706e6a61 by wester

test

parent 9f572c13
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -71,7 +71,7 @@ std::vector<glm::vec3> controllerPositions; ...@@ -71,7 +71,7 @@ std::vector<glm::vec3> controllerPositions;
bool toggleCam = false; bool toggleCam = true;
Camera mainCam; Camera mainCam;
static bool trackControllerPos = true; static bool trackControllerPos = true;
...@@ -83,18 +83,19 @@ int lastX, lastY; ...@@ -83,18 +83,19 @@ int lastX, lastY;
//Filter Settings //Filter Settings
float minTrackingKinect = 0.2f;//0.8f; float minTrackingKinect = 0.3f;//0.8f;
float maxTrackingKinect = 1.0f;// 2.5f; float maxTrackingKinect = 0.9f;// 2.5f;
//Custom //Custom
//float angleDegrees = 20.0f; //float angleDegrees = 20.0f;
float maxNormalAngle = degreeToRadian(25.0f); float maxNormalAngle = degreeToRadian(25.0f);
bool enableDepthFilter = false; bool enableDepthFilter = false;
bool enableNormalFilter = false;//true; bool enableNormalFilter = true;//true;
//Bilateral / FastDepthNoise //Bilateral / FastDepthNoise
bool enableFastDepthNoiseFilter = true; bool enableFastDepthNoiseFilter = true;
float repairThreshold = 100.0f; float repairThreshold = 100.0f;
bool captureFramesTXT = true;
...@@ -389,14 +390,14 @@ void processCurrentFrameForExport() { ...@@ -389,14 +390,14 @@ void processCurrentFrameForExport() {
float maxx, maxy, maxz; float maxx, maxy, maxz;
maxx = maxy = maxz = -std::numeric_limits<float>::max(); maxx = maxy = maxz = -std::numeric_limits<float>::max();
bool captureFramesTXT = false;
std::ofstream myfile; std::ofstream myfile;
if (captureFramesTXT) { if (captureFramesTXT) {
char buffer[64]; // make sure it's big enough char buffer[64]; // make sure it's big enough
snprintf(buffer, sizeof(buffer), "frames/pnts_%d.txt", counter++); snprintf(buffer, sizeof(buffer), "frames/pnts_%d.txt", counter++);
myfile.open(buffer, std::ios::out | std::ios::binary); myfile.open(buffer, std::ios::out);
} }
glm::mat4x4 temp = glm::inverse(*currentTrackerPos);
for (unsigned int i = 0; i < width*height; i++) { for (unsigned int i = 0; i < width*height; i++) {
if (frameValidPoints[i]) { if (frameValidPoints[i]) {
glm::vec3 position = framePositions[i]; glm::vec3 position = framePositions[i];
...@@ -404,8 +405,6 @@ void processCurrentFrameForExport() { ...@@ -404,8 +405,6 @@ void processCurrentFrameForExport() {
if (isinf(position.x) || isinf(position.y) || isinf(position.z)) if (isinf(position.x) || isinf(position.y) || isinf(position.z))
continue; continue;
if (position.x < minx) minx = position.x; if (position.x < minx) minx = position.x;
if (position.x > maxx) maxx = position.x; if (position.x > maxx) maxx = position.x;
...@@ -418,8 +417,10 @@ void processCurrentFrameForExport() { ...@@ -418,8 +417,10 @@ void processCurrentFrameForExport() {
colors.push_back(frameColors[i * 3]); colors.push_back(frameColors[i * 3]);
colors.push_back(frameColors[i * 3 + 1]); colors.push_back(frameColors[i * 3 + 1]);
colors.push_back(frameColors[i * 3 + 2]); colors.push_back(frameColors[i * 3 + 2]);
if (captureFramesTXT) { if (captureFramesTXT) {
myfile << positionGlobal.x << " " << positionGlobal.y << " " << positionGlobal.z << " " glm::vec3 tempvec = glm::vec3(temp* glm::vec4(positionGlobal, 1.0f));
myfile << tempvec.x << " " << tempvec.y << " " << tempvec.z << " "
<< (int)frameColors[i * 3] << " " << (int)frameColors[i * 3 + 1] << " " << (int)frameColors[i * 3 + 2] << std::endl; << (int)frameColors[i * 3] << " " << (int)frameColors[i * 3 + 1] << " " << (int)frameColors[i * 3 + 2] << std::endl;
} }
...@@ -451,26 +452,25 @@ void writePointCloud() { ...@@ -451,26 +452,25 @@ void writePointCloud() {
return; return;
} }
if (!currentTrackerPos) currentTrackerPos = steamTracking->getTransformationForDevice(trackerID, 0.0f);
currentTrackerPos = new glm::mat4x4(glm::rotate(*steamTracking->getTransformationForDevice(trackerID, 0.0f), degreeToRadian(-00), glm::vec3(1.0f, 0.0f, 0.0f))); currentTrackerPos = new glm::mat4x4(glm::rotate(*currentTrackerPos, degreeToRadian(-90), glm::vec3(1.0f, 0.0f, 0.0f)));
std::vector<glm::vec3> exportpoints; std::vector<glm::vec3> exportpoints;
exportpoints.reserve(points.size()); exportpoints.reserve(points.size());
for (size_t i = 0; i < points.size(); i++) { for (size_t i = 0; i < points.size(); i++) {
exportpoints.push_back(glm::vec3(glm::rotate(glm::inverse(*currentTrackerPos), degreeToRadian(00), glm::vec3(1.0f, 0.0f, 0.0f)) * glm::vec4(points[i], 1.0f))); exportpoints.push_back(glm::inverse(*currentTrackerPos) * glm::vec4(points[i], 1.0f));
} }
//exportpoints.clear(); //exportpoints.clear();
/*
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
exportpoints.push_back(glm::vec3(i/1000.0f, 0.0f, 0.0f)); exportpoints.push_back(glm::vec3(i/1000.0f, 0.0f, 0.0f));
exportpoints.push_back(glm::vec3(0.0f, i / 1000.0f, 0.0f)); exportpoints.push_back(glm::vec3(0.0f, i / 1000.0f, 0.0f));
exportpoints.push_back(glm::vec3(0.0f, i / 2000.0f, 1.0f)); //exportpoints.push_back(glm::vec3(0.0f, i / 2000.0f, 1.0f));
exportpoints.push_back(glm::vec3(0.0f, 0.0f, i / 1000.0f)); exportpoints.push_back(glm::vec3(0.0f, 0.0f, i / 1000.0f));
} }*/
pntsHeader header; pntsHeader header;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment