- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Guys, i am writing here for the 3rd time, i hope that someone will finally answer my question... The following java code is working, the hands are recognized BUT the gestures arent!! did i forget anything in the code? for any helpful hints i would be thankful!
public class handgecogni {
public static void main(String s[]) {
System.out.println("Starting hand tracker.");
PXCMSenseManager senseManager =PXCMSenseManager.CreateInstance();
senseManager.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR,640,480,30);
senseManager.EnableHand(null);
PXCMHandModule handModule = senseManager.QueryHand();
senseManager.Init();
PXCMHandData handData = handModule.CreateOutput();
PXCMHandConfiguration handConfig = handModule.CreateActiveConfiguration();
handConfig.DisableAllGestures();
// i want to make only thumbs up recognized
handConfig.EnableGesture("thumbs_up");
handConfig.EnableAllAlerts();
handConfig.ApplyChanges();
PXCMCaptureManager captureMgr = senseManager.QueryCaptureManager();
captureMgr.FilterByDeviceInfo("RealSense",null, 0);
pxcmStatus sts = senseManager.EnableHand(null);
sts = senseManager.Init();
handConfig.Update();
if (sts.compareTo(pxcmStatus.PXCM_STATUS_NO_ERROR) >= 0) {
senseManager.Init();
for (int nframes = 0; nframes < 3000; nframes++) {
// System.out.println("Frame # " + );
sts = senseManager.AcquireFrame(true);
if (sts.compareTo(pxcmStatus.PXCM_STATUS_NO_ERROR) < 0)
break;
while (senseManager.AcquireFrame(true).isSuccessful()) {
// Retrieve current hand tracking results
handData = handModule.CreateOutput();
handData.Update();
PXCMHandData.GestureData gestureData = new PXCMHandData.GestureData();
PXCMHandData.IHand hand = new PXCMHandData.IHand();
sts = handData.QueryHandData(PXCMHandData.AccessOrderType.ACCESS_ORDER_NEAR_TO_FAR,0, hand);
if (sts.compareTo(pxcmStatus.PXCM_STATUS_NO_ERROR) >= 0) {
PXCMPointF32 image = hand.QueryMassCenterImage();
PXCMPoint3DF32 world = hand.QueryMassCenterWorld();
boolean result = handData.IsGestureFired("thumbs_up", gestureData);
System.out.print(" Is Thumbs up : (" + result+ ")\n");
System.out.print(" Image Position: (" + image.x + ","+ image.y + ")");
System.out.println(" World Position: (" + world.x + ","+ world.y + "," + world.z + ")");
}
int ngestures = handData.QueryNumberOfHands();
System.out.println("# of hands is "+ ngestures);
senseManager.ReleaseFrame();
}
}
senseManager.close();
}
}
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Fadi,
Have you tried "thumb_up" instead of "thumbs_up"? There might be a typo here.
-Bryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bryan, thanx for your comment, i changed it but no difference. in consloe still showing: " Is Thumbs up : (false)" also when place my hand in front of the camera "thumb up"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to make sure, did you change it in both places?
handConfig.EnableGesture("thumbs_up");
.
.
.
boolean result = handData.IsGestureFired("thumbs_up", gestureData);
-Bryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
oops! i changed both now, it seems to work!! thaanks a alot , but its working a weird way, it shows one time true and 10 times false.
its not showing "true" one after the other.
any way i have made this boolean, to check if the gesture recognition is working.
the main purpose of my program is to enable "thumb_up" and "thumb_down" and "swipe"
i will try to make some changes sothat it shows those up written gestures in the console.
thank you again :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to hear it's moving forward! You may want to refer to para. 4.5.6 on page 1220 in sdkmanuals.pdf (C:\Program Files (x86)\Intel\RSSDK\doc\PDF) for the naming conventions used for the other gestures (e.g., "swipe_left", etc.)
-Bryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
now i got it, one last question, i wanted to show in the console the name of the gesture instead of true and false,
i used this System.out.print("Gesture is \n" +gestureData.name);
it didnt work and showed only "Gesture is" repeatedly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Bryan, i found it! i wrote this code and thumb up and down are working now,
PXCMHandData.GestureData gestureData = new PXCMHandData.GestureData();
if (handData.IsGestureFired("thumb_up", gestureData)) {
System.out.println("thumb up!!");
}
else if (handData.IsGestureFired("thumb_down", gestureData)) {
System.out.println("thumb down!!");
}
else if (handData.IsGestureFired("wave", gestureData)) {
System.out.println("wave!!");
}
for waving im going to use swipe_right and swipe_left because it didnt recognize it
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page