Closed frg-x closed 2 months ago
All classes extend Vec
(except those extend CvVec
like Vec3b
) stand for vector wrappers
, i.e., VecMat
is a wrapper of vector<Mat>
.
The Vec
has a constructor Vec.fromList()
, which allows you construct a Vec from a dart List, you can also try to call extension methods like cvd
or asList
to construct them. (But I gradually realize that .cvd
may not be a good method name, may change it to asVec
or something in the future.)
You can refer to test/
to find the examples.
Also, as for calcHist, according to the document of official opencv, https://docs.opencv.org/4.x/d6/dc7/group__imgproc__hist.html#ga4b2b5fd75503ff9e6844cc4dcdaed35d , the input must be a vector or a pointer, so you have to wrap your single image to a VecMat
, e.g.,
final myimg = ...;
final VecMat imgs = cv.VecMat.fromList([myimg]);
// or
final VecMat imgs = [myimg].cvd;
Thanks a lot! 👍
Extension asVec()
was added for List such as List<Point>
and List<Mat>
in v1.2.2, if no further problems, I am going to close this issus, feel free to reopen it if you still have any questions.
Question
There are many specific variable types in the
opencv_dart
package. How can I convert or interpret different specific variable types between each other, such asMat
toVecMat
, orList
toVecPoint
?For instance, I need to use the
calcHist()
method, but how can I pass aVecMat
as the first parameter when I only have aMat
? How do I passVecI32
,VecF32
,VecVecPoint
or how do I create these types of variables from other Dart native variable types?