It is never a good idea to use direct codes where enums provided by the framework...
If you check the source code (OpenCV is on GitHub!) you will see this:
switch( op )
{
case MORPH_ERODE:
break;
case MORPH_DILATE:
break;
case MORPH_OPEN:
break;
case CV_MOP_CLOSE:
break;
case CV_MOP_GRADIENT:
break;
case CV_MOP_TOPHAT:
break;
case CV_MOP_BLACKHAT:
break;
default:
CV_Error( CV_StsBadArg, "unknown morphological operation" );
}
And if you search for the enum behind you will see this:
enum MorphTypes{
MORPH_ERODE = 0, MORPH_DILATE = 1, MORPH_OPEN = 2, MORPH_CLOSE = 3, MORPH_GRADIENT = 4, MORPH_TOPHAT = 5, MORPH_BLACKHAT = 6 };