本文整理汇总了C++中cv::OutputArray::getMatRef方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputArray::getMatRef方法的具体用法?C++ OutputArray::getMatRef怎么用?C++ OutputArray::getMatRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv::OutputArray
的用法示例。
在下文中一共展示了OutputArray::getMatRef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glAssert
void BackgroundSubtractorLOBSTER_<ParallelUtils::eGLSL>::getBackgroundDescriptorsImage(cv::OutputArray oBGDescImg) const {
lvDbgExceptionWatch;
CV_Assert(m_bInitialized);
glAssert(m_bGLInitialized && !m_vnBGModelData.empty());
CV_Assert(LBSP::DESC_SIZE==2);
oBGDescImg.create(m_oFrameSize,CV_16UC(int(m_nImgChannels)));
cv::Mat oOutputImg = oBGDescImg.getMatRef();
glBindBuffer(GL_SHADER_STORAGE_BUFFER,getSSBOId(BackgroundSubtractorLOBSTER_::eLOBSTERStorageBuffer_BGModelBinding));
glGetBufferSubData(GL_SHADER_STORAGE_BUFFER,0,m_nBGModelSize*sizeof(uint),(void*)m_vnBGModelData.data());
glErrorCheck;
for(size_t nRowIdx=0; nRowIdx<(size_t)m_oFrameSize.height; ++nRowIdx) {
const size_t nModelRowOffset = nRowIdx*m_nRowStepSize;
const size_t nImgRowOffset = nRowIdx*oOutputImg.step.p[0];
for(size_t nColIdx=0; nColIdx<(size_t)m_oFrameSize.width; ++nColIdx) {
const size_t nModelColOffset = nColIdx*m_nColStepSize+nModelRowOffset;
const size_t nImgColOffset = nColIdx*oOutputImg.step.p[1]+nImgRowOffset;
std::array<float,4> afCurrPxSum = {0.0f,0.0f,0.0f,0.0f};
for(size_t nSampleIdx=0; nSampleIdx<m_nBGSamples; ++nSampleIdx) {
const size_t nModelPxOffset_color = nSampleIdx*m_nSampleStepSize+nModelColOffset;
const size_t nModelPxOffset_desc = nModelPxOffset_color+(m_nBGSamples*m_nSampleStepSize);
for(size_t nChannelIdx=0; nChannelIdx<m_nImgChannels; ++nChannelIdx) {
const size_t nModelTotOffset = nChannelIdx+nModelPxOffset_desc;
afCurrPxSum[nChannelIdx] += m_vnBGModelData[nModelTotOffset];
}
}
for(size_t nChannelIdx=0; nChannelIdx<m_nImgChannels; ++nChannelIdx) {
const size_t nSampleChannelIdx = ((nChannelIdx==3||m_nImgChannels==1)?nChannelIdx:2-nChannelIdx);
const size_t nImgTotOffset = nSampleChannelIdx*2+nImgColOffset;
*(ushort*)(oOutputImg.data+nImgTotOffset) = (ushort)(afCurrPxSum[nChannelIdx]/m_nBGSamples);
}
}
}
}
示例2: findTemplateMatchCandidates
void findTemplateMatchCandidates(
cv::InputArray image,
cv::InputArray templ,
cv::InputArray templMask,
cv::OutputArray candidates,
cv::Size partitionSize,
int maxWeakErrors,
float maxMeanDifference)
{
TemplateMatchCandidates tmc;
tmc.setSourceImage(image.getMat());
tmc.setPartitionSize(partitionSize);
tmc.setTemplateSize(templ.size());
tmc.initialize();
candidates.create(
image.size().height - templ.size().height + 1,
image.size().width - templ.size().width + 1,
CV_8UC1);
tmc.findCandidates(templ.getMat(), templMask.getMat(), candidates.getMatRef(), maxWeakErrors, maxMeanDifference);
}