Closed cansik closed 1 year ago
Just figured out that I can just create a new matrix with a pointer to the first dimension of the combined result:
Mat first = new Mat(result.size(1), result.size(2), CV_32F, result.ptr(0, 0));
Mat is a 2D matrix, that happens to have elements that can take a couple of channels, so it's kind of HWC, but you're not going to get CHW...?
Ah, yes, it does have some preliminary support for multiple dimensions, but functions like reshape() don't work. I suppose passing around the data might be the best option.
Is it possible to implement the numpy squeeze method in JavaCV?
The output of the dnn
forward()
method sometimes includes the batch number and is of shape[1, nc, nr]
, which means we first have to unpack the first dimension before processing the results. In python there is the nice method callednp.squeeze()
to remove dimension of size1
. How can we implement that in JavaCV? In python you could also just reshape the array, but this does not work in JavaCV:Python
Java
Would be great if someone could give me a hint how to unwrap the result, so I can process it by using cols / rows as usual.