I'm using this library to explore OpenCV: https://github.com/bytedeco/javacv
I'm trying to understand how I could get the shape of my Matrix. In Python, this would be something like:
import cv2
image = cv2.imread("example.png")
print(image.shape)
I do not see an equivalent function in the Mat class that would give me the shape of the loaded Matrix. Here is the Java equivalent:
val matrix: Mat = imread("data/Pixel_Artistry.jpeg")
CodePudding user response:
There seems to be no in-built function, but this could be just done like this:
println(s"[${matrix.rows} ${matrix.cols()} ${matrix.channels()}]")