| | |
| | | ) |
| | | if (!image) { |
| | | drawBox(box, '识别失败') |
| | | // 开启识别 |
| | | video.value.play() |
| | | return detectFace() |
| | | } |
| | | const X= jgTime(lsDateTime,new Date()) |
| | | // console.log('----',X,dialogVisible.value) |
| | | // console.log(image) |
| | | if(dialogVisible.value&&X>configData.value.face_push&&isworkTime(new Date())){ |
| | | lsDateTime=new Date() |
| | | // console.log(X,'上传图片间隔') |
| | |
| | | const canvas = document.createElement('canvas') |
| | | canvas.width = video.videoWidth |
| | | canvas.height = video.videoHeight |
| | | canvas.getContext('2d')?.drawImage(video, 0, 0, canvas.width, canvas.height) |
| | | // 参数:图片,裁剪开始x坐标,裁剪开始y坐标,裁剪宽度,裁剪高度,目标x坐标,目标y坐标,目标宽度,目标高度 |
| | | // context.drawImage(image, 100, 100, 200, 200, 0, 0, 200, 200); |
| | | canvas.getContext('2d')?.drawImage(video, startPoint.x-10,startPoint.y-10,width+20,height+20,0,0,width+10,height+10) |
| | | const imgSrc = canvas?.toDataURL('image/png'); |
| | | |
| | | return imgSrc |
| | | } |
| | | // 画盒子 |