FLARSingleMarkerDetector Error
greatxam opened this issue · comments
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.
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!
No I haven't find a solution. But there a Flash (as3) version that works using SingleMarkerDetector.
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
Hello Phil23
I just want to know if you've already found a solution to create your custom marker with JSARToolKit?
Thank you
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.
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!
Awesome, thanks!
On 2 July 2015 at 11:41, Dušan Ranđelović notifications@github.com wrote:
Hi all,
The problem was in detectMarkerLite under FLARSingleMarkerDetector, in
JSARToolKit.js.
- On line 12098 FLARRasterFilter_Threshold was not instantiated and
is not neededdetectMarkerLite : 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値イメージに変換する.
...
- 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 ilmari@fhtr.net | skype ilmarihe
tel (UK) +447427139588
FHTR Ltd
Company Number. 8157370
Registered in England
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