/**
  * Set the data for this info board.
  *
  * @param recognizedArtwork the recognized artwork information
  * @param placement         initial info board placement
  * @param artwork           data artwork for this info board
  * @param middlePoint       middle point of the recognized artwork
  */
 public void SetData(RecognizedArtwork recognizedArtwork, InfoBoardPlacement placement, Artwork artwork, Vector3 middlePoint)
 {
     this.anchorManager     = WorldAnchorManager.Instance;
     this.logger            = DebugLogger.Instance;
     this.infoCanvas        = InfoCanvas.Instance;
     this.arrows            = UIArrows.Instance;
     this.recognizedArtwork = recognizedArtwork;
     this.currentPlacement  = placement;
     this.artwork           = artwork;
     this.middlePoint       = middlePoint;
     StartCoroutine(Initialize());
 }
        /**
         * Use this for initialization.
         */
        private void Start()
        {
            // Variable initialization
            this.ReadyToStartRecognition     = false;
            this.initFinished                = false;
            this.dataLoadingFinished         = false;
            this.objectRecognitionConfigured = false;
            this.openMenu = false;

            // Get reference to other scripts in the scene
            this.dataLoader        = DataLoader.Instance;
            this.config            = IPConfig.Instance;
            this.objectRecognition = ObjectRecognition.Instance;
            this.infoCanvas        = InfoCanvas.Instance;

            // Check references
            if ((this.dataLoader == null) || (this.config == null) || (this.objectRecognition == null) || (this.text == null) ||
                (this.cursor == null) || (this.mainMenu == null) || (this.infoCanvas == null))
            {
                Debug.Log("Initializer: Script references not set properly.");
                this.enabled = false;
            }
        }
Exemple #3
0
        /**
         * Use this for initialization.
         */
        private void Start()
        {
            // Variable initialization
            this.ObjectRecognitionConfigured = false;
            this.CurrentScanState            = ScanState.None;
#if ENABLE_WINMD_SUPPORT
            this.newCameraMatrices = false;
            this.worldAnchors      = new bool[this.artworkLimit]; // initialized with false
#endif
            this.artworks                     = new Dictionary <int, Artwork>();
            this.artists                      = new Dictionary <int, Artist>();
            this.videos                       = new Dictionary <int, Video>();
            this.audio                        = new Dictionary <int, Audio>();
            this.worldAnchorsLoaded           = false;
            this.newRoom                      = true;
            this.newData                      = false;
            this.recognitions                 = new Dictionary <int, Recognition>();
            this.instantiatedArtworks         = new Dictionary <int, GameObject>();
            this.recognizedArtworks           = new bool[this.artworkLimit]; // initialized with false
            this.fmModelOperations            = new Queue <FmModelOperationInfo>();
            this.isPerformingFmModelOperation = false;

            // Get reference to other scripts in the scene
            this.logger        = DebugLogger.Instance;
            this.dataLoader    = DataLoader.Instance;
            this.initializer   = Initializer.Instance;
            this.capture       = CaptureManager.IsInitialized ? CaptureManager.Instance.PhotoCapture : null;
            this.infoCanvas    = InfoCanvas.Instance;
            this.anchorManager = HoloToolkit.Unity.WorldAnchorManager.Instance;

            // Deactivate this script if necessary components are missing
            if ((this.scanningArea == null) || (this.artwork == null) || (this.debugPhoto == null) || (this.logger == null) || (this.initializer == null) ||
                (this.dataLoader == null) || (this.capture == null) || (this.infoCanvas == null) || (this.anchorManager == null))
            {
                Debug.LogError("ObjectRecognition: Script references not set properly.");
                this.enabled = false;
                return;
            }

            // Get the current camera resolution
            this.cameraResolution = this.capture.CameraResolution;
            this.logger.Log("Set new camera resolution: " + this.cameraResolution.width + " x " + this.cameraResolution.height);

#if ENABLE_WINMD_SUPPORT
            // Create a configuration object for Companion
            this.configuration = new CW.Configuration();

            // Configure image recognition
            CW.FeatureMatching feature        = new CW.FeatureMatching(CW.FeatureDetector.BRISK, CW.DescriptorMatcherType.BRUTEFORCE_HAMMING);
            CW.LSH             lsh            = new CW.LSH();
            CW.ShapeDetection  shapeDetection = new CW.ShapeDetection();

            // Configure image processing
            this.matchRecognition  = new CW.MatchRecognition(feature, CW.Scaling.SCALE_960x540);
            this.hashRecognition   = new CW.HashRecognition(shapeDetection, lsh);
            this.hybridRecognition = new CW.HybridRecognition(this.hashRecognition, feature, 70);

            // Set callback methods
            this.configuration.setResultCallback(this.ResultCallback, CW.ColorFormat.RGB);
            this.configuration.setErrorCallback(this.ErrorCallback);

            // Set number of frames to skip
            this.configuration.setSkipFrame(0);

            // Set image buffer
            this.configuration.setImageBuffer(1);

            // Add source to configuaration
            CW.ImageStream stream = new CW.ImageStream(1);
            this.configuration.setSource(stream);
#endif
        }