yd_mat = np.float32(np.clip(ycenter + fact_mat * yu_mat, 0, height - 1))