Hello, I'm currently working on an AR project and the client requested to reduce the border size from the current 25% to 20%. Is it possible to modify the current border dimension for markers? If possible, then how to modify it? Thanks
The markers come from artoolkit. They have a few constraints, the border size is one of them. Here is the relevant info from the docs:
"Square markers have only a few constraints.
more here:
https://artoolkit.org/documentation/doku.php?id=3_Marker_Training:marker_training
@kvanderd, I'm sorry but I already read that page. What I'm asking is if it's possible to modify the default 25% border thickness.
Hello again, just commenting again after 2 days of finding if it is not possible or not and will comment again for those who will be encountering this issue/requests from their bosses/clients.
I asked another questions in StackOverflow and in the issue thread of JSARToolkit5 and the great @ThorstenBux answered both of my questions (kudos to him).
Then, I modified the AR.js/three.js/src/threex/threex-armarkercontrols.js and I tried adding some code in the postInit() function to be able to modify the default pattRatio in the ARController in the JSARToolkit5. Here is the sample code. You can be able to modify the values from 0.1 to 0.9, which 0.5 is the default. The value corresponds to the percentage of the pattern size in relation to the overall marker size. If you set the value as 0.5, you will have the default 50% image/pattern size, as illustrated here. In my case, I set it to 0.9 because I want the 90% of the image/pattern to occupy the marker. The larger the value, the image will be much bigger and thus the border decreases.
After this, I also modified the marker training module and modified it so that I will be able to have the markers to be printed.
Here is a sample output where I am displaying a Pikachu GIF using the Hiro marker which I custom-trained.

TLDR:
PS: As of this moment, I'm still not sure if there will be unintended consequences for modifying the borders, I hope none.
@Angelo8828
In your last response, you mentioned in step 3 to run make commands.
Could you please provide more details on this step?? It will be useful for me to replicate this and test
@Angelo8828 No the marker thickness change shouldn't have any unintended consequences. (Maybe that you need to get closer to the marker for it to be recognized but besides that all good.
@jvijaybhaskar
Regarding make commands, I'm a bit unsure as of why they would be needed. Maybe to create the minified version of AR.js? ( https://github.com/jeromeetienne/AR.js#how-to-release- )
Sorry for the late reply @jvijaybhaskar (Easter holiday in my place). You need to install make if you have none and run make minify on your directory in the terminal/command prompt.
Make is a build automation tool, just like Webpack, Grunt, Gulp, etc that in our case, is being used to minify AR.js.
After you run the command, it will create a new version of AR.js file and the new file that will be generated will be the one you will include in your project.
Very good suggestion! reopening until your modifications are merged :)
How can I reduce the border in that way when using aframe-ar.js? is this integrated already? if not, what changes can I do manually in aframe-ar.js? thank you very much
without ever using aframe-ar I think this line might give you a clue: https://github.com/jeromeetienne/AR.js/pull/327/files#diff-e7a1251362f651dbea23121aabf1fa52R49531
Thank you , yes arController.setPattRatio(_this.parameters.patternRatio), that may make it, but then the other question is that producing a new marker with that width, the app that trains the marker we would need a new version of it, right? oh but I see that the current version has a slider to choose the ratio?
https://jeromeetienne.github.io/AR.js/three.js/examples/marker-training/examples/generator.html
thats great, so I have to test doing something like arController.setPattRatio(0.8) and see if it works with aframe-ar
yes, just mind that comment https://github.com/jeromeetienne/AR.js/pull/327#commitcomment-28950160 on the merge
oh thats not good news, that means that we cannot yet train markers with different pattern ratio, well then its not good, not usable then...
well you still can, just have to use the artoolkit native tools. https://github.com/artoolkitx/artoolkitx/tree/master/Source/Utilities/genTexData
Which is part of the release builds: https://github.com/artoolkitx/artoolkitx/releases/tag/1.0.1 just pick your platform
Thank you Thorsten, mmm, I dont do C, do u know of any version of it compiled for windows or online? mmmm, by the way I just managed to successfully change the patt ratio at
var arController = _this.context.arController
arController.setPattRatio(0.8);
(output: Pattern ratio size set to 0.800000)
and it works, so just need to do that training thing now mmm, not sure how to compile that native stuff though
this is the link to the windows release with everything prebuild: https://github.com/artoolkitx/artoolkitx/releases/download/1.0.1/artoolkitX.for.Windows.v1.0.1.zip
You don't need to compile anything
I have just downloaded the windows version, uncompressed it, and found the windows application version of artoolkitx_genTexData , but it just hangs when executing.. a pity...
does it? It shouldn't I use that regularly. If you can produce some log I could look into that. But going to switch off for today.
now i got it working on command line,
C:\Users\info\Downloads\artoolkitX.for.Windows.v1.0.1\a\SDK\bin>artoolkitx_genTexData
Error: no input file specified. Exiting.
artoolkitx_genTexData
-level=n
(n is an integer in range 0 (few) to 4 (many). Default 2.'
-sd_thresh=
-max_thresh=
-min_thresh=
-leveli=n
(n is an integer in range 0 (few) to 3 (many). Default 1.'
-feature_density=
-dpi=f: Override embedded JPEG DPI value.
-max_dpi=
-min_dpi=
-background
Run in background, i.e. as daemon detached from controlling terminal. (macOS and Linux only.)
-log=
-loglevel=x
x is one of: DEBUG, INFO, WARN, ERROR. Default is INFO.
-exitcode=
--help -h -? Display this help
now i gotta know how to execute those parameters, i just have to pass the jpeg image and thats it? thank you Thorsten
yes, just the path to the jpeg
actually you might be better of with mkPatt, there you can set the ratio afaik
and where do I specify the patt ratio?
mkPatt is another app? let me see if i find it there, oh yes its artoolkitx_mk_patt
oh that one really goes nuts :)
FSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
C:\Users\info\Downloads\artoolkitX.for.Windows.v1.0.1\a\SDK\bin>artoolkitx_mk_patt
[info] Setting video configuration '-format=BGRA'.
[info] Opening artoolkitX video using configuration '-format=BGRA'.
[info] Using supplied video config "-format=BGRA".
[info] Using supplied video config "-format=BGRA".
[info] Requesting images in BGRA format.
[info] Video 1280x720 (AR_PIXEL_FORMAT_BGRA), rowBytes=5120.
[info] Opened artoolkitX video 1280x720@4Bpp (AR_PIXEL_FORMAT_BGRA).
[warning] Using default camera parameters for 1280x720 image size, 45 degrees vertical field-of-view.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
[error] Error: IMFSourceReader::ReadSample.
this looks promising
C:\Users\info\Downloads\artoolkitX.for.Windows.v1.0.1\a\SDK\bin>artoolkitx_genMarkerSet
Usage: artoolkitx_genMarkerSet [options]
Where
Options:
--pattRatio f: Specify the proportion of the marker width/height, occupied
by the marker pattern. Range (0.0 - 1.0) (not inclusive).
(I.e. 1.0 - 2*borderSize). Default value is 0.5.
--borderSize f: DEPRECATED specify the width of the pattern border, as a
percentage of the marker width. Range (0.0 - 0.5) (not inclusive).
(I.e. (1.0 - pattRatio)/2). Default value is 0.25.
-border=f: Alternate syntax for --borderSize f.
--pattSize n: Specify the number of rows and columns in the pattern space
for template (pictorial) markers.
Default value 16 (required for compatibility with ARToolKit prior
to version 5.2). Range is [16, 64] (inclusive).
--pattCountMax n: Specify the maximum number of template (pictorial) markers
that may be loaded for use in a single matching pass.
Default value 50. Must be > 0.
--labelingMode AR_LABELING_BLACK_REGION|AR_LABELING_WHITE_REGION
-dpi=f: Override embedded JPEG DPI value.
--version: Print artoolkitX version and exit.
-loglevel=l: Set the log level to l, where l is one of DEBUG INFO WARN ERROR.
-h -help --help: show this message
So I tried and..
C:\Users\info\Downloads\artoolkitX.for.Windows.v1.0.1\a\SDK\bin>artoolkitx_genMarkerSet --pattRatio 0.9 t1.jpg
Reading JPEG file...
Done.
JPEG image 't1.jpg' is 918x918.
JPEG image 't1.jpg' does not contain embedded resolution data, and no resolution specified on command-line.
Enter resolution to use (in decimal DPI): 72
Pass 1: detected 3 marker candidates.
Pass 2: 0 detected marker candidates are square.
918x918 input image will display in 1280x720 window at 78.4% size
and it stops there and does no more.. a pity, so close.. thats definitely the right tool to use
so weird, it should work, it does this and then does nothing else, doesnt generate the patt and no error given
C:\Users\info\Downloads\artoolkitX.for.Windows.v1.0.1\a\SDK\bin>artoolkitx_genMarkerSet --pattRatio 0.9 -dpi=72 t1.jpg
Reading JPEG file...
Done.
JPEG image 't1.jpg' is 918x918.
Pass 1: detected 3 marker candidates.
Pass 2: 0 detected marker candidates are square.
918x918 input image will display in 1280x720 window at 78.4% size
with the mk_patt.exe I managed to get here
C:\Users\info\Downloads\artoolkitX.for.Windows.v1.0.1\a\SDK\bin>artoolkitx_mk_patt --pattRatio 0.9
[info] Setting video configuration '-format=BGRA'.
[info] Opening artoolkitX video using configuration '-format=BGRA'.
[info] Using supplied video config "-format=BGRA".
[info] Using supplied video config "-format=BGRA".
[info] Requesting images in BGRA format.
[info] Video 1280x720 (AR_PIXEL_FORMAT_BGRA), rowBytes=5120.
[info] Opened artoolkitX video 1280x720@4Bpp (AR_PIXEL_FORMAT_BGRA).
[warning] Using default camera parameters for 1280x720 image size, 45 degrees vertical field-of-view.
[info] arVideoLuma will use Intel SIMD acceleration.
[info] Content 1280x720 (wxh) will display in GL context 1280x720.
Enter filename: t1.jpg
and then it crashes..............
really frustrating.. weird..
the best one should be
genMarkerSet.c
unfortunately it just stops here and does nothing else
C:\Users\info\Downloads\artoolkitX.for.Windows.v1.0.1\a\SDK\bin>artoolkitx_genMarkerSet --pattRatio 0.9 -dpi=72 t1.jpg
Reading JPEG file...
Done.
JPEG image 't1.jpg' is 918x918.
Pass 1: detected 3 marker candidates.
Pass 2: 0 detected marker candidates are square.
918x918 input image will display in 1280x720 window at 78.4% size
I can see the help keyboard keys
static void printHelpKeys()
{
int i;
GLfloat w, bw, bh;
const char *helpText[] = {
"Keys:\n",
" ? or / Show/hide this help.",
" q or [esc] Quit program.",
" d Activate / deactivate debug mode.",
" m Toggle display of mode info.",
" a Toggle between available threshold modes.",
" - and + Switch to manual threshold mode, and adjust threshhold up/down by 5.",
" x Change image processing mode.",
" b Change labeling mode.",
" c Calulcate frame rate.",
};
but still nothing that actually produces an output file
that is frustrating. But same result for me
this is a bit absurd really, whoever created those tools, their entire UX is unbelievable not even mentioning how easy they crash, but we are not talking about a little project, we are talking about ArtToolKit!!! I am Speechless..........................
so lets recap here, its easy to change the patt ratio in the js file, but we have absolutely no way to generate a .patt file that has any other ratio than 0.5 because nobody is able to provide a consistent tool anywhere that does that
I'll run tests and recompile. I know it worked because I used it recently. And btw. I'm one of the main contributors to artoolkit :) .
I completely agree in regards to UX. The tools aren't built with UX in mind.
If you can, maybe test the 1.0 release. Might be some bug got into 1.0.1. I should have time to check next week.
Thank you Thorsten ;) btw you are really supportive and I really appreciate that ;) and as you are one of the main contributors to artoolkit let me say congratulations as I am a huge fan of your work then ;)
but yes, definitely, not done with UX in mind that's for sure ;)
so thank u if you help me check next week potential bugs in 1.0.1 and in the meantime I will follow your suggestion and see if I can test the 1.0 release, thank u again ;)
Ive just installed release 1.0,
and this produces exactly the same result
artoolkitx_genMarkerSet --pattRatio 0.9 -dpi=72 t1.jpg
Reading JPEG file...
Done.
JPEG image 't1.jpg' is 918x918.
Pass 1: detected 3 marker candidates.
Pass 2: 0 detected marker candidates are square.
918x918 input image will display in 1280x720 window at 78.4% size
and it stops there, i dont know if im missing something, but really, i get exact same result
Hi @javismiles please excuse I didn't look at it properly. The app genMarkerSet works. The issue might be that you are using a .jpg file that doesn't have a white area around the black border and hence it won't detect the marker. You need to use something like this:

then it generates a .pat file for you
hey Thorsten, I know that it works but remember the problem, the .patt file it generates has a ratio of 0.5, if you change the ratio to 0.9 or anything else, it still generates a file .patt with .5 of ratio, that's why its useless for any ratio that is not 0.5, thats the prob
Is that true for the web or the windows version? Cause we were discussing the issue with the windows version.
sorry Thorsten, I got confused here myself, now I see what you mean, you say that genMarkerSet works but that I have to provide the border as well, I was providing the same I provided to the online version which is the graphic without the border, ok so I can now try to put the border and I will tell u if it works, however if I want a 0.9 patt ratio I will have to make the border correct, ok let me try and I tell u thank u
Doubt here , If I want a patt ratio of 0.9, what should be the thickness of the border be in relation to the inner graphic? 1/10 of it?
"You can be able to modify the values from 0.1 to 0.9, which 0.5 is the default. The value corresponds to the percentage of the pattern size in relation to the overall marker size. If you set the value as 0.5, you will have the default 50% image/pattern size, as illustrated here. In my case, I set it to 0.9 because I want the 90% of the image/pattern to occupy the marker. The larger the value, the image will be much bigger and thus the border decreases."

I will try with this
well, I tried, pass 2 identifies a candidate, and I dont get any .patt file produced anywhere, how did you get a .patt file? can you try with that file I put above?
artoolkitx_genMarkerSet --pattRatio 0.9 -dpi=72 p9.jpg
Reading JPEG file...
Done.
JPEG image 'p9.jpg' is 1300x1300.
Pass 1: detected 3 marker candidates.
Pass 2: 1 detected marker candidates are square.
1300x1300 input image will display in 1280x720 window at 55.4% size
I even tried now with your very own Hiro graphic you posted above, and I get the below but I dont see any .patt being generated
artoolkitx_genMarkerSet --pattRatio 0.5 -dpi=72 hiro.jpg
Reading JPEG file...
Done.
JPEG image 'hiro.jpg' is 600x600.
Pass 1: detected 2 marker candidates.
Pass 2: 1 detected marker candidates are square.
600x600 input image will display in 1280x720 window at 120.0% size
so when you say "then it generates a .pat file for you", then when, how? :) when :) nothing being generated here ;)
puff, now once it worked with the hiro graphic, but just once and I cannot replicate it again, generated the patt file, but just once, this is..
ok now
now I can generate the .pat file, cool, ok now I gotta test it and see if it works ;)
Thorsten, thank u so much again for your help, I will test and tell u if the patt works ;)
I notice until now I always use .PATT with 2 Ts with AR.JS. but this is a .PAT file with 1 T, will it work the same?
So I tested the whole thing but it doesnt work, a few points

to design the border, I made the border on each side 1/10th of the inner area, as its 0.9 pattt ratio, which I also set through the software,
but not being recognized so far...
so hopefully im getting closer,
so the .pat file is generated like this:
artoolkitx_genMarkerSet --pattRatio 0.9 -dpi=72 p9.jpg
Reading JPEG file...
Done.
JPEG image 'p9.jpg' is 1300x1300.
Pass 1: detected 3 marker candidates.
Pass 2: 1 detected marker candidates are square.
1300x1300 input image will display in 1280x720 window at 55.4% size
Saved pattern file 'p9-00.pat'.
-- p9-00.pat --
Upper-left: {99.000000, 99.000000}
Upper-right: {1200.000000, 99.000000}
Lower-right: {1200.000000, 1200.000000}
Lower-left: {99.000000, 1200.000000}
cool, but its .pat , not .patt like the ones I always use till now
and it doesnt work so far with the graphic I put you above
I think the 0.9 border wasnt right, i think this is the right one

so now, doing it with that one I get
artoolkitx_genMarkerSet --pattRatio 0.9 -dpi=72 p15.jpg
Reading JPEG file...
Done.
JPEG image 'p15.jpg' is 1300x1300.
Pass 1: detected 4 marker candidates.
Pass 2: 1 detected marker candidates are square.
1300x1300 input image will display in 1280x720 window at 55.4% size
Saved pattern file 'p15-00.pat'.
-- p15-00.pat --
Upper-left: {145.000000, 145.000000}
Upper-right: {1154.000000, 145.000000}
Lower-right: {1154.000000, 1154.000000}
Lower-left: {145.000000, 1154.000000}
and the selection shown is this one

is that correct?
but its still not working, not being recognized, this is the pat file generated
0 0 0 0 90 240 255 255 255 255 255 255 255 255 255 255
0 0 0 95 255 255 255 255 255 255 255 255 255 255 255 255
0 0 111 255 255 255 255 255 255 255 255 255 255 255 255 255
0 159 255 255 255 255 255 255 255 255 255 255 255 255 255 255
159 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 202 151 254 255 255 255 255 255 255 255 255 255 255
255 255 163 1 0 159 255 255 255 255 255 255 255 255 255 255
254 159 0 0 0 0 162 255 255 255 255 255 255 255 255 243
140 0 0 0 0 0 90 254 255 255 255 255 255 255 239 48
0 0 0 0 0 95 255 255 255 255 255 255 255 239 47 0
0 0 0 0 99 255 255 255 255 255 255 255 212 30 0 0
0 0 0 156 255 255 255 255 255 255 255 207 16 0 0 0
0 0 0 0 90 240 255 255 255 255 255 255 255 255 255 255
0 0 0 95 255 255 255 255 255 255 255 255 255 255 255 255
0 0 111 255 255 255 255 255 255 255 255 255 255 255 255 255
0 159 255 255 255 255 255 255 255 255 255 255 255 255 255 255
159 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 202 151 254 255 255 255 255 255 255 255 255 255 255
255 255 163 1 0 159 255 255 255 255 255 255 255 255 255 255
254 159 0 0 0 0 162 255 255 255 255 255 255 255 255 243
140 0 0 0 0 0 90 254 255 255 255 255 255 255 239 48
0 0 0 0 0 95 255 255 255 255 255 255 255 239 47 0
0 0 0 0 99 255 255 255 255 255 255 255 212 30 0 0
0 0 0 156 255 255 255 255 255 255 255 207 16 0 0 0
0 0 0 0 90 240 255 255 255 255 255 255 255 255 255 255
0 0 0 95 255 255 255 255 255 255 255 255 255 255 255 255
0 0 111 255 255 255 255 255 255 255 255 255 255 255 255 255
0 159 255 255 255 255 255 255 255 255 255 255 255 255 255 255
159 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 202 151 254 255 255 255 255 255 255 255 255 255 255
255 255 163 1 0 159 255 255 255 255 255 255 255 255 255 255
254 159 0 0 0 0 162 255 255 255 255 255 255 255 255 243
140 0 0 0 0 0 90 254 255 255 255 255 255 255 239 48
0 0 0 0 0 95 255 255 255 255 255 255 255 239 47 0
0 0 0 0 99 255 255 255 255 255 255 255 212 30 0 0
0 0 0 156 255 255 255 255 255 255 255 207 16 0 0 0
255 255 255 255 255 255 255 255 255 255 255 243 48 0 0 0
255 255 255 255 255 255 255 255 255 255 255 255 239 47 0 0
255 255 255 255 255 255 255 255 255 255 255 255 255 239 30 0
255 255 255 255 255 255 255 255 255 255 255 255 255 255 212 16
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 207
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 254 255 255 255
255 255 255 255 255 255 255 255 255 255 255 162 90 255 255 255
240 255 255 255 255 255 255 255 255 254 159 0 0 95 255 255
90 255 255 255 255 255 255 255 255 151 0 0 0 0 99 255
0 95 255 255 255 255 255 255 255 202 1 0 0 0 0 156
0 0 111 255 255 255 255 255 255 255 163 0 0 0 0 0
0 0 0 159 255 255 255 255 255 255 255 159 0 0 0 0
0 0 0 0 159 255 255 255 255 255 255 254 140 0 0 0
255 255 255 255 255 255 255 255 255 255 255 243 48 0 0 0
255 255 255 255 255 255 255 255 255 255 255 255 239 47 0 0
255 255 255 255 255 255 255 255 255 255 255 255 255 239 30 0
255 255 255 255 255 255 255 255 255 255 255 255 255 255 212 16
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 207
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 254 255 255 255
255 255 255 255 255 255 255 255 255 255 255 162 90 255 255 255
240 255 255 255 255 255 255 255 255 254 159 0 0 95 255 255
90 255 255 255 255 255 255 255 255 151 0 0 0 0 99 255
0 95 255 255 255 255 255 255 255 202 1 0 0 0 0 156
0 0 111 255 255 255 255 255 255 255 163 0 0 0 0 0
0 0 0 159 255 255 255 255 255 255 255 159 0 0 0 0
0 0 0 0 159 255 255 255 255 255 255 254 140 0 0 0
255 255 255 255 255 255 255 255 255 255 255 243 48 0 0 0
255 255 255 255 255 255 255 255 255 255 255 255 239 47 0 0
255 255 255 255 255 255 255 255 255 255 255 255 255 239 30 0
255 255 255 255 255 255 255 255 255 255 255 255 255 255 212 16
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 207
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 254 255 255 255
255 255 255 255 255 255 255 255 255 255 255 162 90 255 255 255
240 255 255 255 255 255 255 255 255 254 159 0 0 95 255 255
90 255 255 255 255 255 255 255 255 151 0 0 0 0 99 255
0 95 255 255 255 255 255 255 255 202 1 0 0 0 0 156
0 0 111 255 255 255 255 255 255 255 163 0 0 0 0 0
0 0 0 159 255 255 255 255 255 255 255 159 0 0 0 0
0 0 0 0 159 255 255 255 255 255 255 254 140 0 0 0
0 0 0 16 207 255 255 255 255 255 255 255 156 0 0 0
0 0 30 212 255 255 255 255 255 255 255 99 0 0 0 0
0 47 239 255 255 255 255 255 255 255 95 0 0 0 0 0
48 239 255 255 255 255 255 255 254 90 0 0 0 0 0 140
243 255 255 255 255 255 255 255 255 162 0 0 0 0 159 254
255 255 255 255 255 255 255 255 255 255 159 0 1 163 255 255
255 255 255 255 255 255 255 255 255 255 254 151 202 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 159
255 255 255 255 255 255 255 255 255 255 255 255 255 255 159 0
255 255 255 255 255 255 255 255 255 255 255 255 255 111 0 0
255 255 255 255 255 255 255 255 255 255 255 255 95 0 0 0
255 255 255 255 255 255 255 255 255 255 240 90 0 0 0 0
0 0 0 16 207 255 255 255 255 255 255 255 156 0 0 0
0 0 30 212 255 255 255 255 255 255 255 99 0 0 0 0
0 47 239 255 255 255 255 255 255 255 95 0 0 0 0 0
48 239 255 255 255 255 255 255 254 90 0 0 0 0 0 140
243 255 255 255 255 255 255 255 255 162 0 0 0 0 159 254
255 255 255 255 255 255 255 255 255 255 159 0 1 163 255 255
255 255 255 255 255 255 255 255 255 255 254 151 202 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 159
255 255 255 255 255 255 255 255 255 255 255 255 255 255 159 0
255 255 255 255 255 255 255 255 255 255 255 255 255 111 0 0
255 255 255 255 255 255 255 255 255 255 255 255 95 0 0 0
255 255 255 255 255 255 255 255 255 255 240 90 0 0 0 0
0 0 0 16 207 255 255 255 255 255 255 255 156 0 0 0
0 0 30 212 255 255 255 255 255 255 255 99 0 0 0 0
0 47 239 255 255 255 255 255 255 255 95 0 0 0 0 0
48 239 255 255 255 255 255 255 254 90 0 0 0 0 0 140
243 255 255 255 255 255 255 255 255 162 0 0 0 0 159 254
255 255 255 255 255 255 255 255 255 255 159 0 1 163 255 255
255 255 255 255 255 255 255 255 255 255 254 151 202 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 159
255 255 255 255 255 255 255 255 255 255 255 255 255 255 159 0
255 255 255 255 255 255 255 255 255 255 255 255 255 111 0 0
255 255 255 255 255 255 255 255 255 255 255 255 95 0 0 0
255 255 255 255 255 255 255 255 255 255 240 90 0 0 0 0
0 0 0 140 254 255 255 255 255 255 255 159 0 0 0 0
0 0 0 0 159 255 255 255 255 255 255 255 159 0 0 0
0 0 0 0 0 163 255 255 255 255 255 255 255 111 0 0
156 0 0 0 0 1 202 255 255 255 255 255 255 255 95 0
255 99 0 0 0 0 151 255 255 255 255 255 255 255 255 90
255 255 95 0 0 159 254 255 255 255 255 255 255 255 255 240
255 255 255 90 162 255 255 255 255 255 255 255 255 255 255 255
255 255 255 254 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
207 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
16 212 255 255 255 255 255 255 255 255 255 255 255 255 255 255
0 30 239 255 255 255 255 255 255 255 255 255 255 255 255 255
0 0 47 239 255 255 255 255 255 255 255 255 255 255 255 255
0 0 0 48 243 255 255 255 255 255 255 255 255 255 255 255
0 0 0 140 254 255 255 255 255 255 255 159 0 0 0 0
0 0 0 0 159 255 255 255 255 255 255 255 159 0 0 0
0 0 0 0 0 163 255 255 255 255 255 255 255 111 0 0
156 0 0 0 0 1 202 255 255 255 255 255 255 255 95 0
255 99 0 0 0 0 151 255 255 255 255 255 255 255 255 90
255 255 95 0 0 159 254 255 255 255 255 255 255 255 255 240
255 255 255 90 162 255 255 255 255 255 255 255 255 255 255 255
255 255 255 254 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
207 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
16 212 255 255 255 255 255 255 255 255 255 255 255 255 255 255
0 30 239 255 255 255 255 255 255 255 255 255 255 255 255 255
0 0 47 239 255 255 255 255 255 255 255 255 255 255 255 255
0 0 0 48 243 255 255 255 255 255 255 255 255 255 255 255
0 0 0 140 254 255 255 255 255 255 255 159 0 0 0 0
0 0 0 0 159 255 255 255 255 255 255 255 159 0 0 0
0 0 0 0 0 163 255 255 255 255 255 255 255 111 0 0
156 0 0 0 0 1 202 255 255 255 255 255 255 255 95 0
255 99 0 0 0 0 151 255 255 255 255 255 255 255 255 90
255 255 95 0 0 159 254 255 255 255 255 255 255 255 255 240
255 255 255 90 162 255 255 255 255 255 255 255 255 255 255 255
255 255 255 254 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
207 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
16 212 255 255 255 255 255 255 255 255 255 255 255 255 255 255
0 30 239 255 255 255 255 255 255 255 255 255 255 255 255 255
0 0 47 239 255 255 255 255 255 255 255 255 255 255 255 255
0 0 0 48 243 255 255 255 255 255 255 255 255 255 255 255
I'll check. Could you share the app you use to verify if the marker works?
btw. patt and pat is the same.
thank you thorsten,
Im not using any special app, im on purpose using the marker with the most basic example possible, straight of the demos of ar.js, on purpose as simple as possible to verify if the change of ratio works
thats why the essence of the code is extremely simple, ok unfortunately it wont paste it correctly here, its the same anyway, same as any super simple tutorial demo of ar.js, the simplest thing possible with the only change of the patt ratio, thats all
`
<a-box position='0 0.5 0' material='opacity: 0.5;'></a-box>
</a-marker>
<a-entity camera></a-entity></a-scene>
</a-scene>`
Sorry, can't say anything in regards to AR.js I'm only using ARToolKit directly and the desktop version can deal with different border sizes.
oooh that's a pity,
well, in theory it should work in Ar.js, in theory... but.. mmm...
Is it possible to set the border to zero and let the image be 100% of the marker?
@derzu the border is used to detect the markers, meaning they are needed. What you would need is the NFT feature that detects JPG files in the video stream. But that does not run performantly on mobile and hasn't been merged into the master branch of artoolkit.
@ThorstenBux thanks for the reply, yes I wanna an NFT (Natural Feature Tracking) marker. I have an algorithm in mind that I think can be fast enough to have a great performance on mobile browsers.
Do you know where in the artookit is exactly the function that does the pixel comparison? Or where on the AR.js can this function be replaced?
AR.js is just a JS layer on top of jsartoolkit5 which in turn is a transpilation of ARToolKit5 which is a C/C++ library.
Or in short, if you would like to implement anything then you need to do it in C.
If you are still up to it then I can guide you to the corresponding lines. If you would like to implement something purely JS based I think the base place to start is OpenCV.js and go from there. But that would mean to start from scratch.
@ThorstenBux, thanks again for the reply. I think I found where the marker detection is done:
On the file: jsartoolkit5/js/artoolkit.api.js, the function ARController.prototype.detectMarker()
This function calls the C++ method detectMarker() from the file: jsartoolkit5/emscripten/ARToolKitJS.cpp
This c++ method calls the arDetectMarker() method, I don't know from where.
I will try to overwrite the ARController.prototype.detectMarker() on JavaScript, if I got success on my code I can port it to a faster c++ version. I think I don't need the OpenCV.js, just the pixels from the video and from the marker are enough.
Can you confirm if I'm looking at the right functions?
I intend to overwrite the detectMarker() getting the window.ARController.
@derzu found this thread while Googling around on this topic. Have you made any progress on your idea here?
I think no issues is being discussed here, at the moment. I close
Most helpful comment
Hello again, just commenting again after 2 days of finding if it is not possible or not and will comment again for those who will be encountering this issue/requests from their bosses/clients.
Yes, the border width, can be modified.
I asked another questions in StackOverflow and in the issue thread of JSARToolkit5 and the great @ThorstenBux answered both of my questions (kudos to him).
Then, I modified the
AR.js/three.js/src/threex/threex-armarkercontrols.jsand I tried adding some code in thepostInit()function to be able to modify the defaultpattRatioin theARControllerin theJSARToolkit5. Here is the sample code. You can be able to modify the values from 0.1 to 0.9, which 0.5 is the default. The value corresponds to the percentage of the pattern size in relation to the overall marker size. If you set the value as 0.5, you will have the default 50% image/pattern size, as illustrated here. In my case, I set it to 0.9 because I want the 90% of the image/pattern to occupy the marker. The larger the value, the image will be much bigger and thus the border decreases.After this, I also modified the marker training module and modified it so that I will be able to have the markers to be printed.
Here is a sample output where I am displaying a Pikachu GIF using the Hiro marker which I custom-trained.
TLDR:
PS: As of this moment, I'm still not sure if there will be unintended consequences for modifying the borders, I hope none.