Closed b005t3r closed 9 months ago
Why not just call Mat.createBuffer()?
I already have a buffer created and need to copy the contents of the Mat to that buffer.
Can you explain why the commented out parts don't work, please? Am I doing something wrong?
You can look at what Mat.createBuffer() is doing, that's what it does.
OK, I see, so I can't use data()
directly, need to call createBuffer()
to obtain the pointed to the Mat's underlying data?
No, we can use data(), that's what Mat.createBuffer() does, so you can refer to the code in that method: https://github.com/bytedeco/javacpp-presets/blob/master/opencv/src/main/java/org/bytedeco/opencv/opencv_core/AbstractArray.java#L32
But not directly, right? I need to call the rest of the stuff first, like position()
and capacity()
, is that correct?
For some reason I can't copy the data of a Mat instance using the
data()
method (I get a BufferUnderflowException even when I try to copy a single element). BUT when I create an Indexer, accessing data works just fine.Here's the example code:
Commented-out lines throw the exception, the lines below them (which create indexers) work with no issues.
Am I missing something?