Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to control IR sensor intensity #433

Closed
piedar opened this issue Jan 12, 2015 · 8 comments
Closed

Add ability to control IR sensor intensity #433

piedar opened this issue Jan 12, 2015 · 8 comments
Milestone

Comments

@piedar
Copy link
Contributor

piedar commented Jan 12, 2015

Add a function like

freenect_set_ir_brightness(uint8_t brightness);

and implement it by sending a control command with parameter 0x0015.

Requested by @zhumxcq

@piedar piedar added this to the v0.5.3 milestone Jan 12, 2015
@piedar piedar mentioned this issue Jan 12, 2015
@zhumxcq
Copy link

zhumxcq commented Jan 23, 2015

Patch information

From 4e1603beb63d3117e22b2f3e8905da0ef5924213 Mon Sep 17 00:00:00 2001
From: Meng Xi Zhu zhumxcq@gmail.com
Date: Mon, 12 Jan 2015 20:17:04 -0500
Subject: [PATCH 1/2] Added function to change IR brightness

---
 include/libfreenect.h |  2 ++
 src/cameras.c         | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/libfreenect.h b/include/libfreenect.h
index edc3898..b8e7e21 100644
--- a/include/libfreenect.h
+++ b/include/libfreenect.h
@@ -688,6 +688,8 @@ FREENECTAPI void freenect_set_fw_address_nui(freenect_context * ctx, unsigned ch
  */
 FREENECTAPI void freenect_set_fw_address_k4w(freenect_context * ctx, unsigned char * fw_ptr, unsigned int num_bytes);

+FREENECTAPI void freenect_change_ir_brightness(freenect_device *dev, uint16_t brightness);
+

 #ifdef __cplusplus
 }
diff --git a/src/cameras.c b/src/cameras.c
index 12eaba2..1c5dde1 100644
--- a/src/cameras.c
+++ b/src/cameras.c
@@ -1243,6 +1243,7 @@ int freenect_set_video_buffer(freenect_device *dev, void *buf)
 FN_INTERNAL int freenect_camera_init(freenect_device *dev)
 {
    freenect_context *ctx = dev->parent;
+
    int res;
    res = freenect_fetch_reg_pad_info(dev);
    if (res < 0) {
@@ -1285,3 +1286,12 @@ FN_INTERNAL int freenect_camera_teardown(freenect_device *dev)
    freenect_destroy_registration(&(dev->registration));
    return 0;
 }
+
+void freenect_change_ir_brightness(freenect_device *dev, uint16_t brightness){
+   if(dev){
+       int res = write_register(dev, 0x15, brightness);
+       if(res!=0){
+           //FN_ERROR("freenect_change_ir_brightness(): Failed to change IR brightness\n");
+       }
+   }
+}
-- 
1.9.1


From 806be4e0ee4f7174ea77943baf39caca52f80f9c Mon Sep 17 00:00:00 2001
From: Meng Xi Zhu <zhumxcq@gmail.com>
Date: Mon, 12 Jan 2015 20:22:03 -0500
Subject: [PATCH 2/2] added comment for header function

---
 include/libfreenect.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/libfreenect.h b/include/libfreenect.h
index 0e93a4b..f504ffc 100644
--- a/include/libfreenect.h
+++ b/include/libfreenect.h
@@ -689,6 +689,11 @@ FREENECTAPI void freenect_set_fw_address_nui(freenect_context * ctx, unsigned ch
  */
 FREENECTAPI void freenect_set_fw_address_k4w(freenect_context * ctx, unsigned char * fw_ptr, unsigned int num_bytes);

+/**
+ * Allows the user to specify the brightness of the IR image
+ *
+ * @param brightness value between 0 (lowest brightness) - 50 (highest brightness)
+ */
 FREENECTAPI void freenect_change_ir_brightness(freenect_device *dev, uint16_t brightness);

1.9.1

@floe
Copy link
Contributor

floe commented Feb 11, 2015

Could you please send this as a pull request on Github?

@zhumxcq
Copy link

zhumxcq commented Feb 11, 2015

Not sure how to do that exactly...

@floe
Copy link
Contributor

floe commented Feb 11, 2015

@zhumxcq First, you have to create your own fork of libfreenect on github. For the rest, there's a good tutorial available here: https://help.github.com/articles/creating-a-pull-request/

@piedar
Copy link
Contributor Author

piedar commented Feb 11, 2015

I was going to merge it manually, but I have been lazy...

@piedar piedar closed this as completed in b6c2eb3 Feb 11, 2015
@piedar
Copy link
Contributor Author

piedar commented Feb 11, 2015

Brightness must be in the range 1 - 50.

@piedar piedar modified the milestones: v0.6.0, v0.5.3 Feb 12, 2015
piedar added a commit that referenced this issue Feb 13, 2015
Signed-off-by: Benn Snyder <benn.snyder@gmail.com>
yarikoptic added a commit to yarikoptic/libfreenect that referenced this issue Feb 14, 2015
* commit 'v0.5.2-2-g68073c3':
  Return int from freenect_get_ir_brightness() - fixes OpenKinect#433
  Add ability to control IR projector brightness - fixes OpenKinect#433
  Update CMakeLists.txt for v0.5.2
  Let CMake find OpenGL/GLUT automatically
  python: Fix version detection python: Use list comprehension so setup.py runs on python3 - fixes OpenKinect#429
  examples: Do not require all dependencies; skip building examples with missing dependencies win32: Compiles as pure C
  win32: Fix c_sync build
  win32: Fix compiler errors
  Add freenect-camtest example for headless testing - fixes OpenKinect#428
  Update README.md
  Fix compiler warning by anonymizing enum; touch up indentation
  Negotiate maximum USB packet length
  fixed environment variable for Darwin
  OpenNI2-FreenectDriver: Expose USB VID/PID to OpenNI - fixes OpenKinect#422
  Add support for near mode (K4W only)
  Adds zbuffer to the mapping of rgb to depth
  clear rgb pixels without depth data for map_rgb_to_depth
  add freenect_map_rgb_to_depth helper function (untested)
yarikoptic added a commit to yarikoptic/libfreenect that referenced this issue Feb 14, 2015
* dfsg:
  Return int from freenect_get_ir_brightness() - fixes OpenKinect#433
  Add ability to control IR projector brightness - fixes OpenKinect#433
  Update CMakeLists.txt for v0.5.2
  Let CMake find OpenGL/GLUT automatically
  python: Fix version detection python: Use list comprehension so setup.py runs on python3 - fixes OpenKinect#429
  examples: Do not require all dependencies; skip building examples with missing dependencies win32: Compiles as pure C
  win32: Fix c_sync build
  win32: Fix compiler errors
  Add freenect-camtest example for headless testing - fixes OpenKinect#428
  Update README.md
  Fix compiler warning by anonymizing enum; touch up indentation
  Negotiate maximum USB packet length
  fixed environment variable for Darwin
  OpenNI2-FreenectDriver: Expose USB VID/PID to OpenNI - fixes OpenKinect#422
  Add support for near mode (K4W only)
  Adds zbuffer to the mapping of rgb to depth
  clear rgb pixels without depth data for map_rgb_to_depth
  add freenect_map_rgb_to_depth helper function (untested)
@piedar piedar modified the milestones: v0.5.3, v0.6.0 Jul 14, 2015
@piedar
Copy link
Contributor Author

piedar commented Oct 16, 2015

Needs documentation update.

@piedar piedar reopened this Oct 16, 2015
@piedar
Copy link
Contributor Author

piedar commented Oct 18, 2015

Updated documentation in ad5b98d.

@piedar piedar closed this as completed Oct 18, 2015
@piedar piedar changed the title Add ability to control IR projector intensity Add ability to control IR sensor intensity Oct 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants