From e491cdb48129752324c4e3764f99bd9203c56dec Mon Sep 17 00:00:00 2001
From: lgq <1015864684@qq.com>
Date: 星期二, 31 三月 2026 09:48:44 +0800
Subject: [PATCH] 1.新增VF205门禁机代码
---
vf205_access/dxmodules/cameraCalibrationWorker.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/vf205_access/dxmodules/cameraCalibrationWorker.js b/vf205_access/dxmodules/cameraCalibrationWorker.js
new file mode 100644
index 0000000..4aaa65a
--- /dev/null
+++ b/vf205_access/dxmodules/cameraCalibrationWorker.js
@@ -0,0 +1,57 @@
+//build:20240524
+//鐢ㄤ簬绠�鍖朿ameraCalibration缁勪欢鐨勪娇鐢紝鎶奵ameraCalibration灏佽鍦ㄨ繖涓獁orker閲岋紝浣跨敤鑰呭彧闇�瑕佽闃卐ventcenter鐨勪簨浠跺氨鍙互鐩戝惉cameraCalibration
+import log from './dxLogger.js'
+import cameraCalibration from './dxCameraCalibration.js'
+import capturer from './dxCapturer.js'
+import std from './dxStd.js'
+import bus from './dxEventBus.js'
+import dxMap from './dxMap.js'
+import * as os from "os";
+const map = dxMap.get('default')
+const options = map.get("__cameraCalibration__run_init")
+
+function run() {
+ cameraCalibration.init()
+ log.info('cameraCalibration start......')
+ let startTime = new Date().getTime()
+ let cnt = 0
+ let timerId = std.setInterval(() => {
+ try {
+ let imageRgb = capturer.readImage(options.capturerRgbId)
+ let imageNir = capturer.readImage(options.capturerNirId)
+ let res = cameraCalibration.calibrationFromImage(imageRgb, imageNir, cnt)
+ if (res) {
+ if (cnt >= 1) {
+ log.info("涓ゆ鏍囧畾鎴愬姛锛岀粨鏉熸爣瀹�")
+ cameraCalibration.getMap(imageRgb, imageNir, cnt, "/app/path.txt")
+ bus.fire(cameraCalibration.RECEIVE_MSG, "success1")
+ capturer.destroyImage(imageRgb)
+ capturer.destroyImage(imageNir)
+ std.clearInterval(timerId)
+ }
+ log.info("绗�" + (cnt + 1) + "娆℃爣瀹氭垚鍔�")
+ bus.fire(cameraCalibration.RECEIVE_MSG, "success0")
+ cnt += 1
+ log.info("寮�濮嬭繘琛岀" + (cnt + 1) + "娆℃爣瀹�")
+ } else {
+ log.error("绗�" + (cnt + 1) + "娆℃爣瀹氬け璐ワ紝閲嶈瘯涓�")
+ }
+ capturer.destroyImage(imageRgb)
+ capturer.destroyImage(imageNir)
+ let endTime = new Date().getTime()
+ if (endTime - startTime > options.timeout * 1000) {
+ log.error('鏍囧畾瓒呮椂锛岃閲嶆柊鎵ц鏍囧畾')
+ bus.fire(cameraCalibration.RECEIVE_MSG, "timeout")
+ std.clearInterval(timerId)
+ }
+ } catch (error) {
+ log.error(error, error.stack)
+ }
+ }, 10)
+}
+
+try {
+ run()
+} catch (error) {
+ log.error(error, error.stack)
+}
\ No newline at end of file
--
Gitblit v1.9.3