1 | initial version |
The Matlab rangefilt()
function does, according to its documentation, a what it's called morphological gradient. The morphological gradient is the operation resultant from applying over an image a dilation followed by an erosion (see more details here). Such thing is easily achievable with OpenCV function morphologyEx()
:
morphologyEx(input, output, MORPH_GRADIENT, Mat()); //C++, Python equivalent available
The Mat()
kernel is simply the 3x3 neighborhood. As in Matlab, you can change such neighborhood to the one desired by creating a structuring element (with getStructuringElement()).