CV-CUDA icon indicating copy to clipboard operation
CV-CUDA copied to clipboard

[BUG] BGRA_to_GRAY and RGBA_to_GRAY Color Conversion Error

Open hunterwn opened this issue 1 year ago • 0 comments

Describe the bug Attempting RGBA/BGRA to Gray color conversion results in an error. ERROR: Invalid convert color code: 10

Steps/Code to reproduce bug Call cvcudaCvtColorSubmit with either NVCV_COLOR_BGRA2GRAY or NVCV_COLOR_RGBA2GRAY as the last parameter.

Expected behavior The color conversion works as expected.

Additional context in the file cvt_color.cu there exists a color conversion function table. It appears that the functions for BGRA_to_GRAY and RGBA_to_GRAY are disabled even though there is code to handle them in the BGR_to_GRAY function.

inline ErrorCode BGR_to_GRAY(const TensorDataStridedCuda &inData, const TensorDataStridedCuda &outData,
                             NVCVColorConversionCode code, cudaStream_t stream)
{
    int bidx = (code == NVCV_COLOR_RGBA2GRAY || code == NVCV_COLOR_RGB2GRAY) ? 2 : 0;
    int sch  = (code == NVCV_COLOR_RGBA2GRAY || code == NVCV_COLOR_BGRA2GRAY) ? 4 : 3;
    // ...
    static const func_t funcs[] = {

        BGR_to_RGB, // CV_BGR2BGRA    =0
        BGR_to_RGB, // CV_BGRA2BGR    =1
        BGR_to_RGB, // CV_BGR2RGBA    =2
        BGR_to_RGB, // CV_RGBA2BGR    =3
        BGR_to_RGB, // CV_BGR2RGB     =4
        BGR_to_RGB, // CV_BGRA2RGBA   =5

        BGR_to_GRAY, // CV_BGR2GRAY    =6
        BGR_to_GRAY, // CV_RGB2GRAY    =7
        GRAY_to_BGR, // CV_GRAY2BGR    =8
        0,           //GRAY_to_BGRA,           // CV_GRAY2BGRA   =9
        0,           //BGRA_to_GRAY,           // CV_BGRA2GRAY   =10
        0,           //RGBA_to_GRAY,           // CV_RGBA2GRAY   =11
        // ...

There are no comments or error messages to suggest that these have been intentionally disabled.

hunterwn avatar Jan 03 '24 15:01 hunterwn