vue2根据坐标在图片上绘制多个框(带标题)

77 阅读1分钟

组件内容

.image-container { width:700px; height: 752px; position: relative; display: inline-block; } .overlay-canvas { position: absolute; top: 0; left: 0; pointer-events: none; }

页面引入

image-src:图片 boxes:坐标信息 import ImageBoundingBox from '@/components/ImageBoundingBox/index.vue'; 坐标信息数据集合 x1 x2 y1 y2 四个坐标点 label 标题 color 框的颜色 this.boundingBoxes = await this.tiList[0].map(item => { return { x1: item.bbox[0]/54, y1: item.bbox[1]/54, x2: item.bbox[2]/54, y2: item.bbox[7]/54, label: item.index, color: item.correctResult === '1' ? 'green' : item.correctResult === '2' ? 'red' : 'yellow', } })

最终效果

c5d8ea99bfe3f8cd2251082cf0117ea.png