webarkit / ARnft

A small javascript library for WebAR with NFT
GNU Lesser General Public License v3.0
220 stars 54 forks source link

Get Image/ object dimensions(width/height) from camera #198

Open mobcoder-ashu opened 3 years ago

mobcoder-ashu commented 3 years ago

How you find the width/height of the image, that you are seeing through camera, I mean in order to superimpose something over that image/object, we need exact height and width of the image after that only we can draw/play something over it

kalwalt commented 3 years ago

Hi @mobcoder-ashu i think you mean the image marker, if so you can get the width and height of the NFT marker with the getNFTData listener here where is dispatched: https://github.com/webarkit/ARnft/blob/74de64fb9e4ba3c0b8a9489e0b2b17bc263a839f/src/NFTWorker.ts#L171-L175 It is used by ARnft-threejs to get width, heigth and dpi to place the mesh or model.

mobcoder-ashu commented 3 years ago

Hi @kalwalt, but this event listener is triggered only once, so I am not getting data in real time.

kalwalt commented 3 years ago

Hi @kalwalt, but this event listener is triggered only once, so I am not getting data in real time.

yes only once. Do you need constantly?

mobcoder-ashu commented 3 years ago

Hi @kalwalt, but this event listener is triggered only once, so I am not getting data in real time.

yes only once. Do you need constantly?

yes, so that I can play video exactly over it, if I get this data constantly then it even on moving the image/camera the video will play over the object, did you get my point ?