GithubHelp home page GithubHelp logo

halfdanj / ofxarcore Goto Github PK

View Code? Open in Web Editor NEW
181.0 18.0 28.0 6.66 MB

Experimental addon for openFrameworks to use ARCore on Android devices

License: Apache License 2.0

Makefile 9.73% C++ 67.45% Java 22.82%
arcore openframeworks

ofxarcore's Introduction

ofxARCore

Experimental addon for openFrameworks to use ARCore on Android devices.

preview

About

This openFrameworks addon implements some of the basic features from the ARCore API to be used in openFrameworks. This addon is not feature complete yet. Currently it only supports the basic camera tracking, rendering the camera image, besides basic anchor support. Even though its not feature complete, it should give a good starting point to work with AR in openFrameworks.

This is not an official Google product.

Developer guide

To use the addon, you need the development branch of openFrameworks from github. Follow the Android Studio guide to learn how to get started with openFrameworks and Android.

To add the addon, add ofxARCore to addons.make in your project, or through the project generator. Additionally you will need to add the following two lines to the end of settings.gradle of your project:

To see basic usage of the addon, see the example code

Examples

Shows how to use the addon in the most basic way, just rendering a grid centered around origin.

A simple demo that lets you draw in the air.

The app calculates the world coordinates from touch events on the screen, and draws a continuous white line through the air. Read more on AR Experiments site.

There is also a never version ported to Java available here: github.com/googlecreativelab/ar-drawing-java

ofxarcore's People

Contributors

danzeeeman avatar halfdanj avatar irealva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxarcore's Issues

ofxAndroidCheckPermission(CAMERA) and ofxAndroidRequestPermission(CAMERA)

Thanks for putting this addon together, I'm so close I can almost taste it.

I've installed and built oF on OSX using Irene Alvarado's excellent guide and using your openframeworks repo. After some gradle issues I've managed to build/make the project. On trying to run it to my phone however I get an error:

Error:(66, 33) error: use of undeclared identifier 'CAMERA'

and also I don't believe it recognises the ofxAndroid functions:

Error:(66, 5) error: use of undeclared identifier 'ofxAndroidRequestPermission'
Error:(68, 8) error: use of undeclared identifier 'ofxAndroidCheckPermission'

edit:These functions appear to be in the ofxAndroid addon which I assumed was included when I chose android studio as the platform in the OSX project generator. Is it possible that is isn't? The addon (ofxAndroid) doesn't appear as an option in the project generator dropdown and I assumed this was because it was included by default. If not, how do I include it?

edit2: I resolved this. The functions appear to have been deprecated and replaced with

ofxAndroidRequestCameraPermission
ofxAndroidCheckCameraPermission

respectively. Previously they took an argument (CAMERA) and don't anymore. Unfortunately the app immediately crashes after requesting permission on my pixel. I have the arcore-preview apk installed and can run the example 'stickers' app that ships with the pixel camera. Should I open a new issue about the crashing?

edit3: the crashing is due to an update in the arcore libs. The current preview apk referenced from arcore docs is version2. the previous version (Compatible) with Dan's addon is here.

I cannot build the app using the code

Hello,

Really appreciate that you wrote this code and shared with people.

I have been trying the last couple of days but unfortunately I still havent been able to create this drawing app.

Any chance youd provide an APK file so we can try it?

update ndk / gradle in the "android-camera-permissions" OF branch?

hi! just trying to setup things using this excellent guide:

https://medium.com/@ire_alva/getting-started-with-openframeworks-on-android-5202b92f6582

and your readme -- it seems like android-camera-permissions is a bit behind -- the ndk-verify.gradle refers to 12:

if(!ndkProperties.getProperty("Pkg.Revision").startsWith("12.1")) {
    throw new GradleException("Wrong version of NDK library found. Found version " + ndkProperties.getProperty("Pkg.Revision") +
            ", but openFrameworks requires version r12b")
}

but I think (not sure!) it needs to be updated to 15 (as Irene's tutorial / github master) refers to..

Update to ARCore 1.0

Code needs to be updated to ARCore 1.0. It seems like there is no longer a aar file that can be downloaded, but its now instead done with gradle depenencies. But adding the tag

allprojects {
repositories {
    google()
        ...

wont play well with gradle-experimental.

It seems its the same for both c++ and java implementation.

Any ideas @danzeeeman ?

weird bug on close / reopen

this is a little strange, I'm still debugging it but thought I'd mention it here. if you load an image after arCore.setup() arcore seems to freeze when you close and reopen the app. You don't even need to draw the image, just load it after arcore.setup(). If you load it before setup it's ok.

I think it's texture related, this is what I see in the console :

W/GLConsumer: [SurfaceTexture-1-32421-1] bindTextureImage: clearing GL error: 0x502
E/Adreno-UNKNOWN: glEGLImageTargetTexture2DOES:468: GL_INVALID_OPERATION
glEGLImageTargetTexture2DOES:468: GL_INVALID_OPERATION
E/GLConsumer: [SurfaceTexture-1-32421-1] bindTextureImage: error binding external image: 0x502
E/native: session.cc:493 generic::failed_precondition: VIO is not tracking.

perhaps it has to do with the order where objects are fixing their texture reloading? or something about OES vs there texture types. I'll poke around some more. I should add I'm using @boehm-e's branch so I'm not 100% sure this effects all version but I'll try to test. To recreate, simply load an image in setup() of the exampleBasic

void ofApp::setup(){
    arcore.setup();
    initialized = false;
    img.load("a.png");
    ofBackground(0);
    ofSetOrientation(OF_ORIENTATION_DEFAULT, false);
}

Could not read Script

I can't seem to compile the file, I get following error:

ERROR: Could not read script 'F:\Android\libs\openFrameworksCompiled\project\android\common-functions.gradle' as it does not exist.

It is referenced in the settings.gradle file here:

// Load common functions apply from: ofRoot+"libs/openFrameworksCompiled/project/android/common-functions.gradle"

crashing on launch

pixel 2 xl phone - running android 8.1
installed arcore: adb install -r -d arcore-preview2.apk

adb shell 'pm list packages -f' | grep tango
package:/system/app/TangoCore/TangoCore.apk=com.google.tango

when app launches:

02-13 04:37:42.560 7953-7953/? E/Tango: Java version of Tango Service not found, falling back to tangoservice_d.
02-13 04:37:42.560 7953-7953/? E/zygote: No implementation found for int com.google.atap.tango.TangoJNINative.Initialize(android.content.Context) (tried Java_com_google_atap_tango_TangoJNINative_Initialize and Java_com_google_atap_tango_TangoJNINative_Initialize__Landroid_content_Context_2)
02-13 04:37:42.560 7953-7953/? D/AndroidRuntime: Shutting down VM
02-13 04:37:42.562 7953-7953/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: cc.openframeworks.arcoreexample, PID: 7953
                                                 java.lang.UnsatisfiedLinkError: No implementation found for int com.google.atap.tango.TangoJNINative.Initialize(android.content.Context) (tried Java_com_google_atap_tango_TangoJNINative_Initialize and Java_com_google_atap_tango_TangoJNINative_Initialize__Landroid_content_Context_2)
                                                     at com.google.atap.tango.TangoJNINative.Initialize(Native Method)
                                                     at com.google.atap.tangoservice.Tango.<init>(Tango.java:385)
                                                     at com.google.ar.core.TangoWrapper.createInstance(TangoWrapper.java:32)
                                                     at com.google.ar.core.Session.bindTangoService(Session.java:425)
                                                     at com.google.ar.core.Session.resume(Session.java:153)
                                                     at cc.ofxarcorelib.ofxARCoreLib$1.run(ofxARCoreLib.java:77)
                                                     at android.os.Handler.handleCallback(Handler.java:790)
                                                     at android.os.Handler.dispatchMessage(Handler.java:99)
                                                     at android.os.Looper.loop(Looper.java:164)
                                                     at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

is this a arcore mismatch or something else?

error: unreported exception UnavailableArcoreNotInstalledException

Hi there, I'm trying to build the exampleBasic on a Google Pixel (Android 8.0.0) and I receive the following errors:

  • error: unreported exception UnavailableArcoreNotInstalledException; must be caught or declared to be thrown
  • error: unreported exception CameraNotAvailableException; must be caught or declared to be thrown

I've successfully followed the oF in Android tutorial, and followed all the instructions in this repo's README.md. I realized that UnavailableArcoreNotInstalledException is thrown when the ARCore APK is not installed on this device link, so I tried the Sceneform example for Android (to check if ARCore was installed) and it worked.

The error is thrown under ofcARCoreLib, so I'm not quite sure if it's a problem on the library or in my system. I'd be thankful if anyone can help.

My setup is:

  • macOS Sierra 10.12.6
  • Android Studio 3.3.2
  • oF 0.10.1 android
  • Andoid 8.0.0 (device)

Screen Shot 2019-04-02 at 11 09 04 AM 1

Help with building examples

Hey, great work your doing here. Especially with the short time span from the release.

Running macOS 10.12.16
OF git stable - 0.9.8

I have a lot of android studio errors, specifically having problems with the gradle versioning.
I seem to get a make error 2 from android studio, and I see that the trouble shooting would want to switch out the version from the ofxAndroid, but it still doesnt work.
Any guidance you can give about this?

This device does not support AR Galaxy S7

I am trying to run exampleBasic on Samsung Galaxy S7, Android 7.0, Android Studio 3.0.1 from Mac OSX 10.9.5. I have tried it with Tango Core - v 1.57 (arcore-preview.apk), ARCore - v 0.91.171204143 (arcore-preview2.apk) and ARCore - v 1.0.180129153 (from Play Store). In all three cases, when I launch the apk, my phone spits out the message in the title. Is this related to issue #13? I have built hello_ar_java from arcore-android-sdk and it seems to work fine. Other android example projects from OF seem to work fine too. I am using OF described in the main page (https://github.com/halfdanj/openframeworks/tree/android-camera-permissions).

Could there be some compatibility issues that I am not aware of? Below is the log file
logcat.txt

PS: in order to build the project I had to add #include "ofMain.h" in ofxARCore.h. As well as change CAMERA to OFX_ANDROID_PERMISSION_CAMERA in ofxARCore.cpp on line 152 since CAMERA was an undeclared identifier.

question pull request

Hi @HalfdanJ,

I hope all goes well, first of all, thank you very much for this.
much appreciated!

to be able to compile the examples, i had to implement some exceptions on Session,
this is the situation on my fork:
L87-L95
L119-L123
L141
L227-L231

I'm going to implement PointCloud and Plane in the coming days,
has sense to push a pull request?

good day!

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.