I wouldn’t as it looks like you are mixing up versions of the OpenCV main and contrib repositoriess.
DIFFERENT_SIZES_EXTRA
was added to the main repository in
so if you have the test cases from
but not the defines you are using a more recent commit from the contrib than the main repo.
I would rebuild from the tip of the master of both the main and contrib repositories.