jeromeetienne / AR.js

Efficient Augmented Reality for the Web - 60fps on mobile!
MIT License
15.79k stars 2.22k forks source link

how does ARjs get "marker_transform_mat " variable that is showed in code ? #595

Closed pans0ul closed 4 years ago

pans0ul commented 5 years ago

`/**

Hi . how does ARjs get "marker_transform_mat " variable that is showed in code ( source file : ar.js) ? It seems there is no detail function to show about getting 'this.marker_transform_mat '

if others know about this ,please tell me ,thanks a lot

kalwalt commented 5 years ago

You should read in the jsartoolkit5 code. https://github.com/artoolkit/jsartoolkit5 function call the Emscripten compiled code: artoolkit.getTransMatSquare Look in the ARtoolkitJS.cpp function: https://github.com/artoolkit/jsartoolkit5/blob/b02f2b8ae94d0e4e45ffad0a05222199b3801962/emscripten/ARToolKitJS.cpp#L512

kalwalt commented 5 years ago

And if i am not wrong this.marker_transform_mat should be filler by marker_info in the C++ code with em_asm call. Sorry but i' m writing by my Smartphone, cannot help more than this.

pans0ul commented 5 years ago

@kalwalt
Thank you for your response!
is that means we cant read details and modify function to get " this.marker_transform_mat "?

I try to make markless AR(viewmatrix changed by image rather than black white grid mark ) using modified ARjs. I read link : https://github.com/jeromeetienne/AR.js/issues/503 https://github.com/jeromeetienne/AR.js/issues/190

if we can get transform matrix from image like get "this.marker_transform_mat" from mark ,then replace the "this.marker_transform_mat" variable and convey imaged matrix into "post-process " of ARjs or ARtoolkit .So the finally effect could be same .

To get transform matrix from image, we can extract feature from image and use PNP method to estimate camera pose .however ,I don't know what is relationship between mark coordinate and camera pose .But I know these are relative .

So the pipeline is that :

extract feature from image --> camera pose estimation using PnP --> respect to mark coordinate --> convey marker_transform_mat --> post-process of ARjs

That's my assumption .

pans0ul commented 5 years ago

I don't know if can be achieved or not

I will appreciate others tell me what is relationship between mark coordinate and camera pose .