Skip to content

matchTemplate: Reduce/increase channels #436

Closed

Description

@strarsis

The "base" matrix has got 4 channels (PNG with alphatransparency) and
the second image (JPG without any transparency) which is passed to matchTemplate(...) got 3 channels.

OpenCV Error: Assertion failed ((img.depth() == CV_8U || img.depth() == CV_32F) && img.type() == templ.type())[...]

In my opinion should node-opencv take this into account and add an extra channel to the other matrix.

Is there a workaround where I can add a dummy/empty alphatransparency channel to node-opencv matrix?

Activity

  1. danschultzer commented on Sep 3, 2016

    @danschultzer
    Collaborator

    I don't think matchTemplate handles alpha channel, and in any case, the API in node-opencv should be identical to the API in opencv.

  2. danschultzer commented on Sep 21, 2016

    @danschultzer
    Collaborator

    From the discussion in lovell/sharp#534 (comment), I'll assume this has been resolved. Closing it for now.

  3. strarsis commented on Sep 21, 2016

    @strarsis
    Author

    One can also use Matrix split()+merge(...) methods to remove an alpha channel of a matrix
    so both matrices got equal channel count.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions