It can be judged according to one side of the line segment of the center point of the human body , as shown in the figure above.
The slope of a line segment can be expressed as:
up and down as out of bounds direction
Comparing center_y with temp_y, you can get whether the person crosses the boundary up or down.
Take left and right as the out-of-bounds direction
Comparing center_x with temp_x, you can get whether the person crosses the border left or right.