Start a new topic

Implementing CustomCamera sample

Implementing CustomCamera sample


Hi, I'm trying to implement CustomCamera in my app in Android. I looked at the sample code and the documentation and I did these thing. I copied WikitudeCamera,WikitudeCamera2 to my project and also the plugin folder without zxing folder(since I wasn't using barcode or QR code). I then added the event codes of CustomCameraActivity.java including onInputPluginInitialized, onInputPluginPaused, onInputPluginResumed, onInputPluginDestroyed and getPlanePixelPointer and isCameraLandscape functions to the end of my code and also added the  function declarations of initNative,notifyNewCameraFrame, ... , setImageSensorRotation to the end of my code. I also added these lines at the end of my onCreate method :

this.architectView.registerNativePlugins("wikitudePlugins","customcamera");
initNative();


 

When I try to run it I get an exception and application quits with error of : Registration of plugins in library 'wikitudePlugins' was canceled. Wrong lifecycle state detected. and also I get "No implementation found for com.....initNative()"
There are some parts of implementing this sample that I don't get, for example the plugin codes of the samlpe can be found in another folder called SDKPluginExample but I couldn't find any part of the code to reference that or I don't get how the code is supposed to find wikitudePlugins or cusomcamera

I'll appreciate if you can help me with this.
Thanks

Hi m0j1 42420,

 

the SDKPluginExample project contains the plugin implementations for the Wikitude Plugin API samples. Compiling this project yields a shared object that is loaded when the sample application is run. If you want to use our custom camera plugin directly, you will have to add this shared object to your application as well. Ideally you would compile only the custom camera plugin and remove the other ones in the corresponding make file SDKPluginsExample/jni/Android.mk.

The precompiled shared objects can be found in SDKExamples/wikitude-sdk-samples/src/main/jniLibs/<architecture>/libwikitudePlugins.so.

The shared objects are included by the build.gradle file of in SDKExamples/wikitude-sdk-samples/build.gradle.

 

Hope this helps

Daniel

 

Thanks Daniel,
Is there any similar effect in Unity plugin?

Thanks very much

Hi, 

The Unity plugin doesn't support input plugins yet, but here is a quick port of the effect. Simply import the attached package in your project and add the ScanEffectRenderer script to the WikitudeCamera and it should work.

Best regards,
Alexandru

Thanks very much Alexandru
Unfortunately I get this error trying to import the package : "Failed to import package with error: Couldn't decompress package"

 

Hi, 

I don't know why the package got corrupted when I attached it here. Please try this dropbox link instead.

Best regards,
Alexandru

Thanks very much Alexandru

Worked like charm!
Login or Signup to post a comment