OpenCV Java Preset 中是否有任何等效的图像置换?我的图像表示为 org.bytedeco.javacpp.Mat。我正在使用下面的 JavaCpp OpenCV 预设
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<version>3.0.0-1.1</version>
</dependency>
更新,@Miki 在评论中提出建议后,尝试使用 mixChannel api。但它似乎没有做与 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 );
输出:
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]
我期望 transposedResizedImage 的宽度/高度按照 from_to 数组中的顺序排列