如何获取手势 ID 并链接到数组中的图像

发布于 2024-10-21 19:34:37 字数 723 浏览 4 评论 0原文

无论如何,是否可以从使用gesturebuilder创建的手势库中获取手势ID列表,然后将它们链接到存储在数组中的图像。 这些图像用于添加到手势覆盖视图中,以便显示。

我想将每个手势链接到图像,因此需要某种 ID 或名称。我查看了示例和其他可用的手势在线材料,但没有关于此事的信息。

任何有关此事的帮助将不胜感激。

例子:

//将图像链接到手势 ID,因此当用户绘制“a”时, 
//它链接到手势“a”   
if (sStore.load())
{

      for (字符串名称: sStore.getGestureEntries())
    {  
       //将手势及其名称存储到Gesturegesture中
   for (手势: sStore.getGestures(name))
   {
      手势.getID();
          //将ID链接到image_array[i]

       }
    }
}


//在触摸事件之后匹配图像和手势。
if (预测.size() > 0)
{
 预测预测 = Predictions.get(0); 
 if(预测.score > 1.0) 
 {
        if(预测.best_score == Current_Image)
        {
            正确的();
            下一个_图像();
        }
    }
}

Is there anyway to get a list of gesture ids, from the gesture library that has been created using gesturebuilder, then link them to images that are stored in an array.
The images are used added to the gesture overlay view, so that be displayed.

I want to link each gesture to an images, so some sort of an id or name is needed. I have looked at the samples and other online material avaialbe for gestures, and there is no information on this matter.

Any help in this matter would be appreciated.

Example:

//Link the images to the gesture ids, so when a user draws an "a", 
//it is linked to the gesture "a"   
if (sStore.load())
{

      for (String name : sStore.getGestureEntries())
    {  
       //Stores the gesture and its name into Gesture gesture
   for (Gesture gesture : sStore.getGestures(name))
   {
      gesture.getID();
          //link IDs to image_array[i]

       }
    }
}


//match the image and the gesture, after a touch event.
if (predictions.size() > 0)
{
 Prediction prediction = predictions.get(0); 
 if(prediction.score > 1.0) 
 {
        if(prediction.best_score == Current_Image)
        {
            Correct();
            Next_image();
        }
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小霸王臭丫头 2024-10-28 19:34:37
GestureLibrary store = GestureLibraries.fromFile("/the/gesture/file");
if (store.load()){
    for (String name : store.getGestureEntries()){
        // access each gesture name/id
    }
}

有趣的是,如何执行此类操作的完整示例位于 Android SDK 的示例目录中。

GestureLibrary store = GestureLibraries.fromFile("/the/gesture/file");
if (store.load()){
    for (String name : store.getGestureEntries()){
        // access each gesture name/id
    }
}

Funny thing is that the complete example of how to do this kind of things is inside the samples directory of your Android SDK.

青丝拂面 2024-10-28 19:34:37

如果为每个手势创建单独的手势库,则可以将每个库放入一个数组中。该手势库数组可以通过其索引与图像数组进行匹配。选择图片时,请确保已加载相应的手势库。

If you create seperate gesture libraries for each gesture, then each library can be put into an array. This array of gestures libraries, can be matched by its index, with an array of images. When selecting an image, make sure that the corresponding gesture library is loaded.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文