Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom pattern is not being recognized #164

Closed
sonalranjit opened this issue Aug 18, 2017 · 51 comments
Closed

Custom pattern is not being recognized #164

sonalranjit opened this issue Aug 18, 2017 · 51 comments

Comments

@sonalranjit
Copy link

Hi I am following your tutorial here I have made a custom marker pattern and uploaded it, and using the <a-marker-camera type='pattern' patternUrl='[path_to_mypattern]'></a-marker-camera>
But it is not working, I cannot debug this. It console i see no errors. The marker is not loading, and it for reason just defaults to the Hiro marker.

These are the libraries im loading `<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.0/aframe/examples/vendor/aframe/build/aframe.min.js"></script>

<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.0/aframe/build/aframe-ar.js"></script>`
@mrmookie
Copy link

mrmookie commented Aug 18, 2017

See #127

<a-marker-camera> is something like
<a-marker-camera type='pattern' url='your-url-here'></a-marker-camera>
(not patternURL)

@sonalranjit
Copy link
Author

@mrmookie i did try that as well, for <a-marker-camera> doesn't seem to working for me. What version of aframe-ar.js and aframe are you using?

@wimvdc
Copy link

wimvdc commented Aug 21, 2017

I'm facing the same issue.
Everything seems to default to the hiro pattern.
I'm using:

<html>
<head>
  <script src="https://aframe.io/releases/0.6.1/aframe.min.js"></script>
  <script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.0/aframe/build/aframe-ar.js"></script>
</head>
<body style='margin : 0px; overflow: hidden;'>
	<a-scene embedded arjs='sourceType: webcam;'>
		<a-box position='0 0.5 0' material='opacity: 0.5;'></a-box>
    <a-marker-camera type='pattern' url='https://wiim.xyz/w.patt'></a-marker-camera>
	</a-scene>
</body>
</html>

@shapetraceAdmin
Copy link

I look at the aframe-ar.js it seems like its in the backlog the a-marker and a-marker-camera is tagged as FIXME. Ive resorted to the threejs version, which is working with custom markers.

@sloschi
Copy link

sloschi commented Aug 23, 2017

i have a similar issue. i am training custom markers with the online tool but none of them is recognized. I have created a gist with on of the pattern files. Is anything wrong with it? I don't think that i am doing anything wrong in the code, but please have a look .

@shapetraceAdmin you seem to have it working with three.js. perhaps you could have a look?

This is the marker:
santas_hat

@sloschi
Copy link

sloschi commented Sep 12, 2017

i was able to solve this. The online marker generator tool used 0 instead of 255 for the white areas (you can see this in the linked gist above), so i colored it in a very light grey (240) and generated a new .patt file. now the marker is recognized correctly. I am not sure if this is a bug with the online tool?

@LoganArnett
Copy link

LoganArnett commented Sep 19, 2017

So I am getting a custom pattern to be recognized but the asset I am trying to display does not appear on the custom marker, however when I show the hiro marker and my custom marker the asset will be displayed on the hiro marker.

Not sure what is going on here

As soon as I take away either marker the asset is no longer displayed

@WaveF
Copy link

WaveF commented Sep 26, 2017

@LoganArnett I've solve this problem by the following steps:

  1. As @sloschi mentioned, change the image white part to light grey with rgb(240,240,240) and upload to online marker generate tool, then download the .patt file

  2. Modify the code in aframe.js following this

  3. Use this code in html:
    <a-marker preset='custom' type='pattern' url='your-marker.patt'>...</a-marker>

then it will work.

@kvanderd
Copy link

kvanderd commented Oct 4, 2017

This worked for me. I had to make one change:
<a-marker>...</a-marker>
to
<a-marker-camera>...</a-marker-camera>

@Rolthar
Copy link

Rolthar commented Oct 12, 2017

I am getting this issue as well:

added this:

else if( _this.data.preset === 'custom' ){
				arProfile.defaultMarkerParameters.type = 'pattern'
 				arProfile.defaultMarkerParameters.patternUrl = _this.data.patternUrl;
 				arProfile.defaultMarkerParameters.markersAreaEnabled = false

Generated my pattern with the online tool and got my .patt file.

Here is my code:

<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.0/aframe/examples/vendor/aframe/build/aframe.min.js"></script>
<script src="/AR/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
	<a-scene embedded arjs='sourceType: webcam;'>
		<a-assets>
			<a-asset-item id="LOGO" src="models/3d Logo.obj"></a-asset-item>
			<a-asset-item id="LOGO_MAT" src="models/3d Logo.mtl"></a-asset-item>
		</a-assets>

	<!-- define a camera which will move according to the marker position -->
	<a-marker preset='custom' type='pattern' url='LogoMarker.patt'>
	    <a-obj-model src="#LOGO" mtl="#LOGO_MAT"></a-obj-model>
	</a-marker>
	<a-entity camera></a-entity>
		
	</a-scene>
</body>

For some reason, it still catches the hiro pattern, and not my pattern, even when i look at the Network tab in dev tools on load, it gets the hiro pattern and my pattern is not to be seen.

@vin-ni
Copy link

vin-ni commented Oct 20, 2017

@WaveF Awesome. I've been searching for a solution for 2 hours. This worked! Thanks a lot!

@vin-ni vin-ni mentioned this issue Oct 20, 2017
@ClementTrois
Copy link

ClementTrois commented Dec 3, 2017

Hi

There is a fixed code for custom marker?
I have modify the code in aframe.js and use this code

<a-marker-camera preset='custom' type='pattern' url='a.patt'> <a-image listener geometry="primitive: plane" rotation="-90 0 0" scale="3 3 3" src="http://78.media.tumblr.com/57442b11b3ffb734dc617ba8881d8a06/tumblr_ozefn0U8Kg1rb7ns9o1_1280.jpg"></a-image></a-marker-camera>

but it don't work

@mattGraphics
Copy link

Does anyone know if the custom marker issue is resolved?

I've been trying for a few weeks with the many solutions offered across the web, but have found some comments that say custom markers still don't work as of Feb 2018. I see this guy ( https://github.com/u4bi-git/simple-ar.js ) got it to work, but that was Sept '17 and the problem seems to be more recent.

Every video on youtube uses just the Hiro marker.

Shouldn't it work if I just add the custom marker code below to Jerome's codepen: https://codepen.io/jeromeetienne/pen/mRqqzb

<a-marker preset='custom' type='pattern' url='pattern-marker.patt'>
	    
<a-text anchor="align" position="0 0.1 0" rotation="270 0 0" side="double" width="5" color="red" value="hello world"></a-text>
	</a-marker>

@syamishere
Copy link

Any Luck ?

@mattGraphics
Copy link

Hi @syamishere, according to @rdub80 it looks like @jeromeetienne merged and ran the latest build but did not run a release, so we are still on 1.5.1 from August 2017 which doesn't contain the updated code.

Read more on this thread: #236 (comment)

@mattGraphics
Copy link

mattGraphics commented Mar 7, 2018

I've solved the issue I had with custom markers so in case this helps anyone else: the custom marker doesn't work for me unless it is on a server (in my case my github repository), it didn't work when referenced locally on my computer. Once I had uploaded the custom marker to github and changed the 'url' accordingly it worked fine.

@vettorazi
Copy link

vettorazi commented Apr 12, 2018

i uploaded the marker to my github repository, but seems it's not working. @mattGraphics can you share your code to see if it's my code or my marker the problem here?

@mattGraphics
Copy link

Hi @vettorazi You posted in this thread #216 that you have now resolved the issue, but you're welcome to take a look at my code: https://github.com/mattGraphics/mattGraphics.github.io

@alexxss
Copy link

alexxss commented Apr 18, 2018

Hi, I'm having similar issue with custom marker. I have made sure to use gray instead of white, I referenced v1.5.5, I link to .patt on github server, and it was working up until yesterday.
It just says markersAreaEnabled :false at the bottom of the page, neither hiro nor my custom works.
Can anyone tell me what I did wrong? Below is part of my code. Link to my repo here. Thanks!

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
  <script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.5/aframe/build/aframe-ar.js"></script>
</head>
<body style="margin : 0px; overflow: hidden;">
  <a-scene embedded arjs="sourceType: webcam;">
    <a-box position="0 2 1"></a-box>
    <a-marker-camera preset="custom" type="pattern" url="https://raw.githubusercontent.com/alexxss/custom-marker/master/marker.patt"></a-marker-camera>       
  </a-scene>
</body>

@alexxss
Copy link

alexxss commented Apr 18, 2018

It is suddenly working now. I have no idea what is different.
I changed a bit of other stuff but referenced the same scripts and used the same components for <a-marker-camera> but it's working now. Would still like to know what could be the possible cause?

@makeratl
Copy link

makeratl commented May 9, 2018

I've been reading through a number of these - trying to solve my own version of the same problem. I've gotten to everything happy in the console, but no custom pattern is seen and recognized for the interactions. Having to guess it's something with my pattern, but at a loss to figure out what or understand why. Seems like several people above "got it working", but what is the magic step was that I'm missing.

My marker
marker_test

My test (no change other than the custom market on example files:
https://openhouse.looklisten.com/AR/aframe/examples/marker-camera.html

If anyone has insight... please do!

@rdub80
Copy link

rdub80 commented May 9, 2018

@befungle try this for the custom marker:
<a-anchor preset="custom" type="pattern" url="marker.patt" hit-testing-enabled='false'> <a-box></a-box> </a-anchor>
Also try to make the interior of the marker HEX #ddd that helps tracking

@makeratl
Copy link

makeratl commented May 9, 2018

@rdub80 Changed to the tag you recommended and updated the marker with the grey scale. Still not recognized as a marker and not generating AR overlay. Struggled with a similar marker challenge with an Android based AR last year, though one advantage is the marker generation system "graded" the marker quality and helped narrow down what images worked and what did not.

@makeratl
Copy link

makeratl commented May 9, 2018

@rdub80 - the hacker in me wanted to remove questions.... so I literally downloaded the Hiro marker (that works as a preset), ran it through the Custom Marker Maker, downloaded and loaded it.... Nothing. Yet, if I return it to "preset" and "hiro", that same image works.

@rdub80
Copy link

rdub80 commented May 9, 2018

@befungle make sure you use aframe 0.8.0 and this build: <script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>

@makeratl
Copy link

makeratl commented May 9, 2018

One more update - If I take the code from the patt.hiro default pattern and copy it into the custom pattern I made from the Hiro image, it works calling the pattern file.

The pattern file generated by the Custom Marker trainer (https://jeromeetienne.github.io/AR.js/three.js/examples/marker-training/examples/generator.html) is VERY different than the one found in the default library.

So, the problem seems to be in the pattern file generated by the marker-trainer. Image attached shows the default HIRO pattern against the marker generated online from the same image:
screen shot 2018-05-09 at 1 45 47 pm

@rdub80
Copy link

rdub80 commented May 9, 2018

I am not sure what happened to your pattern file but there needs to be a distinctive border around your marker visible in code: this is what my custom patt file looks like
image

@makeratl
Copy link

makeratl commented May 9, 2018

Interesting.... My efforts were to run the online upload, clicked the download, copy file to directory. I really want to give this project a run for it's possibilities in ideation and proof of concepts. However, I'm starting to feel like I'm going down a rabbit hole. I reviewed the code for pattern generation though that's much deeper into a review than I can see continuing on.

@makeratl
Copy link

makeratl commented May 9, 2018

Everyone who gets this far in the thread.... there's one more thing that is pretty important. The image posted for recognition's size must be pretty small. I found a post (https://medium.com/chialab-open-source/ar-js-the-simpliest-way-to-get-cross-browser-ar-on-the-web-8f670dd45462) that got past my issue by indicating the marker image should only be 16x16px. That's a pretty small image, but when I used that to build a marker it worked.

So, such a small image marker creates limits, but at least I have been able to make it work.

@marcomarsala
Copy link

marcomarsala commented May 10, 2018

The custom marker can be any photo or I need a simple figure?

I’m trying to achieve what is shown in this video: https://m.youtube.com/watch?feature=youtu.be&v=lj3SsXs9Qgc

That is video overlay on printed paper

@nicolocarpignoli
Copy link
Collaborator

@befungle I wrote that article, I'm glad it helped you :) If you need other informations just ask.

@marcomarsala It HAS to be a very simple figure. In general you can either use pattern marker or barcode marker, but in this thread we are talking about pattern ones.
If you want to use them (you upload an image, and generate a .patt file) the given image has to respect some constraint. Keep in mind that the generated .patt file is an ASCII text file that describes the image you give, so the image has to be very very simple.

I invite you to read my article on Medium https://medium.com/chialab-open-source/ar-js-the-simpliest-way-to-get-cross-browser-ar-on-the-web-8f670dd45462 in which I collected all constraints for the input image for generating a pattern marker. Let me know if it helps.

@leeprobert
Copy link

Update on this: I got it working with aframe-v0.6.1-three-r86.min.js

@nicolocarpignoli
Copy link
Collaborator

I consider this solved. Feel free to re-open if not.

@lewisdonovan
Copy link

I can't get my marker to work, have followed the instructions here but still no luck. My code is in this repo and can be seen below:

<a-scene embedded arjs>
    <a-box position='0 0.5 0' material='opacity: 1;'></a-box>
    <a-marker-camera preset='custom' type='pattern' url='https://raw.githubusercontent.com/lewisdonovan/ar-js-testing/master/pattern-marker.patt'></a-marker-camera>
</a-scene>

@CML-ecraft
Copy link

I think your issue may be related to the issue I posted yesterday (#424 ). It looks like the pattern generator is creating invalid patterns. Color values are off and the values change between the views/section of the pattern code.

@willyci
Copy link

willyci commented Dec 12, 2018

@befungle I wrote that article, I'm glad it helped you :) If you need other informations just ask.

@marcomarsala It HAS to be a very simple figure. In general you can either use pattern marker or barcode marker, but in this thread we are talking about pattern ones.
If you want to use them (you upload an image, and generate a .patt file) the given image has to respect some constraint. Keep in mind that the generated .patt file is an ASCII text file that describes the image you give, so the image has to be very very simple.

I invite you to read my article on Medium https://medium.com/chialab-open-source/ar-js-the-simpliest-way-to-get-cross-browser-ar-on-the-web-8f670dd45462 in which I collected all constraints for the input image for generating a pattern marker. Let me know if it helps.

Thanks, it fixed my problem.

@kaunglvlv
Copy link

Did anyone get this to work with a white background like Hiro? If not, does anyone know how to generate the pattern file without the Marker Trainer?

@nicolocarpignoli
Copy link
Collaborator

please follow https://github.com/artoolkit/jsartoolkit5
markers are not an AR.js thing.

@s3c7a
Copy link

s3c7a commented Mar 4, 2019

@LoganArnett I've solve this problem by the following steps:

  1. As @sloschi mentioned, change the image white part to light grey with rgb(240,240,240) and upload to online marker generate tool, then download the .patt file
  2. Modify the code in aframe.js following this
  3. Use this code in html:
    <a-marker preset='custom' type='pattern' url='your-marker.patt'>...</a-marker>

then it will work.

Hi @WaveF quick question. On your solution, you link to a source that's not live anymore, do you happen to have alternate or more information on that?

@kaunglvlv
Copy link

FYI, I've also "solved" my problem. Like everyone else, I created my .patt file using light gray instead of the white background. I was able to use this .patt file on my white marker.

I wish the .patt generator was fixed but this will work for now.

@nicolocarpignoli
Copy link
Collaborator

nicolocarpignoli commented Mar 5, 2019

@kkaung please open a specific issue for this problem about marker generator, we will look forward to it: if you can identify the bug / problem specifically I can even make a PR by myself when i got time

@juansho01
Copy link

@nicolocarpignoli i had an issue and question: Right now, im trying to read, multiple different Markers. Each one show a different content. This pattern are Images, some ones works, and other doesn't. Exist some documentation about what kind of images or specs for images on patterns?. Thanks

@nicolocarpignoli
Copy link
Collaborator

nicolocarpignoli commented Mar 6, 2019

@juansho01 Hi, in this article I collected all the informations I have found and tested about pattern and barcode markers for AR.js : https://medium.com/chialab-open-source/ar-js-the-simpliest-way-to-get-cross-browser-ar-on-the-web-8f670dd45462.

Let me know if it helps.

Again, @kkaung or anybody who has experienced problems with the online marker generator, please open an Issue with the specific problem. I will try to look to it

@NicolasPerl
Copy link

I was able to get it to work by hosting the image remotely (like digital ocean or github) and setting that path as the url.

@GaT11
Copy link

GaT11 commented Apr 8, 2020

Hello, can one of you help me?
When I try to use two or more different pattern my code doesn't work because by both of the pattern the red cube appears and not by one of the pattern the green one and by the other the red one.

This is my code (without the right url):

    <a-box color="green"></a-box>


    <a-marker-camera  preset="custom" type="pattern"
        url="....patt">
    </a-marker-camera>



    <a-box color="red"></a-box>
    <a-marker-camera preset="custom" type="pattern"
        url="...patt">
    </a-marker-camera>
</a-scene>

@GaT11
Copy link

GaT11 commented Apr 8, 2020

And i have another issue.
My gltf-modell isn't animating like it should but the 3D-Model appears on screen.
Can you please help me an write another Code that works into this Chat?

Here my code:

           <a-entity 
           gltf-model="url(bilder_ar/steve-gltf/scene.gltf)"  
           animation-mixer="clip:Armature.001; loop:2; timeScale: 5; 
           crossFadeDuration: 1">
           </a-entity>

@PedroNan
Copy link

I'm trying to get a custom marker work but still can't. I considered using a gray background and type = "pattern" preset = "custom" but still not work. I'm using Glitch to host the code online. I would appreciate some help! thanks.

@vadermemo
Copy link

@LoganArnett I've solve this problem by the following steps:

1. As @sloschi mentioned, change the image white part to light grey with rgb(240,240,240) and upload to [online marker generate tool](https://jeromeetienne.github.io/AR.js/three.js/examples/marker-training/examples/generator.html), then download the .patt file

2. Modify the code in aframe.js following [this](https://github.com/wimvdc/AR.js/commit/950e82db6d0c3851647d429282c5ade52ee95891)

3. Use this code in html:
   `<a-marker preset='custom' type='pattern'  url='your-marker.patt'>...</a-marker>`

then it will work.

the link is broke :( => https://github.com/wimvdc/AR.js/commit/950e82db6d0c3851647d429282c5ade52ee95891
Can you send to another url?

@yalegria
Copy link

It's 2024 and I started playing with AR.js, but frustrated the custom markers is not working. I just can't make it work. I tried everything posted here.

Is this project still supported? What is other people looking at as alternatives to ar.js (if any)?

@ak3d3
Copy link

ak3d3 commented Oct 19, 2024

It's 2024 and I started playing with AR.js, but frustrated the custom markers is not working. I just can't make it work. I tried everything posted here.

Is this project still supported? What is other people looking at as alternatives to ar.js (if any)?

I am frustrated too, webxr solve problem to me but its not possible to open on Iphone....

@ak3d3
Copy link

ak3d3 commented Oct 19, 2024

OMG USE PATTERN RATIO 0.50....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests