Closed andyz168 closed 8 months ago
const getEvtParam = (e: Konva.KonvaEventObject<MouseEvent>) => {
return {
e: e,
mouseX: (e.evt.offsetX - dragEndPos.x - canvasWidth / 2) / props.scale + imageWidth / 2,
mouseY: (e.evt.offsetY - dragEndPos.y - canvasHeight / 2) / props.scale + imageHeight / 2,
offsetX: -imageWidth / 2,
offsetY: -imageHeight / 2,
canvasRef: canvasRef,
stageRef: stageRef,
img: image,
};
};
看了代码,前端是用了一个偏移量,保存到数据库中的是鼠标点击的位置+偏移量。
annotations = Annotation._get(project_id=project.project_id, many=True)
for ann in annotations:
if ann.type != "polygon":
continue
r = ann.result.split(",")
r = [float(t) for t in r]
width, height = (
coco.imgs[ann.data_id]["width"],
coco.imgs[ann.data_id]["height"],
)
width = int(width)
height = int(height)
for idx in range(0, len(r), 2):
# r[idx] += width / 2
# r[idx + 1] += height / 2
r[idx] += height / 2
r[idx + 1] += width / 2
bug已经修复,看注释掉的地方 文件地址 paddlelabel/task/instance_segmentation.py
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
win10 分辨率1920*1080,图片用的样例图片也有问题
使用这段代码加载出来的和paddlelabel标记的位置有偏移