
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
qrcode-opencv-wechat
Advanced tools
[](https://www.npmjs.com/package/qrcode-opencv-wechat)
QR Code scanner in JavaScript, based on a WebAssembly build of OpenCV with Open CV WeChat QR Code Scanner. Provides a much better detection rate and error tolerance.
Ported and rewritten from leidenglai/opencv-js-qrcode for modern browser build and easier usage. Huge thanks to @leidenglai for the previous work and research.
npm i qrcode-opencv-wechat
import { scan } from 'qrcode-opencv-wechat'
const result = await scan(canvas) // Or ImageElement
Upon the first call of scan
, around 3.5MB gzipped of WebAssembly and models will be loaded asynchronously.
You can also preload them with:
import { ready, scan } from 'qrcode-opencv-wechat'
await ready()
const result = await scan(canvas)
In case you want to scan with streams like camera inputs, here is some code snippet for reference
<video id="video">
import { scan } from 'qrcode-opencv-wechat'
const stream = await navigator.mediaDevices.getUserMedia({
audio: false,
video: {
width: 512,
height: 512,
},
})
const video = document.getElementById('video')
video.srcObject = stream
video.play()
async function scanFrame() {
const canvas = document.createElement('canvas')
canvas.width = video.value.videoWidth
canvas.height = video.value.videoHeight
const ctx = canvas.getContext('2d')
ctx.drawImage(videoEl.value!, 0, 0, canvas.width, canvas.height)
const result = await scan(canvas)
if (result?.text)
alert(result?.text)
}
setInterval(scanFrame, 100) // scan one frame every 100ms
MIT License © 2023 Anthony Fu
FAQs
[](https://www.npmjs.com/package/qrcode-opencv-wechat)
The npm package qrcode-opencv-wechat receives a total of 3,719 weekly downloads. As such, qrcode-opencv-wechat popularity was classified as popular.
We found that qrcode-opencv-wechat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.