本文整理汇总了C++中OutputArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputArray::size方法的具体用法?C++ OutputArray::size怎么用?C++ OutputArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputArray
的用法示例。
在下文中一共展示了OutputArray::size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addNoise
void addNoise(InputArray src_, OutputArray dest_, const double sigma, const double sprate, const int seed)
{
if(seed!=0) cv::theRNG().state = seed;
if (dest_.empty() || dest_.size() != src_.size() || dest_.type() != src_.type()) dest_.create(src_.size(), src_.type());
Mat src = src_.getMat();
Mat dest = dest_.getMat();
if (src.channels() == 1)
{
addNoiseMono(src, dest, sigma);
if (sprate != 0)addNoiseSoltPepperMono(dest, dest, sprate, seed);
return;
}
else
{
vector<Mat> s(src.channels());
vector<Mat> d(src.channels());
split(src, s);
for (int i = 0; i < src.channels(); i++)
{
addNoiseMono(s[i], d[i], sigma);
if (sprate != 0)addNoiseSoltPepperMono(d[i], d[i], sprate, seed);
}
cv::merge(d, dest);
}
if (seed != 0) cv::theRNG().state = cv::getTickCount();
}
示例2: PToLie
static void PToLie(InputArray _P, OutputArray Lie){
Mat P = _P.getMat();
CV_Assert(P.cols == P.rows && P.rows == 4);
Mat R = P(Range(0,3),Range(0,3));
Mat T = P(Range(0,3),Range(3,4));
RTToLie(R,T,Lie);
CV_Assert(Lie.size()==Size(6,1));
}
示例3: warpShift
void warpShift(InputArray src_, OutputArray dest_, int shiftx, int shifty, int borderType)
{
Mat src = src_.getMat();
if(dest_.empty() ||dest_.size()!=src_.size() || dest_.type() != src_.type()) dest_.create( src.size(), src.type() );
Mat dest = dest_.getMat();
if(borderType<0)
warpShift_(src,dest,shiftx,shifty);
else
warpShift_(src,dest,shiftx,shifty,borderType);
}
示例4: detect_circles
void Detector::detect_circles(InputArray img, OutputArray circles) {
HoughCircles(img, circles,
CV_HOUGH_GRADIENT,
1, // dp
20, // min dist
30, // param 1
8, // param 2
7, // min radius
11); // max radius
#ifdef DEBUG
cout << "Found " << circles.size() << " circles" << endl;
#endif
}
示例5: RTToLie
static void RTToLie(InputArray _R, InputArray _T, OutputArray Lie ){
Mat R = _R.getMat();
Mat T = _T.getMat();
Lie.create(1,6,T.type());
Mat p = Lie.getMat();
CV_Assert(p.size()==Size(6,1));
p=p.reshape(1,6);
if(T.rows==1){
T = T.t();
}
rodrigues(R).copyTo(p.rowRange(Range(0,3)));
T.copyTo(p.rowRange(Range(3,6)));
CV_Assert(Lie.size()==Size(6,1));
}
示例6: solvePnP
bool solvePnP( InputArray _opoints, InputArray _ipoints,
InputArray _cameraMatrix, InputArray _distCoeffs,
OutputArray _rvec, OutputArray _tvec, bool useExtrinsicGuess, int flags )
{
CV_INSTRUMENT_REGION()
Mat opoints = _opoints.getMat(), ipoints = _ipoints.getMat();
int npoints = std::max(opoints.checkVector(3, CV_32F), opoints.checkVector(3, CV_64F));
CV_Assert( npoints >= 0 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) );
Mat rvec, tvec;
if( flags != SOLVEPNP_ITERATIVE )
useExtrinsicGuess = false;
if( useExtrinsicGuess )
{
int rtype = _rvec.type(), ttype = _tvec.type();
Size rsize = _rvec.size(), tsize = _tvec.size();
CV_Assert( (rtype == CV_32F || rtype == CV_64F) &&
(ttype == CV_32F || ttype == CV_64F) );
CV_Assert( (rsize == Size(1, 3) || rsize == Size(3, 1)) &&
(tsize == Size(1, 3) || tsize == Size(3, 1)) );
}
else
{
int mtype = CV_64F;
// use CV_32F if all PnP inputs are CV_32F and outputs are empty
if (_ipoints.depth() == _cameraMatrix.depth() && _ipoints.depth() == _opoints.depth() &&
_rvec.empty() && _tvec.empty())
mtype = _opoints.depth();
_rvec.create(3, 1, mtype);
_tvec.create(3, 1, mtype);
}
rvec = _rvec.getMat();
tvec = _tvec.getMat();
Mat cameraMatrix0 = _cameraMatrix.getMat();
Mat distCoeffs0 = _distCoeffs.getMat();
Mat cameraMatrix = Mat_<double>(cameraMatrix0);
Mat distCoeffs = Mat_<double>(distCoeffs0);
bool result = false;
if (flags == SOLVEPNP_EPNP || flags == SOLVEPNP_DLS || flags == SOLVEPNP_UPNP)
{
Mat undistortedPoints;
undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
epnp PnP(cameraMatrix, opoints, undistortedPoints);
Mat R;
PnP.compute_pose(R, tvec);
Rodrigues(R, rvec);
result = true;
}
else if (flags == SOLVEPNP_P3P)
{
CV_Assert( npoints == 4);
Mat undistortedPoints;
undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
p3p P3Psolver(cameraMatrix);
Mat R;
result = P3Psolver.solve(R, tvec, opoints, undistortedPoints);
if (result)
Rodrigues(R, rvec);
}
else if (flags == SOLVEPNP_AP3P)
{
CV_Assert( npoints == 4);
Mat undistortedPoints;
undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
ap3p P3Psolver(cameraMatrix);
Mat R;
result = P3Psolver.solve(R, tvec, opoints, undistortedPoints);
if (result)
Rodrigues(R, rvec);
}
else if (flags == SOLVEPNP_ITERATIVE)
{
CvMat c_objectPoints = opoints, c_imagePoints = ipoints;
CvMat c_cameraMatrix = cameraMatrix, c_distCoeffs = distCoeffs;
CvMat c_rvec = rvec, c_tvec = tvec;
cvFindExtrinsicCameraParams2(&c_objectPoints, &c_imagePoints, &c_cameraMatrix,
c_distCoeffs.rows*c_distCoeffs.cols ? &c_distCoeffs : 0,
&c_rvec, &c_tvec, useExtrinsicGuess );
result = true;
}
/*else if (flags == SOLVEPNP_DLS)
{
Mat undistortedPoints;
undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
dls PnP(opoints, undistortedPoints);
Mat R, rvec = _rvec.getMat(), tvec = _tvec.getMat();
bool result = PnP.compute_pose(R, tvec);
if (result)
Rodrigues(R, rvec);
return result;
//.........这里部分代码省略.........
示例7: UpdateShader
//----------------------------------------------------------------------------
bool FxCompiler::UpdateShader (Shader* shader, const Program& program,
InputArray& inputs, OutputArray& outputs, ConstantArray& constants,
SamplerArray& samplers)
{
int numInputs = (int)inputs.size();
if (numInputs != shader->GetNumInputs())
{
ReportError("Mismatch in number of inputs.\n");
return false;
}
int numOutputs = (int)outputs.size();
if (numOutputs != shader->GetNumOutputs())
{
ReportError("Mismatch in number of outputs.\n");
return false;
}
int numConstants = (int)constants.size();
if (numConstants != shader->GetNumConstants())
{
ReportError("Mismatch in number of constants.\n");
return false;
}
int numSamplers = (int)samplers.size();
if (numSamplers != shader->GetNumSamplers())
{
ReportError("Mismatch in number of samplers.\n");
return false;
}
std::string message;
int i;
for (i = 0; i < numInputs; ++i)
{
Input& input = inputs[i];
if (input.Name != shader->GetInputName(i))
{
message = "Mismatch in input names '" +
input.Name +
"' and '" +
shader->GetInputName(i);
ReportError(message);
return false;
}
if (input.Type != shader->GetInputType(i))
{
message = "Mismatch in input types '" +
msVTName[input.Type] +
"' and '" +
msVTName[shader->GetInputType(i)];
ReportError(message);
return false;
}
if (input.Semantic != shader->GetInputSemantic(i))
{
message = "Mismatch in input semantics '" +
msVSName[input.Semantic] +
"' and '" +
msVSName[shader->GetInputSemantic(i)];
ReportError(message);
return false;
}
}
for (i = 0; i < numOutputs; ++i)
{
Output& output = outputs[i];
if (output.Name != shader->GetOutputName(i))
{
message = "Mismatch in output names '" +
output.Name +
"' and '" +
shader->GetOutputName(i);
ReportError(message);
return false;
}
if (output.Type != shader->GetOutputType(i))
{
message = "Mismatch in output types '" +
msVTName[output.Type] +
"' and '" +
msVTName[shader->GetOutputType(i)];
ReportError(message);
return false;
}
if (output.Semantic != shader->GetOutputSemantic(i))
{
message = "Mismatch in output semantics '" +
msVSName[output.Semantic] +
"' and '" +
msVSName[shader->GetOutputSemantic(i)];
//.........这里部分代码省略.........