简体   繁体   English

Android上的增强现实

[英]Augmented reality on android

I've just started to develop a project as face detection in the base of augmented reality on android phone. 我刚刚开始在Android手机的增强现实基础上开发一个作为面部检测的项目。 And am new to AR(augmented reality) as so far I contributed and evaluated algorithms for facial determinants but I don't have any idea regarding AR and wanna implement AR in my project So could you experts kindly tell me, where to start and and do I need any additional tools to create AR application( /do I've to add any plugins on IDE(eclipse))? 到目前为止,AR(增强现实)技术还很陌生,我为面部决定因素做出了贡献并评估了算法,但是我对AR没有任何想法,也不想在我的项目中实现AR。我是否需要其他工具来创建AR应用程序(/是否必须在IDE(eclipse)上添加任何插件)? or is there is any other IDE works better than eclipse for AR? 还是有其他IDE比eclipse更适合AR? please check the below link and give your comments because my projects is completely seems as given link below, 请检查下面的链接并提供您的评论,因为我的项目完全像下面的链接所示,

http://www.readwriteweb.com/archives/recognizr_facial_recognition_coming_to_android_phones.php http://www.readwriteweb.com/archives/recognizr_facial_recognition_coming_to_android_phones.php

http://www.blackweb20.com/2010/03/01/recognizr-facial-recognition-on-android/#.TzNswE7xodM http://www.blackweb20.com/2010/03/01/recognizr-facial-recognition-on-android/#.TzNswE7xodM

thank you! 谢谢!

AR implementation itself is easy. AR的实现本身很容易。 It is basically just an overlay over preview picture, and you can put whatever you like on this overlay. 它基本上只是预览图片的叠加层,您可以在叠加层上放置任意内容。 One working example is contained in this project: 该项目包含一个工作示例:

http://sourceforge.net/projects/javaocr/ http://sourceforge.net/projects/javaocr/

( there are countles others ) (还有其他国家)

Tricky parts starts from here. 棘手的部分从这里开始。 For face recognition one typically uses Haar transformation, and there are implementations in OpenCV (and also countles others) - but it is questionable if you can it performant enough in android java code, to be really usefull ( you wil have to do it in native code ). 对于人脸识别,通常使用Haar变换,并且在OpenCV中有实现(还有其他实现)-但是是否可以在android java代码中实现足够的性能以使其真正有用是个问题(您必须在本机中执行代码)。 And this is only face recognition - it says you - "hey dude, here is the face. maybe" - not identification. 这只是人脸识别-它说-“嘿,伙计,这是人脸。也许是”,而不是身份识别。

As for IDE, I prefer IntelliJ IDEA as it is just better java ide (somebody will lynch me right now for it ;) ), and it has better android support. 至于IDE,我更喜欢IntelliJ IDEA,因为它是更好的Java ide(现在有人会私自为我私刑;)),并且它具有更好的android支持。 But this is commercial product (free comminity edition is available for free, and individual license is not that expensive) 但这是商业产品(免费的商品版可免费获得,个人许可证并不贵)

you can try this code: 您可以尝试以下代码:

    public class FaceDetectionActivity extends Activity 
   {
     /** Called when the activity is first created. */
    @Override
     public void onCreate(Bundle savedInstanceState) 
     {
       super.onCreate(savedInstanceState);
    //setContentView(R.layout.main);
    setContentView(new MyView(this));
   }

private class MyView extends View
{
    private Bitmap myBitmap;
    private int width, height;
    private FaceDetector.Face[] detectedFaces;
    private int NUMBER_OF_FACES=4;
    private FaceDetector faceDetector;
    private int NUMBER_OF_FACE_DETECTED;
    private float eyeDistance;

    public MyView(Context context) 
    {
        super(context);
        BitmapFactory.Options bitmapFatoryOptions=new BitmapFactory.Options();
        bitmapFatoryOptions.inPreferredConfig=Bitmap.Config.RGB_565;
        myBitmap=BitmapFactory.decodeResource(getResources(), R.drawable.faces,bitmapFatoryOptions);
        width=myBitmap.getWidth();
        height=myBitmap.getHeight();
        detectedFaces=new FaceDetector.Face[NUMBER_OF_FACES];
        faceDetector=new FaceDetector(width,height,NUMBER_OF_FACES);
        NUMBER_OF_FACE_DETECTED=faceDetector.findFaces(myBitmap, detectedFaces);
    }

    @Override
    protected void onDraw(Canvas canvas)
    {
        canvas.drawBitmap(myBitmap, 0,0, null);
        Paint myPaint = new Paint();
        myPaint.setColor(Color.GREEN);
        myPaint.setStyle(Paint.Style.STROKE); 
        myPaint.setStrokeWidth(3);

        for(int count=0;count<NUMBER_OF_FACE_DETECTED;count++)
        {
            Face face=detectedFaces[count];
            PointF midPoint=new PointF();
            face.getMidPoint(midPoint);

            eyeDistance=face.eyesDistance();
            canvas.drawRect(midPoint.x-eyeDistance, midPoint.y-eyeDistance, midPoint.x+eyeDistance, midPoint.y+eyeDistance, myPaint);
        }
    }

 }
}

this code will detects the face from Bitmap so you should implement this technique also through camera cheers . 此代码将从Bitmap中检测到面部,因此您也应该通过相机欢呼来实现此技术。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM