Git Product home page Git Product logo

finger-motion-tracking's Introduction

Finger Motion Tracking

An android app which detects a finger moving left to right or right to left while touching the back camera, and prints that direction on the screen.

Method

1. Capture live camera frame
2. Convert frame from RGBA to HSV
3. Apply two masks to capture red color band in the HSV frame, and do bitwise_or operation to combine them.
4. Divide the combined mask into 2 halves, left and right. Compute difference (left half - right half) of means of pixel intensity values and store them in memory.
5. For a sequence of frames, if the above computed difference moves from positive to negative, the direction is left-to-right. Else it's right-to-left.

Most of the above computation happens in the following 3 methods:

  1. onCameraFrame
  2. calculateDirectionGradient
  3. getDirectionGradient

References

https://stackoverflow.com/questions/35111559/capture-video-frames-with-opencv-in-android https://docs.opencv.org/3.4/db/df6/tutorial_erosion_dilatation.html https://stackoverflow.com/questions/32522989/opencv-better-detection-of-red-color https://docs.opencv.org/3.4/da/d97/tutorial_threshold_inRange.html https://blog.codeonion.com/2016/04/09/show-camera-on-android-app-using-opencv-for-android/ https://stackoverflow.com/questions/10660598/android-camera-preview-orientation-in-portrait-mode https://stackoverflow.com/questions/46015299/how-to-apply-mask-to-live-camera-in-android-opencv https://stackoverflow.com/questions/44413952/gradle-implementation-vs-api-configuration https://stackoverflow.com/questions/17165777/open-the-android-native-camera-using-opencv https://stackoverflow.com/questions/35753393/how-to-add-image-as-mask-in-camera-frame-android-opencv

Limitations

  • A direction label is always displayed once initialized, even when there is no motion
  • Sometimes, the direction label might be inaccurate when capturing extremely slow or extremely fast motion
  • Memory usage and garbage collection could be better

finger-motion-tracking's People

Contributors

anantmittal avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.