Skip to content

[Feature Request] Extend transpose operator for MatND, Mat with channels and extend API #19751

@JuliaBareeva

Description

@JuliaBareeva
  • OpenCV => 4.5.0
  • Operating System / Platform => Linux, Windows
  • Compiler => any C++
Detailed description

In image preprocessing and postprocessing tasks for neural networks, the transpose operation is often used, for example, from the NumPy library: img.transpose(1, 2, 0). Unfortunately, when we work in C++, we have no way to repeat this operation using OpenCV in one step. As a workaround, I use reshaping and memory copying, which reduces performance a lot.

I think it is possible to implement this since this ability already exists in https://docs.opencv.org/master/d2/d3c/classcv_1_1dnn_1_1PermuteLayer.html

Steps to reproduce
cv::Mat frame = cv::imread(img_path);
cv::cuda::GpuMat gpu_frame(frame), result;
cv::cuda::transpose(gpu_frame, result);
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions