public static I3DOverlay bindTo_I3DOverlay(IComponentIntrospect component) { global::System.IntPtr cPtr = solarPINVOKE.bindTo_I3DOverlay(IComponentIntrospect.getCPtr(component)); I3DOverlay ret = (cPtr == global::System.IntPtr.Zero) ? null : new I3DOverlay(cPtr, true); if (solarPINVOKE.SWIGPendingException.Pending) { throw solarPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
protected override void OnEnable() { base.OnEnable(); xpcfComponentManager = xpcf_api.getComponentManagerInstance(); Disposable.Create(xpcfComponentManager.clear).AddTo(subscriptions); xpcfComponentManager.AddTo(subscriptions); #if !UN conf.path = File.ReadAllText("confPath.txt"); #endif if (xpcfComponentManager.load(conf.path) != XPCFErrorCode._SUCCESS) { Debug.LogErrorFormat("Failed to load the configuration file {0}", conf.path); enabled = false; return; } switch (mode) { case PIPELINE.Fiducial: pipeline = new FiducialPipeline(xpcfComponentManager).AddTo(subscriptions); break; case PIPELINE.Natural: pipeline = new NaturalPipeline(xpcfComponentManager).AddTo(subscriptions); break; case PIPELINE.SLAM: pipeline = new SlamPipeline(xpcfComponentManager).AddTo(subscriptions); break; } overlay3D = xpcfComponentManager.Create("SolAR3DOverlayOpencv").BindTo <I3DOverlay>().AddTo(subscriptions); switch (source) { case SOURCE.SolAR: camera = xpcfComponentManager.Create("SolARCameraOpencv").BindTo <ICamera>().AddTo(subscriptions); var intrinsic = camera.getIntrinsicsParameters(); var distorsion = camera.getDistorsionParameters(); var resolution = camera.getResolution(); pipeline.SetCameraParameters(intrinsic, distorsion); overlay3D.setCameraParameters(intrinsic, distorsion); OnCalibrate?.Invoke(resolution, intrinsic, distorsion); if (camera.start() != FrameworkReturnCode._SUCCESS) { LOG_ERROR("Camera cannot start"); enabled = false; } break; case SOURCE.Unity: webcam = new WebCamTexture(); webcam.Play(); if (!webcam.isPlaying) { LOG_ERROR("Camera cannot start"); enabled = false; } break; } switch (display) { case DISPLAY.SolAR: // Set the size of the box to display according to the marker size in world unit var overlay3D_sizeProp = overlay3D.BindTo <IConfigurable>().getProperty("size"); var size = pipeline.GetMarkerSize(); overlay3D_sizeProp.setFloatingValue(size.width, 0); overlay3D_sizeProp.setFloatingValue(size.height, 1); overlay3D_sizeProp.setFloatingValue(size.height / 2.0f, 2); imageViewer = xpcfComponentManager.Create("SolARImageViewerOpencv").AddTo(subscriptions).BindTo <IImageViewer>().AddTo(subscriptions); break; case DISPLAY.Unity: break; } start = clock(); inputImage = SharedPtr.Alloc <Image>().AddTo(subscriptions); pose = new Transform3Df().AddTo(subscriptions); }