基于SnapDragonBoard410C的手势识别
2017-12-26 14:58
393 查看
目前在物联网的领域里有许多的交互手段,例如语音交互,手势交互,手柄交互。今天我们就来了解下啥是手势交互!措辞有点糙,请大家见谅。
First:we should download a SDK package from internet.it’s called Touch3D
接下来主要是是向大家介绍这个SDK 是如何集成到我们的应用当中去。
在oncreat中我们先把mTouchlessA3DWrapper对象先实例化。
PoseView是我们自定的view用于显示手势识别成功后显示相应的图片。
CameraWrapper这个类当中主要是封装我们一些操作Camera的一些方法和数据回调。
TouchlessA3DWrapper这个类主要是封装了一些手势识别的操作!
First:we should download a SDK package from internet.it’s called Touch3D
接下来主要是是向大家介绍这个SDK 是如何集成到我们的应用当中去。
mCameraEventListener = new CameraEventListener(); mImageRotationListener = new RotationListener(); // Create camera wrapper to handle camera functionality mCameraWrapper = new CameraWrapper(); // Create touchless wrapper to handle gesture functionality mTouchlessA3DWrapper = new TouchlessA3DWrapper(new TouchlessEventListener()); // Create helper for managing camera image rotation. mImageRotationHelper = new ImageRotationHelper(this);
在oncreat中我们先把mTouchlessA3DWrapper对象先实例化。
private class TouchlessEventListener implements TouchlessA3DWrapper.TouchlessEventListener { @Override public void openHandFound() { // Dispatch UI updates to UI thread runOnUiThread(new Runnable() { @Override public void run() { mPoseView.showOpenHand(); } }); } @Override public void closedHandFound() { // Dispatch UI updates to UI thread runOnUiThread(new Runnable() { @Override public void run() { mPoseView.showClosedHand(); } }); } @Override public void pinchFound() { // Dispatch UI updates to UI thread runOnUiThread(new Runnable() { @Override public void run() { mPoseView.showPinch(); } }); } @Override public void thumbsUpFound() { // Dispatch UI updates to UI thread runOnUiThread(new Runnable() { @Override public void run() { mPoseView.showThumbsUp(); } }); } @Override public void poseLost() { // Dispatch UI updates to UI thread runOnUiThread(new Runnable() { @Override public void run() { mPoseView.hideHand(); } }); } @Override public void onError(final Exception e) { Log.e(LOG_TAG, "TouchlessEventListener.onError: ", e); // Dispatch event to main queue to update UI runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(TouchlessWorldActivity.this, "Error reported from touchless engine. See logs for more info.", Toast.LENGTH_LONG).show(); } }); } }
PoseView是我们自定的view用于显示手势识别成功后显示相应的图片。
CameraWrapper这个类当中主要是封装我们一些操作Camera的一些方法和数据回调。
private class ImageAvailableListener implements ImageReader.OnImageAvailableListener { @Override public void onImageAvailable(ImageReader imageReader) { Image image = imageReader.acquireLatestImage(); if (image != null) { int imageWidth = image.getWidth(); int imageHeight = image.getHeight(); //Get Y-plane of the YUV_420_888 image. Image.Plane yPlane = image.getPlanes()[0]; //Copy plane to a new byte array, skipping row stride. byte[] bytes = copyPlaneDataToPackedByteArray(yPlane, imageWidth, imageHeight); //Convert timestamp to milliseconds. long timestampMilliseconds = (long)(image.getTimestamp() / 1e6f); if(mCameraEventListener != null) { mCameraEventListener.onFrame(bytes, image.getWidth(), image.getHeight(), timestampMilliseconds);//回调数据给Activity! } // Return image to image reader for reuse. image.close(); } } private byte[] copyPlaneDataToPackedByteArray(Image.Plane yPlane, int imageWidth, int imageHeight) { // Create destination buffer byte[] bytes = new byte[imageWidth * imageHeight]; ByteBuffer buffer = yPlane.getBuffer(); int strideSkip = yPlane.getRowStride() - imageWidth; // For every row of destination image for (int row = 0; buffer.hasRemaining(); row += imageWidth) { // Copy bytes to destination buffer.get(bytes, row, imageWidth); // On last row we mus make sure we have room for the stride skip if(buffer.hasRemaining()) { // Skip stride buffer.position(buffer.position() + strideSkip); } } return bytes; } }
TouchlessA3DWrapper这个类主要是封装了一些手势识别的操作!
相关文章推荐
- 基于SnapDragonBoard410C文字识别
- 基于opencv的手势识别
- kinect+ogre骨架追踪及手势识别(基于微软kinectSDK)
- 基于Dragon Board410c 的智能机器人预研-语音识别及定位
- 基于SnapDragonBoard410c的单例设计模式
- 基于Opencv的手势识别(QT 多线程)
- 基于C++的Kinect手势识别实现
- 基于SnapDragonBoard410c的远程防盗系统 (三)
- 基于声波的手势识别技术
- 基于手势识别的PPT控制
- 基于SnapDragonBoard410c源码编译问题
- 基于SnapDragonBoard410c的智能小车(一)
- 基于Aforge的手势识别之一~~~简单的手写识别
- 基于一次手势训练的kinect 3D 动态手势识别(提纲)
- 基于无线信号的手势识别研究现状调查
- 基于Aforge的手势识别之一~~~简单的手写识别
- 基于Aforge的手势识别之一~~~简单的手写识别
- 基于Kinect的手势识别的相关资讯
- 基于Visual C++2010与windows SDK fo windows7开发Windows 7的多点触摸特性应用程序(2)--手势识别应用
- Java 基于手势的几何图形识别