EnoxSoftware / MarkerLessARExample

This asset is a Marker-Less Augmented Reality Example using the actual environment as input instead of printed square markers and display 3d model in WebCamTexture in real-time.
https://assetstore.unity.com/packages/templates/tutorials/markerless-ar-example-77560
25 stars 5 forks source link

Set marker as texture no camera #6

Open pablopalma opened 5 years ago

pablopalma commented 5 years ago

Hello!

I need set a custom image marker texture but without a camera capture. (i.e: vuforia) It's possible make this? there's some way o example?

Cheers.

EnoxSoftware commented 5 years ago

It is possible to load Texture2D preset in the Inspector as a pattern image by changing the code as follows.

https://github.com/EnoxSoftware/MarkerLessARExample/blob/master/Assets/MarkerLessARExample/WebCamTextureMarkerLessARExample/WebCamTextureMarkerLessARExample.cs#L165-L197

        /// <summary>
        /// The pattern texture.
        /// </summary>
        public Texture2D patternTexture;

        void Start ()
        {

----------------

         Mat patternMat = new Mat (patternTexture.height, patternTexture.width, CvType.CV_8UC4);

         Utils.texture2DToMat (patternTexture, patternMat);
         Debug.Log ("patternMat dst ToString " + patternMat.ToString ());

         pattern = new Pattern ();
         patternTrackingInfo = new PatternTrackingInfo ();

         patternDetector = new PatternDetector (null, null, null, true);

         patternDetector.buildPatternFromImage (patternMat, pattern);
         patternDetector.train (pattern);

          #if UNITY_ANDROID && !UNITY_EDITOR
          // Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2).
          webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true;
          #endif
          webCamTextureToMatHelper.Initialize ();

--------------

         }
pablopalma commented 5 years ago

Thanks a lot! I'm very happy with this library, i'll check this and then i'll mark as resolved the issue.

pablopalma commented 5 years ago

this works for WebGL?

pablopalma commented 5 years ago

This issue can be resolved (i don't see the option) i did another issue referred to this: https://github.com/EnoxSoftware/MarkerLessARExample/issues/8

pablopalma commented 4 years ago

There's some way to change the confidentiality of the matches? If i use a texture of a brand that it's a wine bottle label. If i focus a printed paper the matches works fine, but if i focus the bottle label, this doesn't work.