Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/c/test_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ int main(int arg, char** args) {

fprintf(stderr, "Trying to init PSMoveTracker...");
PSMoveTracker* tracker = psmove_tracker_new();
if (!tracker)
{
fprintf(stderr, "Could not init PSMoveTracker.\n");
return 1;
}
psmove_tracker_set_mirror(tracker, PSMove_True);
fprintf(stderr, "OK\n");

Expand Down
2 changes: 1 addition & 1 deletion external/PS3EYEDriver
Submodule PS3EYEDriver updated 6 files
+2 −0 sdl/main.cpp
+4 −0 sdl/makefile
+17 −7 src/ps3eye.cpp
+11 −2 src/ps3eye.h
+92 −0 src/ps3eyedriver.cpp
+30 −0 src/ps3eyedriver.h
21 changes: 18 additions & 3 deletions src/tracker/platform/camera_control_macosx.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
**/

#include "../camera_control.h"

#include "../camera_control_private.h"
#include "psmove_osxsupport.h"

void
Expand All @@ -44,8 +44,23 @@ camera_control_set_parameters(CameraControl* cc,
int contrast, int brightness)
{
#if defined(CAMERA_CONTROL_USE_PS3EYE_DRIVER)
// TODO: Implement setting those parameters on cc->eye
psmove_WARNING("Unimplemented: Setting of PS3EYEDriver parameters\n");
//autoE... setAutoExposure not defined in ps3eye.h
ps3eye_set_parameter(cc->eye, PS3EYE_AUTO_GAIN, autoG > 0);
ps3eye_set_parameter(cc->eye, PS3EYE_AUTO_WHITEBALANCE, autoWB > 0);
ps3eye_set_parameter(cc->eye, PS3EYE_EXPOSURE, round((511 * exposure) / 0xFFFF));
ps3eye_set_parameter(cc->eye, PS3EYE_GAIN, round((79 * gain) / 0xFFFF));
//ps3eye_set_parameter(cc->eye, PS3EYE_REDBALANCE, round((255 * wbRed) / 0xFFFF));
//wbGreen... setGreenBalance not defined in ps3eye.h
//ps3eye_set_parameter(cc->eye, PS3EYE_BLUEBALANCE, round((255 * wbBlue) / 0xFFFF));
//ps3eye_set_parameter(cc->eye, PS3EYE_CONTRAST, contrast); // Transform unknown.
//ps3eye_set_parameter(cc->eye, PS3EYE_BRIGHTNESS, brightness); // Transform unknown.

/** The following parameters could be set but are not passed into this function:
* ps3eye_set_parameter(cc->eye, PS3EYE_SHARPNESS, ??);
* ps3eye_set_parameter(cc->eye, PS3EYE_HUE, ??);
* ps3eye_set_parameter(cc->eye, PS3EYE_HFLIP, ??);
* ps3eye_set_parameter(cc->eye, PS3EYE_VFLIP, ??);
**/
#else
macosx_camera_set_exposure_lock(1);
#endif
Expand Down
18 changes: 18 additions & 0 deletions src/tracker/platform/camera_control_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,24 @@ void camera_control_set_parameters(CameraControl* cc, int autoE, int autoG, int
cvReleaseCapture(&cc->capture);
}

//autoE... setAutoExposure not defined in ps3eye.h
ps3eye_set_parameter(cc->eye, PS3EYE_AUTO_GAIN, autoG > 0);
ps3eye_set_parameter(cc->eye, PS3EYE_AUTO_WHITEBALANCE, autoWB > 0);
ps3eye_set_parameter(cc->eye, PS3EYE_EXPOSURE, round((511 * exposure) / 0xFFFF));
ps3eye_set_parameter(cc->eye, PS3EYE_GAIN, round((79 * gain) / 0xFFFF));
//ps3eye_set_parameter(cc->eye, PS3EYE_REDBALANCE, round((255 * wbRed) / 0xFFFF));
//wbGreen... setGreenBalance not defined in ps3eye.h
//ps3eye_set_parameter(cc->eye, PS3EYE_BLUEBALANCE, round((255 * wbBlue) / 0xFFFF));
//ps3eye_set_parameter(cc->eye, PS3EYE_CONTRAST, contrast); // Transform unknown.
//ps3eye_set_parameter(cc->eye, PS3EYE_BRIGHTNESS, brightness); // Transform unknown.

/** The following parameters could be set but are not passed into this function:
* ps3eye_set_parameter(cc->eye, PS3EYE_SHARPNESS, ??);
* ps3eye_set_parameter(cc->eye, PS3EYE_HUE, ??);
* ps3eye_set_parameter(cc->eye, PS3EYE_HFLIP, ??);
* ps3eye_set_parameter(cc->eye, PS3EYE_VFLIP, ??);
**/

int width, height;
get_metrics(&width, &height);

Expand Down
10 changes: 8 additions & 2 deletions src/tracker/psmove_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,17 @@ psmove_tracker_new_with_camera(int camera) {
#endif

// start the video capture device for tracking
tracker->cc = camera_control_new(camera);
tracker->cc = camera_control_new(camera); // Returns NULL if no control found.
// e.g. PS3EYE set during compile but not plugged in.
if (!tracker->cc)
{
free(tracker);
return NULL;
}

char *intrinsics_xml = psmove_util_get_file_path(INTRINSICS_XML);
char *distortion_xml = psmove_util_get_file_path(DISTORTION_XML);
camera_control_read_calibration(tracker->cc, intrinsics_xml, distortion_xml);
camera_control_read_calibration(tracker->cc, intrinsics_xml, distortion_xml);
free(intrinsics_xml);
free(distortion_xml);

Expand Down