please, use std::min and std::max instead, CV_IMIN,IMAX are obsolete and might be removed in 3.0