Community

Topic: Xamarin component

Camera not showing

Cesar Martinez
Wednesday, July 12, 2017

I followed the Getting Started tutorial for the Xamarin Component. I am working with an Android Project using Xamarin Native.

My OnCreate Method looks like this:

var _cameraFragment = FragmentManager.FindFragmentById(Resource.Id.pikkart_ar_fragment);
_cameraFragment.StartRecognition(new RecognitionOptions(RecognitionOptions.RecognitionStorage.Local, RecognitionOptions.RecognitionMode.ContinuousScan, new CloudRecognitionInfo(new string[] { })), this);

The app opens fine in a device with Android 6.0.1 (Nexus 7). The problem is when the app opens, the camera doesnt shows, all I can see is a blank screen. I tought with the code above I would be able to see at least the camera, or I have to do something else?

In the output of visualstudio I can see the following:

07-13 13:47:55.123 I/PikkartCore3_Native(30858): ARNativeWrapper:markerNotFound: ...
07-13 13:47:55.123 E/PikkartCore3_Native(30858): ARNativeWrapper:ImageProcessing: took 5 ms
07-13 13:47:55.168 E/PikkartCore3_Native(30858): ARNativeWrapper:ImageProcessing: took 13 ms
07-13 13:47:55.234 E/PikkartCore3_Native(30858): ARNativeWrapper:ImageProcessing: took 13 ms
07-13 13:47:55.262 I/PikkartCore3_Native(30858): ARNativeWrapper:markerNotFound: ...
... and it continuous with similar messages.

Cesar Martinez
Friday, July 14, 2017

I figured out that we need to render the elements to get them visible (the camera, for example).

Hope you give us a tutorial soon! :)

user profile image
Support Team  (expert)
Friday, July 14, 2017

Yes, to view the items you need to render them. You can try porting on Xamarin the Android tutorial at this link, or use a Xamarin rendering engine like Urho3d.
To develop your rendering engine you can use these three static methods of the RecognitionFragment:

- RecognitionFragment.getCurrentProjectionMatrix ()

- RecognitionFragment.getCurrentModelViewMatrix ()
- RecognitionFragment.isTracking ()
and
- public static void RecognitionFragment.renderCamera (int viewportWidth, int viewportHeight, int angle)
Best,

vishal
Friday, August 18, 2017

Can you provide sample code for rendering camera .I am new to Xamarin so no idea how to do it. I just want camera to be shown.

Sign in to add a comment