Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-129

Box Center

Problem

Compute the center of a box in [x1, y1, x2, y2] coordinates.

Return [(x1 + x2) / 2, (y1 + y2) / 2] rounded to 4 decimal places.

Test cases

case 1
in: [[0,0,2,2]]
expected: [1,1]
case 2
in: [[1,1,4,5]]
expected: [2.5,3]
case 3
in: [[0.5,0.25,1.5,1.25]]
expected: [1,0.75]
Starter codePython
def box_center(box):
    # Your code here
    pass

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