Skip to content

CV_8UC3 Mat not convertible to ocl::Image2D #8108

@cuihaoleo

Description

@cuihaoleo

OpenCV version: 3.1.0

Example code:

#include "opencv2/imgproc.hpp"
#include "opencv2/core/ocl.hpp"
int main() {
    cv::UMat m(10, 10, CV_8UC3);
    cv::ocl::Image2D i2d(m);
    return 0;
}

gives:

OpenCV Error: Unknown error code -220 (Image format is not supported) in init, file /build/opencv/src/opencv-3.1.0/modules/core/src/ocl.cpp, line 5917
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv/src/opencv-3.1.0/modules/core/src/ocl.cpp:5917: error: (-220) Image format is not supported in function init

I glanced at the code. Image2D::Impl::getImageFormat in modules/core/src/ocl.cpp writes:

static const int channelOrders[] = { -1, CL_R, CL_RG, -1, CL_RGBA };

If I'm not wrong, 3-channel images are not supported by design. But It seems strange not to support common RGB image as there is CL_RGB channel order in OpenCL.

I think commit da5b316 brought in the change, but commit log didn't give much info. Any reason why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    question (invalid tracker)ask questions and other "no action" items here: https://forum.opencv.org

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions