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

Pattern file image does not exist from webcam sample #12

Open SimonDarksideJ opened 1 year ago

SimonDarksideJ commented 1 year ago

In the following line for the Markerless webcam sample

https://github.com/EnoxSoftware/MarkerLessARExample/blob/1124537476ef9e219fe8041092823e70636864ad/Assets/MarkerLessARExample/WebCamTextureMarkerLessARExample/WebCamTextureMarkerLessARExample.cs#L155

The "patternImg.jpg" file does not exist in the project and thus is unable to be loaded and renders the sample unworkable.

patternMat = Imgcodecs.imread(Application.persistentDataPath + "/patternImg.jpg");

Can the sample be updated to be functional using the assets in the project?

It would also be preferable if:

SimonDarksideJ commented 1 year ago

*Note, not even the Android build that is published functions as it is unable to detect any of the images in this repository.

The Readme on the front page should be updated with usage instructions and expectations for the sample.

SimonDarksideJ commented 1 year ago

I eventually got the sample working by using the Texture2D Input used in the Texture2D sample

Replacing the old Img load line

            //patternMat = Imgcodecs.imread(Application.persistentDataPath + "/PatternImage.jpg");

with

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

            Utils.texture2DToMat(patternTexture, patternMat);

And adding a parameter for the texture

        public Texture2D patternTexture;
EnoxSoftware commented 1 year ago

It appears that the problem occurs when none of keypoints can be detected from the input pattern image. We will be releasing a new version soon that addresses that issue. Thank you very much.