Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

scaling parameter

  • Loading branch information...
commit 2218d9ab568fe937d6fcb8ef09c6c34a3640e0c9 1 parent 5e9653a
@badgeek authored
Showing with 28 additions and 6 deletions.
  1. +14 −3 fux_kinect.cpp
  2. +14 −3 kinect.pd
View
17 fux_kinect.cpp
@@ -171,16 +171,27 @@ void fux_kinect::depth_cb(freenect_device *dev, void *v_depth, uint32_t timestam
uint16_t *depth = (uint16_t*)v_depth;
pthread_mutex_lock(gl_backbuf_mutex);
-
+
+ int depth_range = kinect_max - kinect_min;
+
+
for (i=0; i<640*480; i++) {
//global_depth[i] = depth[i];
//depth_mid[i] = depth[i];
int pval;
- if(depth[i] > (float)kinect_min && depth[i] < (float)kinect_max )
+ if(depth[i] > (float)kinect_min)
{
- pval = ceil((1-(depth[i]/(float)kinect_max))*255.f);
+
+ if (depth[i] > (float)kinect_max)
+ {
+ pval = 0;
+ }else{
+ //depth[i] - kinect_max
+ pval = (1 - (depth[i] - (float)kinect_min)/(float)depth_range) * 255.f;//ceil((1-(depth[i]/(float)kinect_max))*255.f);
+ }
+
}else{
pval = 0;
}
View
17 kinect.pd
@@ -1,4 +1,4 @@
-#N canvas 833 136 450 300 10;
+#N canvas 903 209 450 300 10;
#X msg 36 18 create;
#X obj 49 39 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1
;
@@ -7,20 +7,31 @@
#X obj 240 91 fux_kinect;
#X obj 240 68 gemhead;
#X obj 240 113 pix_texture;
-#X obj 240 135 rectangle 4 3;
+#X obj 234 215 rectangle 4 3;
#X msg 98 15 dimen 800 600;
#X text 299 50 Elevation;
#X obj 49 152 loadbang;
#X msg 50 195 1;
#X msg 111 61 destroy;
+#X floatatom 264 25 5 0 0 0 - - -;
+#X floatatom 335 22 5 0 0 0 - - -;
+#X text 384 18 MIN;
+#X text 277 7 MAX;
+#X obj 246 162 scaleXYZ;
+#X floatatom 372 113 5 0 0 0 - - -;
#X connect 0 0 3 0;
#X connect 1 0 3 0;
#X connect 2 0 4 1;
#X connect 4 0 6 0;
#X connect 5 0 4 0;
-#X connect 6 0 7 0;
+#X connect 6 0 17 0;
#X connect 8 0 3 0;
#X connect 10 0 0 0;
#X connect 10 0 11 0;
#X connect 11 0 1 0;
#X connect 12 0 3 0;
+#X connect 13 0 4 2;
+#X connect 14 0 4 3;
+#X connect 17 0 7 0;
+#X connect 18 0 17 1;
+#X connect 18 0 17 2;
Please sign in to comment.
Something went wrong with that request. Please try again.