fix output matrix allocation in cv::subtract(cherry picked from commit 629461c83652e2416ccb6c8685a0788bb6fb15f5)