Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CV_16F support for OpenCV Java.

I see that in OpenCv 4.0.0 version includes support for half float type. It looks like it is not available in Java wrapper. In addition to that, the value assigned to the CV_16F - 7 is already used by other enum value: CV_USRTYPE1 So my question is that assuming that I change the CvType the following way, would it be sufficient to use half floats from java? :

// type depth constants
public static final int
        CV_8U = 0, CV_8S = 1,
        CV_16U = 2, CV_16S = 3,
        CV_32S = 4,
        CV_32F = 5,
        CV_64F = 6,
        CV_16F = 7;

// predefined type constants
public static final int
        CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
        CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
        CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
        CV_16SC1 = CV_16SC(1), CV_16SC2 = CV_16SC(2), CV_16SC3 = CV_16SC(3), CV_16SC4 = CV_16SC(4),
        CV_32SC1 = CV_32SC(1), CV_32SC2 = CV_32SC(2), CV_32SC3 = CV_32SC(3), CV_32SC4 = CV_32SC(4),
        CV_32FC1 = CV_32FC(1), CV_32FC2 = CV_32FC(2), CV_32FC3 = CV_32FC(3), CV_32FC4 = CV_32FC(4),
        CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4)
        // Half Float type:
        CV_16FC1 = CV_16FC(1), CV_16FC2 = CV_16FC(2), CV_16FC3 = CV_16FC(3), CV_16FC4 = CV_16FC(4);

public static final int CV_16FC(int ch) {
    return makeType(CV_16F, ch);
}