- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Guys,
I am creating a program in Java for my Bachelor Thesis,
Scenario: Its an Image viewer controller by Gestures (Swipe right and left for next and prev.)
The images are saved in an array m.
Problem: When i use swipe gesture once, it repeates the action 2-4 times, so it skips some images.
Its the same situation when i add println("swiping left"), then i shows "swiping left" repeated in the console.
What should i change to make the Program work more stable (for example "one order per 2 seconds")?
Part of the Code:
if (sts.compareTo(pxcmStatus.PXCM_STATUS_NO_ERROR) >= 0) { senseManager.Init(); //initialize if no error for (int nframes = 0; nframes < 3000; nframes++) { 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.IHand hand = new PXCMHandData.IHand(); sts = handData.QueryHandData(PXCMHandData.AccessOrderType.ACCESS_ORDER_BY_TIME,0,hand); //getting the 4 gestures if (handData.IsGestureFired("swipe_left", gestureData)) { System.out.println("swipe left!!"); if(i==0) { JOptionPane.showMessageDialog(null,"This is first Image"); } else{ i=i-1; //previous image in the array m l.setIcon(m); } } else if (handData.IsGestureFired("swipe_right", gestureData)) { System.out.println("swipe right!!"); if(i==m.length-1) { JOptionPane.showMessageDialog(null,"This is Last Image"); } else { i=i+1; //next image in the array m l.setIcon(m); } } else if (handData.IsGestureFired("thumb_up", gestureData)) { System.out.println("thumb up!!"); } else if (handData.IsGestureFired("thumb_down", gestureData)) { System.out.println("thumb down!!"); } senseManager.ReleaseFrame(); } } handData.close(); senseManager.close();
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can detect the gestureData.state to avoid this issue. You can either use GESTURE_STATE_START or GESTURE_STATE_END.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello David, thanx for your comment. i was searching for an example about GESTURE_STATE_START and as always, no examples in java...
could you please where should i put GESTURE_STATE_START in the code?
first i defined it like this: GestureStateType state = GestureStateType.GESTURE_STATE_START;
where should i put what to make it work as wished?
thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
David Lu (Intel) wrote:
You can detect the gestureData.state to avoid this issue. You can either use GESTURE_STATE_START or GESTURE_STATE_END.
gesture.Data.state equals null the whole time, thats what i saw in debugging
what does that mean and how correct it?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page