javascriptartoolkitjsartoolkit

Change default border thickness of a square marker in ARToolkit


Based from this guide on the ARToolkit website, the default marker border thickness is at 25%. I want to change it to 20% and also maybe by 15%. Is it possible to modify it? If possible, then how?


Solution

  • As you haven't specified the language I assume you are using ARToolKit in C. But the function to change the border width is also exposed to Android and iOS.

    - mk_patt can now train markers with non-standard border widths. The command line switch "-border=n" (n between 0 and 0.5 (not inclusive)) specifies the desired border width as a proportion of the marker width. The portion of the marker which will be used as the pattern is now indicated by mk_patt by outlining in blue. Note that in order to use markers with non-standard border widths, the border width must be specified in the application by using the arSetBorderSize() function (see reference documentation for more information.) (source: https://github.com/artoolkit/artoolkit5/blob/47d5796eef841e11f54e6d7040f389063c05b5a3/ChangeLog.txt) Note: that the arSetBorderSize() is deprecated and you should use arSetPatRatio() instead

    Here is the definition of the function you need to use: https://github.com/artoolkitx/artoolkit5/blob/47d5796eef841e11f54e6d7040f389063c05b5a3/include/AR/ar.h#L772

    === Edit 1: ===

    As @Angelo Joseph Salvador now specified that he is looking for the solution of JSARToolKit it can be done using this function https://github.com/artoolkitx/jsartoolkit5/blob/master/js/artoolkit.api.js#L929

    on an existing ARController object.