如何获取手势 ID 并链接到数组中的图像
无论如何,是否可以从使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有趣的是,如何执行此类操作的完整示例位于 Android SDK 的示例目录中。
Funny thing is that the complete example of how to do this kind of things is inside the samples directory of your Android SDK.
如果为每个手势创建单独的手势库,则可以将每个库放入一个数组中。该手势库数组可以通过其索引与图像数组进行匹配。选择图片时,请确保已加载相应的手势库。
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.