0.0.1 • Published 2 years ago

api_web_ar.js v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

介绍

基于jsartoolkitNFT以及可以利用threejs实现图像追踪,已到达AR效果,也可以单独使用图像识别

功能

  • nft图像识别

  • nft图像追踪

源码目录

.
├── doc
├── example
├── src
└── README.md   
  • doc是库的参数说明

  • example是示例demo

  • src是库源码

npm 安装

npm install api_web_ar

import { ApiArCamera, ApiArKnow } from "api_web_ar";
export default {
  name: "App",
  async created() {
    /* 开启摄像头 */
    let apiArCamera = await ApiArCamera(window.innerWidth, window.innerHeight);
    let apiArKnow = await ApiArKnow({
      koneType: "nft",
      markerUrl: "./nft/smoking_boy",
      cameraPara: "./resource/camera_para.dat",
      cameraOrigin: apiArCamera,
      three3d: false,
    });
    apiArKnow.on("loaded", () => {
      console.log("加载完成");
    });
    apiArKnow.on("found", () => {
      // console.log("识别到图片");
    });
    apiArKnow.on("notFound", () => {
      // console.log("未识别到图片");
    });
  },
};

说明

ar效果因为需要开启手机摄像头,所有需要https才可以正常开发;了解更多请查看docs以及examples下的示例代码

example示例项目启动

  • 1、安装全局live-server

npm install live-server -g

  • 2、源码api_web_ar根目录执行

npm install

live-server --https=./node_modules/live-server-https

  • 3、默认端口8080访问https://127.0.0.1:8080/examples/three.html