@@ -106,7 +106,7 @@ void ofApp::setup(){
106
106
intrinsicGuiGroup.setName (" Corrections" );
107
107
intrinsicGuiGroup.add (depthCorrectionBase.set (" base" , 1.0 , 0.9 , 1.1 ));
108
108
intrinsicGuiGroup.add (depthCorrectionDivisor.set (" divisor" , 100000 , 90000 , 110000 ));
109
- intrinsicGuiGroup.add (pixelSizeCorrector.set (" pixl factor" , 1.0 , 0.9 , 1.1 ));
109
+ intrinsicGuiGroup.add (pixelSizeCorrector.set (" pixl factor" , 1.0 , 0.9 , 1.2 ));
110
110
deviceCalib->addGroup (intrinsicGuiGroup);
111
111
112
112
deviceCalib->loadFromFile (kinectSerialID + " .xml" );
@@ -674,6 +674,17 @@ void ofApp::updatePointCloud(ofVboMesh & mesh, int step, bool useFrustumCone, bo
674
674
float sensorFieldTop = blobFinder.sensorBoxTop .get ();
675
675
float sensorFieldBottom = blobFinder.sensorBoxBottom .get ();
676
676
677
+ float centerH = (sensorFieldLeft + sensorFieldRight) / 2.0 ;
678
+ float centerK = (sensorFieldFront + sensorFieldBack) / 2.0 ;
679
+ float radiusX = (sensorFieldRight - sensorFieldLeft) / 2.0 ;
680
+ float radiusY = (sensorFieldBack - sensorFieldFront) / 2.0 ;
681
+
682
+ radiusX = radiusX * radiusX;
683
+ radiusY = radiusY * radiusY;
684
+
685
+ // https://math.stackexchange.com/questions/76457/check-if-a-point-is-within-an-ellipse#76463
686
+ // (x−h)^2/rx^2+(y−k)^2/ry^2≤1.
687
+
677
688
for (int y = 0 ; y < h; y += step) {
678
689
for (int x = 0 ; x < w; x += step) {
679
690
vertex.z = 0 ;
@@ -690,13 +701,9 @@ void ofApp::updatePointCloud(ofVboMesh & mesh, int step, bool useFrustumCone, bo
690
701
}
691
702
if (vertex.z != 0 ){
692
703
if (sensorFieldLeft < vertex.x && vertex.x < sensorFieldRight &&
693
- sensorFieldFront < vertex.y && vertex.y < sensorFieldBack &&
694
- sensorFieldBottom < vertex.z && vertex.z < sensorFieldTop){
695
- mesh.addColor ((vertex.z - sensorFieldBottom) / (sensorFieldTop - sensorFieldBottom));
696
- } else if (sensorFieldLeft < vertex.x && vertex.x < sensorFieldRight &&
697
- sensorFieldFront < vertex.y && vertex.y < sensorFieldBack &&
698
- sensorFieldBottom < vertex.z && vertex.z < sensorFieldTop){
699
- mesh.addColor ((vertex.z - sensorFieldBottom) / (sensorFieldTop - sensorFieldBottom));
704
+ sensorFieldFront < vertex.y && vertex.y < sensorFieldBack &&
705
+ sensorFieldBottom < vertex.z && vertex.z < sensorFieldTop){
706
+ mesh.addColor ((vertex.z - sensorFieldBottom) / (sensorFieldTop - sensorFieldBottom));
700
707
} else {
701
708
if (useVideoColor)
702
709
mesh.addColor (kinect.getColorAt (x,y));
0 commit comments