Một mục mã nguồn mở trong kho dữ liệu GitHub của TopGit: playcanvas/playcanvas-ar, 260 sao, JavaScript. Fast and Easy Augmented Reality for the Web :rocket:
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
PlayCanvasAR makes it easy to build lightning fast augmented reality applications. With it, you can construct web-based AR applications with zero programming using the PlayCanvas Editor. Just drag in your 3D models and watch them appear in AR!
But if you want to create something more interactive, you can call on the full power of the PlayCanvas scripting API.
Demo
Before you begin, print out the following markers: Hiro and Kanji.
Now click here for a demonstration. We recommend running it on mobile. If you use iOS, you'll need to ensure you have upgraded to iOS 11, which is required to access the camera from Safari.
Or check out a little video:
Features
Amazing Performance - PlayCanvasAR delivers 60 frames per second, even on mobile.
Marker-based Tracking - PlayCanvasAR utilizes the amazing ARToolkit, an open source marker-based tracking library. Originally coded in C++, it has been ported to JavaScript using Emscripten.
Incredible Visuals - PlayCanvas provides an advanced WebGL graphics engine. It supports the latest WebGL 2 graphics API and implements Physically Based Rendering to achieve incredible visuals for your AR applications. And yes, that's open sourced too.
Getting Started with PlayCanvasAR
Create an account on playcanvas.com (if you haven't already).
Fork the AR Starter Kit project (which contains the latest version of playcanvas-ar.js).
Hit the launch button and see AR in action (we recommend using your mobile device!).
Configuring PlayCanvasAR in the Editor
The playcanvas-ar.js script contains two script objects: arCamera and arMarker. The arCamera script renders a device's camera feed and tracks the feed image for AR markers. It can be added to an entity that has a camera component. The interface generated is as follows:
To create a new marker entity, simply add a script component and add the arMarker script. This will generate the following UI:
Scripting with PlayCanvasAR
The PlayCanvas Editor allows you to build your AR apps visually. But you may want to create AR powered entities programmatically. Or you may want to build AR apps by simply using the PlayCanvas Engine without the Editor. PlayCanvas AR exposes two script objects: 'arCamera' and 'arMarker'. 'Engine-only' scripting examples can be found in the examples folder.
arCamera
This code creates an AR-enabled camera:
var camera = new pc.Entity("AR Camera");
camera.addComponent("camera", {
clearColor: new pc.Color(0, 0, 0, 0)
});
camera.addComponent("script");
camera.script.create("arCamera", {
attributes: {
cameraCalibration: asset,
detectionMode: 0, // Color Template
matrixCodeType: 0, // 3x3
labelingMode: 1, // Black Region
processingMode: 0, // Frame
thresholdMode: 0, // Manual
threshold: 100,
trackerResolution: 0, // Full
trackAlternateFrames: false,
debugOverlay: false,
videoTexture: false
}
});
app.root.addChild(camera);
Attribute
Type
Description
cameraCalibration
pc.Asset
Data file containing the calibration properties for the camera to be used.
detectionMode
Number
The pattern detection determines the method by which ARToolKit matches detected squares in the video image to marker templates and/or IDs. ARToolKit can match against pictorial "template" markers, whose pattern files are created with the mk_patt utility, in either colour or mono, and additionally can match against 2D-barcode-type "matrix" markers, which have an embedded marker ID. Two different two-pass modes are also available, in which a matrix-detection pass is made first, followed by a template-matching pass. Defaults to 0 (Color Template).
matrixCodeType
Number
Set the size and ECC algorithm to be used for matrix code (2D barcode) marker detection. When matrix-code (2D barcode) marker detection is enabled (see Detection Mode) then the size of the barcode pattern and the type of error checking and correction (ECC) with which the markers were produced can be set via this function. This setting is global to a given AR Camera; It is not possible to have two different matrix code types in use at once. Defaults to 0 (3x3).
labelingMode
Number
Select between detection of black markers and white markers.\n\nARToolKit's labelling algorithm can work with both black-bordered markers on a white background ('Black Region') or white-bordered markers on a black background ('White Region'). This property allows you to specify the type of markers to look for. Note that this does not affect the pattern-detection algorithm which works on the interior of the marker.
processingMode
Number
When the image processing mode is 'Frame', ARToolKit processes all pixels in each incoming image to locate markers. When the mode is 'Field', ARToolKit processes pixels in only every second pixel row and column. This is useful both for handling images from interlaced video sources (where alternate lines are assembled from alternate fields and thus have one field time-difference, resulting in a 'comb' effect) such as Digital Video cameras. The effective reduction by 75% in the pixels processed also has utility in accelerating tracking by effectively reducing the image size to one quarter size, at the cost of pose accuracy.
thresholdMode
Number
The thresholding mode to use. The standard ARToolKit options are available: Manual (0), Median (1), Otsu (2), Adaptive (3). Defaults to 0 (Manual).
threshold
Number
The binarization threshold is an 8-bit number that is in the range [0, 255], inclusive. The default value is 100, allowing ARToolKit to easily find markers in images that have good contrast. This value is only used when the mode is set to Manual. Defaults to 100.
trackerResolution
Number
Controls the resolution of the tracker image. Each video frame is copied to the tracker image for marker detection. Reducing the tracker image resolution will speed up marker detection but will also make it less precise. For example, a video camera source may have a resolution of 640x480. The tracker image will have the following resolutions based on the selected option: 'Full': 640x480, 'Three Quarters': 480x360, 'Half': 320x240, 'Quarter': 160x120.
trackAlternateFrames
Boolean
If selected, tracking is only performed on every other update. This can increase lag in tracking but will reduce CPU load.
debugOverlay
Boolean
Enables or disables the debug overlay. When enabled, a black and white debug image is generated during marker detection. The debug image is useful for visualizing the binarization process and choosing a threshold value. The image is displayed as an overlay on top of the 3D scene.
videoTexture
Boolean
Streams the camera feed to a video texture if enabled. Otherwise, a video DOM element is used. Defaults to false.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/playcanvas/playcanvas-ar là nguồn chính thức.
playcanvas/playcanvas-ar có bao nhiêu sao?
playcanvas/playcanvas-ar có 260 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/playcanvas/playcanvas-ar. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
playcanvas/playcanvas-ar có những chủ đề gì?
GitHub topics của playcanvas/playcanvas-ar: "augmented-reality", "html5", "playcanvas", "webar", "webgl", "webgl2", "webrtc". TopGit xếp repo vào nhóm mã nguồn mở.
playcanvas/playcanvas-ar có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho playcanvas/playcanvas-ar. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
playcanvas/playcanvas-ar còn đang phát triển không?
Commit gần nhất trên playcanvas/playcanvas-ar là 4.8 năm trước (theo timestamp GitHub). Repo có 75 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
playcanvas/playcanvas-ar dùng license gì?
playcanvas/playcanvas-ar phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
playcanvas/playcanvas-ar viết bằng ngôn ngữ gì?
playcanvas/playcanvas-ar chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
playcanvas-ar có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về playcanvas-ar.