2011-06-07 4 views
9

मैं एंड्रॉइड के लिए नया हूं और मैं Gestures पर काम कर रहा हूं। मुझे पाठ को पहचानने के तरीके के बारे में एक समस्या है। जब कोई उपयोगकर्ता एक पत्र या संख्या खींचता है जिसे पहचानना होता है और उसे स्क्रीन के शीर्ष पर मुद्रित किया जाना होता है। मुझे पता चला कि यह GestureOverlayView के माध्यम से किया जा सकता है लेकिन यह नहीं पता कि इसे कैसे कार्यान्वित किया जाए।एंड्रॉइड में इशारा पहचान

क्या कोई मुझे कुछ नमूना कोड के साथ मदद कर सकता है।

उत्तर

3

आप इन दो लिंक सहायक होगा सकता है जो

GestureOverlay

GestureOverlayView

उपयोग इस

public class YourClass extends Activity implements OnGesturePerformedListener { 
    private GestureLibrary mLibrary; 
mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures); 
if (!mLibrary.load()) {  
    finish(); 
    }  
GestureOverlayView gestures = (GestureOverlayView)findViewById(R.id.gestures); 
    gestures.addOnGesturePerformedListener(this); 
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) { 
    ArrayList<Prediction> predictions = mLibrary.recognize(gesture); 
    Log.v("performed","performed"); 
    // We want at least one prediction 
    if (predictions.size() > 0) {  
    Prediction prediction = predictions.get(0); 
     // We want at least some confidence in the result 
     if (prediction.score > 1.0) {   
       if(prediction.name.equalsIgnorecase("right")){  
         //do you thing here//  
       }