Comments (7)
Thanks for the interest! Can you tell me the relationship between cv::Mat, cvMat_?
from h5cpp.
cv::Mat_
is a thin static-typed accessor for underlying cv::Mat
(which can hold data of any type) for convenience. So e.g. cv::Mat
with CV_F32
type (float) can be wrapped in cv::Mat_<float>
, giving the compiler static knowledge about interpreting the underlying storage.
The type most the time is definitely cv::Mat
, though.
from h5cpp.
To explain more, cv::Mat
has publicly-accessible rows
and cols
data members (for array size), the array is stored always as row-major. Rank of cv::Mat is 2 (when cv::Mat::channels()==1
, 1-channel per pixel) or 3 (with more channels).
Raw data can be accessed with the data pointer cv::Mat::ptr()
, though cv::Mat
does not guarantee being continuous — it can be, and often is, a region inside another, larger, cv::Mat
, and only proxies access to the "parent" data. This can be checked with cv::Mat::isContinuous()
. If not continuous, deep-copy (with continuous storage) can be obtained with cv::Mat::clone()
.
Type of data stored is accessed with cv::Mat::depth()
(which returns the underlying datatype, CV_8U
, CV_16U
and so on).
from h5cpp.
Thanks, will take a look at it in a week or so -- I am up for a presentation, then a workshop.
A copy (you call it deep copy) may be prohibitively expensive with a large matrix, or in cases when the matrix is half the size of the available memory -- erroneous. The 'continuous' case is relatively easy to handle. I am interested in learning more about the cases where cv::Mat::isContinuous()
returns false.
Is this have to do with sub matrices? If I may ask: How are you involved with OpenCV?
from h5cpp.
I am just a regular user of OpenCV. I store most data in Eigen arrays but for some (computer-vision related) algorithms, I map the data to cv::Mat. Dumping those directly to hdf5 would be elegant, but it is mostly a convenience for me.
Non-continuous matrix is a submatrix, yes. Algorithms operate on matrix or sub-matrix (they call it image and region, or region of interest or ROI) without necessarily making the distinction.
The non-continuous case could just fail for now, that would be fair enough. Maybe later some expert (don't think that is me) might write a routine converting ROI information obtained from cv::Mat::locateROI into HDF5 hyperslab specification.
from h5cpp.
An update: thanks for the input! Maybe we could have an online chat on suitable day? I live in Toronto -- time zone wise.
Here is the thing, as it appears OpenCV doesn't use templates to indicate the underlying type, which makes it different from other packages.
The next version H5CPP type system is reworked/upgraded, and can accommodate OpenCV with ease, but won't be available for another few weeks.
The alternative is to make it happen for the current version, and then forward propagate it to the new internal type system. Either way, for an efficient zero copy solution I need to have a good understanding of use case, and behaviour of OpenCV. And perhaps you could help me with that.
best: steve
from h5cpp.
No problem waiting a few weeks for the next type system. I will contact you for a chat, I am Europe-based but we will find some overlap for sure.
from h5cpp.
Related Issues (20)
- Clang (LLVM) Windows Issue
- Eigen simplification (almost-patch) HOT 2
- Read single std::string attribute? HOT 6
- Request for .clangformat
- Packet table flush fails with one element in cache. HOT 10
- h5::pt_t move assignment behaves oddly. HOT 5
- eigen: vectors written as rank-2 arrays HOT 3
- unnecessary breakage with "HDF5" v1.12 HOT 5
- h5cpp.org is down HOT 1
- Exception when using append API with clang HOT 3
- Segmentation violation/abort when using h5::high_throughput with HDF5 1.12 HOT 7
- H5CPP doesn't play well with IDE's HOT 1
- h5cpp compiler warnings
- Eigen example results in HDF5 errors HOT 2
- writing an armadillo matrix produces a transposed matrix in h5 HOT 2
- Groups examples doesn't compile, some functions are missing HOT 1
- How to install the h5pp or the h5cpp-compiler on macOS? HOT 12
- Bug in pipeline_t::set_cache?
- memory leak as a result of using h5::open to create h5::pt_t
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h5cpp.