本文整理汇总了C++中UMat::release方法的典型用法代码示例。如果您正苦于以下问题:C++ UMat::release方法的具体用法?C++ UMat::release怎么用?C++ UMat::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMat
的用法示例。
在下文中一共展示了UMat::release方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void BTVL1::collectGarbage()
{
// Mat
curFrame_.release();
prevFrame_.release();
frames_.clear();
forwardMotions_.clear();
backwardMotions_.clear();
outputs_.clear();
srcFrames_.clear();
srcForwardMotions_.clear();
srcBackwardMotions_.clear();
finalOutput_.release();
#ifdef HAVE_OPENCL
// UMat
ucurFrame_.release();
uprevFrame_.release();
uframes_.clear();
uforwardMotions_.clear();
ubackwardMotions_.clear();
uoutputs_.clear();
usrcFrames_.clear();
usrcForwardMotions_.clear();
usrcBackwardMotions_.clear();
#endif
SuperResolution::collectGarbage();
BTVL1_Base::collectGarbage();
}
示例2: uploadKeypoints
void SURF_OCL::uploadKeypoints(const std::vector<KeyPoint> &keypoints, UMat &keypointsGPU)
{
if (keypoints.empty())
keypointsGPU.release();
else
{
Mat keypointsCPU(SURF_OCL::ROWS_COUNT, static_cast<int>(keypoints.size()), CV_32FC1);
float *kp_x = keypointsCPU.ptr<float>(SURF_OCL::X_ROW);
float *kp_y = keypointsCPU.ptr<float>(SURF_OCL::Y_ROW);
int *kp_laplacian = keypointsCPU.ptr<int>(SURF_OCL::LAPLACIAN_ROW);
int *kp_octave = keypointsCPU.ptr<int>(SURF_OCL::OCTAVE_ROW);
float *kp_size = keypointsCPU.ptr<float>(SURF_OCL::SIZE_ROW);
float *kp_dir = keypointsCPU.ptr<float>(SURF_OCL::ANGLE_ROW);
float *kp_hessian = keypointsCPU.ptr<float>(SURF_OCL::HESSIAN_ROW);
for (size_t i = 0, size = keypoints.size(); i < size; ++i)
{
const KeyPoint &kp = keypoints[i];
kp_x[i] = kp.pt.x;
kp_y[i] = kp.pt.y;
kp_octave[i] = kp.octave;
kp_size[i] = kp.size;
kp_dir[i] = kp.angle;
kp_hessian[i] = kp.response;
kp_laplacian[i] = 1;
}
keypointsCPU.copyTo(keypointsGPU);
}
}
示例3: Rect
TEST_P(UMatBasicTests, base)
{
const int align_mask = 3;
roi.x &= ~align_mask;
roi.y &= ~align_mask;
roi.width = (roi.width + align_mask) & ~align_mask;
roi &= Rect(0, 0, ua.cols, ua.rows);
if(useRoi)
{
ua = UMat(ua,roi);
}
UMat ub = ua.clone();
EXPECT_MAT_NEAR(ub,ua,0);
ASSERT_EQ(ua.channels(), cn);
ASSERT_EQ(ua.depth(), depth);
ASSERT_EQ(ua.type(), type);
ASSERT_EQ(ua.elemSize(), a.elemSize());
ASSERT_EQ(ua.elemSize1(), a.elemSize1());
ASSERT_EQ(ub.empty(), ub.cols*ub.rows == 0);
ub.release();
ASSERT_TRUE( ub.empty() );
if(useRoi && a.size() != ua.size())
{
ASSERT_EQ(ua.isSubmatrix(), true);
}
else
{
ASSERT_EQ(ua.isSubmatrix(), false);
}
int dims = randomInt(2,6);
int sz[CV_MAX_DIM];
size_t total = 1;
for(int i = 0; i<dims; i++)
{
sz[i] = randomInt(1,45);
total *= (size_t)sz[i];
}
int new_type = CV_MAKE_TYPE(randomInt(CV_8S,CV_64F),randomInt(1,4));
ub = UMat(dims, sz, new_type);
ASSERT_EQ(ub.total(), total);
}