Start a new topic

How to capture a high resolution image in Wikitude xamarin crossplatform ?

Hi,


I am using the instant tracking...I am trying to capture the high resolution...


In Native iOS using Xcode I have achieved that using plugin and simple camera...

Where All tracking was in low resolution and only still camera capture was in high resolution....


How can I achieve the same in xamarin crossplatform ? I am able to register plugin and able to get camera frame available method called ?.....I set the resolution as high in architect view 

                startupConfiguration.setCameraResolution(CameraSettings.CameraResolution.High);


Now My question is how can I make scanning work in low resolution but capture in high resolution ?       is there any javascript method to capture image in high resolution ?


Hi Pritam,


do i understand it correctly that you already implemented the low resolution preview and high resolution capture with the Native SDK?


If this is the case you should be able to do basically the same thing in Xamarin with a input plugin.


Best Regards,

Alex

Hi Thanks for your reply...


Actually the xamrin plugin on camera frame available seems give low resolution image..As the scanning is running in low resolution ?


In  iOS native I used camera plugin and use CaptureStillOutput API to get high resolution image...


In iOS the on  method

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection  


 The  sampleBuffer was always the AVCaptureSessionPreset640x480 but 


As I used the API 


 imageOutput = [AVCaptureStillImageOutput new];

[imageOutput setOutputSettings:outputSettings];

 imageOutput.highResolutionStillImageOutputEnabled = true;


Where I got the image capture in high resolution...does it possible in android plugin also


Thanks,


Pritam


Hi Pritam,


this is possible in Android with and InputPlugin too. 

You should take a look at the camera2 sample from google as it uses different resolutions for preview and capture.


Best Regards,

Alex

Hi,


Thanks for your reply...


I have looked at it but it will work in only android native ?



  

 public class Plugin : Com.Wikitude.Common.Plugins.Plugin
 {

 public Plugin(string p0) : base(p0)
 {
 System.Diagnostics.Debug.WriteLine("Intialize availabe");
 }
 Frame currentFrame = null;
 public override void CameraFrameAvailable(Frame p0)
 {
 try
 {
 System.Diagnostics.Debug.WriteLine("Frame availabe");
 var data = p0.GetData();
 currentFrame = p0;
 ConvertYuvToJpg(currentFrame);
 }
 catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine("Exception"); }
 }

 public override void Update(RecognizedTarget[] p0)
 {
 System.Diagnostics.Debug.WriteLine("Frame availabe");
 if (p0 != null)
 {
 if (currentFrame != null)
 {
 // ConvertYuvToJpeg(currentFrame, p0[0]);
 }
 }
 }
 protected override void Initialize()
 {
 base.Initialize();
 }
 protected override void Pause()
 {
 base.Pause();
 }
 protected override void Resume(long p0)
 {
 base.Resume(p0);
 }
 protected override void Destroy()
 {
 base.Destroy();
 }
 } 

  

 architectView.Load(worldUrl);
 Plugin cardPlugin = new Plugin("com.plugin.dpiar");
 architectView.RegisterPlugin(cardPlugin);


This plugin is working fine....but the crossplatform api does not provide any api to control it...


public override void CameraFrameAvailable(Frame p0)
 {
 try
 {
 System.Diagnostics.Debug.WriteLine("Frame availabe");
 var data = p0.GetData();
 currentFrame = p0;
 ConvertYuvToJpg(currentFrame);
 }
 catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine("Exception"); }
 }


The above method is working I am getting frame here...but How can I control the camera in the plugin to capture the still image.....I have been through the native android code where we can get the camera object


Thanks,


Pritam


Hi Pritam, 


what you will need is a c++ InputPlugin where you will have to make your own camera implementation and pass the frame data into the Wikitude SDK.

You can take a look at how this can be done in the Native SDK examples app. 

The files you can use as reference are SimpleInputPlugin.h/cpp and SimpleInputPluginActivity.java.


Please note that we also do not officially support the Plugins API on Xamarin.


Best Regards,

Alex

Login or Signup to post a comment