public void Upload() { using (var buffer = easyar.Buffer.wrapByteArray(capturedImage.GetRawTextureData())) using (var image = new easyar.Image(buffer, PixelFormat.RGB888, capturedImage.width, capturedImage.height)) { mapSession.Save(mapName, withPreview ? image : null); } StartUploadUI(); StartCoroutine(SavingStatus()); StartCoroutine(Saving()); }
void Start() { #if USE_EASYAR imageTargetController.TargetLoad += (loadedTarget, result) => { easyar.Image targetImage = ((loadedTarget as ImageTarget).images())[0]; float targetWidth = (float)targetImage.width(); float targetHeight = (float)targetImage.height(); float targetScale = (targetHeight / targetWidth); cube = CreateCubeForEasyARTarget(this.gameObject, targetScale); }; #endif }
public IEnumerator Upload() { yield return(StartCoroutine(Snapshot())); mapSession.MapWorker.enabled = false; mapName = "Map_" + DateTime.Now.ToString("yyyy-MM-dd_HHmmss"); using (var buffer = easyar.Buffer.wrapByteArray(capturedImage.GetRawTextureData())) using (var image = new easyar.Image(buffer, PixelFormat.RGB888, capturedImage.width, capturedImage.height)) { mapSession.Save(mapName, withPreview ? image : null); } //mapSession.Save(mapName, null); //StartCoroutine(SavingStatus()); StartCoroutine(Saving()); }
private void CreateMultipleTargetsFromOneImage(easyar.Image image, int count, string name, float scale) { for (int i = 0; i < count; i++) { using (var param = new ImageTargetParameters()) { param.setImage(image); param.setName(name); param.setScale(scale); param.setUid(Guid.NewGuid().ToString()); param.setMeta(string.Empty); var targetOptional = ImageTarget.createFromParameters(param); if (targetOptional.OnSome) { var target = targetOptional.Value; GameObject Target = new GameObject(name + " <" + i + ">"); var controller = Target.AddComponent <ImageTargetController>(); AddTargetControllerEvents(controller); controller.SourceType = ImageTargetController.DataSource.Target; controller.TargetSource = target; controller.Tracker = ImageTracker; if (Cube) { var cube = Instantiate(Cube); cube.transform.parent = controller.transform; } } else { throw new Exception("invalid parameter"); } } } }