Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

qupathExtension {
name = "qupath-extension-djl"
version = "0.4.1"
version = "0.4.2"
group = "io.github.qupath"
description = "QuPath extension to use Deep Java Library"
automaticModule = "qupath.extension.djl"
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/qupath/ext/djl/DjlTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ public static NDArray matToNDArray(NDManager manager, Mat mat, String ndLayout)
array = manager.create(buffer, shape, dataType);
} else if (("NCHW".equals(ndLayout) || "CHW".equals(ndLayout)) && (nChannels == 3L || nChannels == 4L)) {
// Channels-first - an OpenCV blob is defined to have the order NCHW, but an Image can only have 1, 3 or 4 channels
array = manager.create(opencv_dnn.blobFromImage(mat).createBuffer(), shape, dataType);
try (var blob = opencv_dnn.blobFromImage(mat)) {
array = manager.create(blob.createBuffer(), shape, dataType);
}
} else {
// Really awkward strategy to handle channels in an uncommon place (shouldn't actually occur?)
var shapeDims = shape.getShape().clone();
Expand Down