New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attempt to add 0d/1d mat support to OpenCV #23473
Changes from all commits
b22efac
64a5da1
60fefa1
a8c98e2
d2c8b1e
8aaeb26
d2f1c39
901ace8
ced94fb
0a1a28c
d8af48e
32ed0c1
92d83a3
9f45ae9
1075850
ab60f13
296c284
cf6ed96
53f3706
ab40691
5032600
0e85eee
f72c2aa
06097dc
80c7907
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,8 @@ PERF_TEST_P(PointsNum_Algo, solvePnP, | |
projectPoints(points3d, rvec, tvec, intrinsics, distortion, points2d); | ||
|
||
//add noise | ||
Mat noise(1, (int)points2d.size(), CV_32FC2); | ||
int sz = (int)points2d.size(); | ||
Mat noise(1, &sz, CV_32FC2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Requirement of test modification means that we would broke user code. We need compatibility code to support both inputs (old and new). |
||
randu(noise, 0, 0.01); | ||
cv::add(points2d, noise, points2d); | ||
|
||
|
@@ -93,7 +94,8 @@ PERF_TEST_P(PointsNum_Algo, solvePnPSmallPoints, | |
cv::projectPoints(points3d, rvec, tvec, intrinsics, distortion, points2d); | ||
|
||
//add noise | ||
Mat noise(1, (int)points2d.size(), CV_32FC2); | ||
int npoints = (int)points2d.size(); | ||
Mat noise(1, &npoints, CV_32FC2); | ||
randu(noise, -0.001, 0.001); | ||
cv::add(points2d, noise, points2d); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,6 +243,7 @@ class CV_EXPORTS _InputArray | |
bool isUMat() const; | ||
bool isMatVector() const; | ||
bool isUMatVector() const; | ||
bool isVecVector() const; | ||
bool isMatx() const; | ||
bool isVector() const; | ||
bool isGpuMat() const; | ||
|
@@ -355,6 +356,9 @@ class CV_EXPORTS _OutputArray : public _InputArray | |
UMat& getUMatRef(int i=-1) const; | ||
cuda::GpuMat& getGpuMatRef() const; | ||
std::vector<cuda::GpuMat>& getGpuMatVecRef() const; | ||
std::vector<Mat>& getMatVecRef() const; | ||
std::vector<UMat>& getUMatVecRef() const; | ||
template<typename _Tp> std::vector<std::vector<_Tp> >& getVecVecRef() const; | ||
ogl::Buffer& getOGlBufferRef() const; | ||
cuda::HostMem& getHostMemRef() const; | ||
void create(Size sz, int type, int i=-1, bool allowTransposed=false, _OutputArray::DepthMask fixedDepthMask=static_cast<_OutputArray::DepthMask>(0)) const; | ||
|
@@ -602,7 +606,7 @@ struct CV_EXPORTS MatStep | |
MatStep& operator = (size_t s); | ||
|
||
size_t* p; | ||
size_t buf[2]; | ||
size_t buf[3]; | ||
protected: | ||
MatStep& operator = (const MatStep&); | ||
}; | ||
|
@@ -1510,6 +1514,15 @@ class CV_EXPORTS Mat | |
*/ | ||
void create(const std::vector<int>& sizes, int type); | ||
|
||
/** @brief Creates the matrix of the same size as another array. | ||
|
||
The method is similar to _OutputArray::createSameSize(arr, type), | ||
but is applied to Mat. | ||
@param arr The other array. | ||
@param type New matrix type. | ||
*/ | ||
void createSameSize(InputArray arr, int type); | ||
|
||
/** @brief Increments the reference counter. | ||
|
||
The method increments the reference counter associated with the matrix data. If the matrix header | ||
|
@@ -2134,6 +2147,7 @@ class CV_EXPORTS Mat | |
int dims; | ||
//! the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions | ||
int rows, cols; | ||
int dummy = 153; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will remove it in one of the subsequent commits in a different pull request; |
||
//! pointer to the data | ||
uchar* data; | ||
|
||
|
@@ -2307,6 +2321,8 @@ template<typename _Tp> class Mat_ : public Mat | |
void create(Size _size); | ||
//! equivalent to Mat::create(_ndims, _sizes, DatType<_Tp>::type) | ||
void create(int _ndims, const int* _sizes); | ||
//! equivalent to Mat::create(arr.ndims, arr.size.p, DatType<_Tp>::type) | ||
void createSameSize(InputArray arr); | ||
//! equivalent to Mat::release() | ||
void release(); | ||
//! cross-product | ||
|
@@ -2526,6 +2542,10 @@ class CV_EXPORTS UMat | |
void create(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); | ||
void create(const std::vector<int>& sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); | ||
|
||
//! allocates new matrix data unless the matrix already has specified size and type. | ||
// the size is taken from the specified array. | ||
void createSameSize(InputArray arr, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); | ||
|
||
//! increases the reference counter; use with care to avoid memleaks | ||
void addref(); | ||
//! decreases reference counter; | ||
|
@@ -2980,7 +3000,6 @@ class CV_EXPORTS SparseMat | |
}; | ||
|
||
|
||
|
||
///////////////////////////////// SparseMat_<_Tp> //////////////////////////////////// | ||
|
||
/** @brief Template sparse n-dimensional array class derived from SparseMat | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to swap rows/cols?
This doesn't look like a convenient behavior.