Skip to content

No UMat support in functions split() and merge() #12231

Closed

Description

@AMI-Systems

Unlike many other functions, the two functions split() and merge() do not support the use of the UMat class.

It is not possible to split a three channel UMat into an array (or vector) of three UMat directly without using the method getMat().

The output (second argument) can't be an array of UMat.

Same applies to mixChannels()

Activity

  1. AMI-Systems commented on Aug 16, 2018

    @AMI-Systems
    Author

    It is not a question how to solve it.

    The split() and the merge() functions should be expanded to support UMat class in accordance to other image functions.

  2. alalek commented on Aug 16, 2018

    @alalek
    Member

    Raw arrays (pointers) are unsafe and these interfaces should be deprecated / dropped / removed.

    UMat has support via std::vector<UMat> as cv::InputArrayOfArrays (and probably via std::array<UMat> in C++11).

  3. AMI-Systems commented on Aug 17, 2018

    @AMI-Systems
    Author

    ok, thanx.

  4. buni-rock commented on Aug 20, 2018

    @buni-rock

    @alalek : what that really means? How can I get my way around using the split and merge with UMat?

  5. AMI-Systems commented on Aug 20, 2018

    @AMI-Systems
    Author

    Maybe the documentation is unclear. The accepted "dst output array" parameter does not mean plain "array" ( UMat m[3]; ) but vector ( std::vector m ).

  6. alalek commented on Aug 20, 2018

    @alalek
    Member

    There are different overloads for these functions. Mentioned one doesn't work, but other works - check existed tests.

  7. JulienMaille commented on Jun 3, 2019

    @JulienMaille
    Contributor

    @alalek May I ask what is the recommended way (using Python) to merge 2 UMat into a single 2-channels UMat?

  8. zachlowry commented on Oct 23, 2019

    @zachlowry
    Contributor

    Is there still no way to split/merge a UMat in Python?

  9. tyler274 commented on Nov 7, 2020

    @tyler274

    Are python users still left up a creek without a paddle here?

  10. Huud commented on Dec 21, 2020

    @Huud

    Since this is the first result in google, you can use mixChannels with UMat, but instead of writing it like this:

    cv::mixChannels(&mat1, 1, &mat2, 1, from_to, 3);
    

    do it like this:

    cv::mixChannels(mat1, mat2,  from_to, 3);
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question (invalid tracker)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions