I meant that if `borderType` is `BORDER_REPLICATE | BORDER_ISOLATED` and `!src.isSubmatrix()` then your condition is `false`, but should be `true`, because `BORDER_ISOLATED` is useless in this case.
The correct condition is:
```
bool isolated = (borderType & BORDER_ISOLATED) != 0;
int borderTypeNI = borderType & ~BORDER_ISOLATED;
if (borderTypeNI == BORDER_REPLICATE && (!src.isSubmatrix() || isolated))
```