1 | initial version |
The default border handling scheme is reflection (BORDER_REFLECT_101). You want to pass borderType = BORDER_CONSTANT. But for some reason filter2D doesn't let you specify the constant colour to use according to the doc. So not sure if it'll work. In the worse case you can make a slightly larger image, pad the borders with zeros, run the function and get the subimage.