Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-130

XYWH to XYXY

Problem

Convert a box from [x, y, w, h] to [x1, y1, x2, y2] with x2 = x + w and y2 = y + h. Round each value to 4 decimal places.

Test cases

case 1
in: [[1,2,3,4]]
expected: [1,2,4,6]
case 2
in: [[0,0,0,0]]
expected: [0,0,0,0]
case 3
in: [[2.5,3.5,1,2]]
expected: [2.5,3.5,3.5,5.5]
Starter codePython
def xywh_to_xyxy(box):
    # Your code here
    pass

3 test cases · run your code against them in the editor