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

FLARSingleMarkerDetector Error #11

Open
greatxam opened this issue Jan 21, 2014 · 9 comments
Open

FLARSingleMarkerDetector Error #11

greatxam opened this issue Jan 21, 2014 · 9 comments

Comments

@greatxam
Copy link

Hi,

I got an error when I use custom marker. What I did is this:

var encoder = new FLARIdMarkerDataEncoder_RawBit();
var oReq = new XMLHttpRequest();
oReq.onload = function(e) {
var markerCode = new FLARCode(16,16);
markerCode.loadARPatt(oReq.response);

encoder.encode(markerCode,encoder.createDataInstance());
detector = new FLARSingleMarkerDetector(param, markerCode,80);

}
oReq.open("get", "pattern/custom_marker.pat", true);
oReq.send();

And on my render() function:

function render() {
var isDetected = detector.detectMarkerLite(raster,90); // error triggers here
...
}

Uncaught TypeError: Cannot read property 'length' of undefined JSARToolKit.js:137
c JSARToolKit.js:137
ASKlass.detectMarkerLite JSARToolKit.js:12100

I hope someone can help me with this. And thanks in advance.

@greatxam greatxam reopened this Jan 21, 2014
@Phil23
Copy link

Phil23 commented May 12, 2014

Do you already found a solution for creating custom markers?
I'm also working on an AR project and would realy appreciate your solution.

Thanks a lot!

@greatxam
Copy link
Author

No I haven't find a solution. But there a Flash (as3) version that works using SingleMarkerDetector.

@Phil23
Copy link

Phil23 commented May 13, 2014

I got it working. I just looked at the AS file and adapted it to JS.

http://www.libspark.org/svn/js/JSARToolKit/trunk/src/JSAR.as

@yuccai
Copy link

yuccai commented Jul 10, 2014

Hello Phil23
I just want to know if you've already found a solution to create your custom marker with JSARToolKit?
Thank you

@Phil23
Copy link

Phil23 commented Jul 11, 2014

Hey,

yes, i finally got it to work. I found an example from the original java library and adapted it to javascript. But i had to fix some bugs in the JSARToolKit to make it work, which was hard to figure out. I did not find the time to commit my changes yet.

@duxan
Copy link

duxan commented Jul 2, 2015

Hi all,

The problem was in detectMarkerLite under FLARSingleMarkerDetector, in JSARToolKit.js.

1st. On line 12098 FLARRasterFilter_Threshold was not instantiated and is not needed

detectMarkerLite : function(i_raster,i_threshold)
  {
    FLARRasterFilter_Threshold(this._tobin_filter).setThreshold(i_threshold);
    //サイズチェック
    if(!this._bin_raster.getSize().isEqualSize_NyARIntSize(i_raster.getSize())){
      throw new FLARException();
    }
    //ラスタを2値イメージに変換する.
...

should be:

detectMarkerLite : function(i_raster,i_threshold)
  {
    this._tobin_filter.setThreshold(i_threshold);
    //サイズチェック
    if(!this._bin_raster.getSize().isEqualSize_NyARIntSize(i_raster.getSize())){
      throw new FLARException();
    }
    //ラスタを2値イメージに変換する.
...

2nd. On line 9841 BUFFER_FORMAT was not accessible

isEqualBufferType : function(i_type_value)
  {
    return BUFFER_FORMAT==i_type_value;
  }

should be:

isEqualBufferType : function(i_type_value)
  {
    return this.BUFFER_FORMAT==i_type_value;
  }

Custom markers now work for me!
I-ll file pull request later today if someone want it compiled.

Cheers!

@kig
Copy link
Owner

kig commented Jul 2, 2015

Awesome, thanks!

On 2 July 2015 at 11:41, Dušan Ranđelović [email protected] wrote:

Hi all,

The problem was in detectMarkerLite under FLARSingleMarkerDetector, in
JSARToolKit.js.

  1. On line 12098 FLARRasterFilter_Threshold was not instantiated and
    is not needed

detectMarkerLite : function(i_raster,i_threshold)
{
FLARRasterFilter_Threshold(this._tobin_filter).setThreshold(i_threshold);
//サイズチェック
if(!this._bin_raster.getSize().isEqualSize_NyARIntSize(i_raster.getSize())){
throw new FLARException();
}
//ラスタを2値イメージに変換する.
...

should be:

detectMarkerLite : function(i_raster,i_threshold)
{
this._tobin_filter.setThreshold(i_threshold);
//サイズチェック
if(!this._bin_raster.getSize().isEqualSize_NyARIntSize(i_raster.getSize())){
throw new FLARException();
}
//ラスタを2値イメージに変換する.
...

  1. On line 9841 BUFFER_FORMAT was not accessible

isEqualBufferType : function(i_type_value)
{
return BUFFER_FORMAT==i_type_value;
}

should be:

isEqualBufferType : function(i_type_value)
{
return this.BUFFER_FORMAT==i_type_value;
}

Custom markers work for me!
I-ll file pull request later today if someone want it compiled.

Cheers!


Reply to this email directly or view it on GitHub
#11 (comment).

Ilmari Heikkinen

web http://fhtr.net | mail [email protected] | skype ilmarihe
tel (UK) +447427139588

FHTR Ltd
Company Number. 8157370
Registered in England

@rawatrob
Copy link

Hi @duxan, Thanks for it, I have try but didn't get any success can you please share a demo project which have custom marker please share or suggestion

@kalwalt
Copy link

kalwalt commented Mar 24, 2018

@rawatrob see #9

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

7 participants