0

Is there any equivalent of permute for image in OpenCV Java Preset ? My image is represented as org.bytedeco.javacpp.Mat. I am using the below JavaCpp OpenCV preset

<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>opencv</artifactId>
    <version>3.0.0-1.1</version>
</dependency>

Update, After @Miki advice in comments, tried using mixChannel api. But it doesn't seem to do the same functionality as permute Code:

Mat responseMat = new Mat(imageViaNetwork.toByteArray());
Mat image =  imdecode(responseMat, -1);
Mat resizedImage = new Mat(image);
resize(image, resizedImage,new opencv_core.Size(height, width),0,0,  opencv_imgproc.INTER_LINEAR);
Mat transposedResizedImage = new Mat(resizedImage);
int from_to[] = { 0,2, 1,0, 2,1 };
org.bytedeco.javacpp.opencv_core.mixChannels(resizedImage, 1,  transposedResizedImage, 1, from_to, 3 );

Output:

resizedImage: org.bytedeco.javacpp.opencv_core$Mat[width=300,height=200,depth=8,channels=3]

transposedResizedImage: org.bytedeco.javacpp.opencv_core$Mat[width=300,height=200,depth=8,channels=3]

I was expecting width/height of transposedResizedImage to be permuted as per order in from_to array

  • equivalent in OpenCV should be [mixChannels](http://docs.opencv.org/master/d2/de8/group__core__array.html#ga51d768c270a1cdd3497255017c4504be&gsc.tab=0). – Miki Mar 02 '16 at 22:20
  • @Miki Thanks. I couldn't find an equivalent one in Java OpenCV though. Any idea what's the equivalent one there ? – ashish bhutani Mar 03 '16 at 07:43
  • in OpenCV Java Wrapper should be `Core.mixChannels(...)`. No idea about javacpp. – Miki Mar 03 '16 at 07:45

0 Answers0