本文整理汇总了C++中CV_INSTRUMENT_REGION函数的典型用法代码示例。如果您正苦于以下问题:C++ CV_INSTRUMENT_REGION函数的具体用法?C++ CV_INSTRUMENT_REGION怎么用?C++ CV_INSTRUMENT_REGION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CV_INSTRUMENT_REGION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CV_INSTRUMENT_REGION
void cv::hconcat(const Mat* src, size_t nsrc, OutputArray _dst)
{
CV_INSTRUMENT_REGION();
if( nsrc == 0 || !src )
{
_dst.release();
return;
}
int totalCols = 0, cols = 0;
for( size_t i = 0; i < nsrc; i++ )
{
CV_Assert( src[i].dims <= 2 &&
src[i].rows == src[0].rows &&
src[i].type() == src[0].type());
totalCols += src[i].cols;
}
_dst.create( src[0].rows, totalCols, src[0].type());
Mat dst = _dst.getMat();
for( size_t i = 0; i < nsrc; i++ )
{
Mat dpart = dst(Rect(cols, 0, src[i].cols, src[i].rows));
src[i].copyTo(dpart);
cols += src[i].cols;
}
}
示例2: sqrt64f
void sqrt64f(const double* src, double* dst, int len)
{
CV_INSTRUMENT_REGION();
int i = 0;
#if CV_SIMD_64F
const int VECSZ = v_float64::nlanes;
for( ; i < len; i += VECSZ*2 )
{
if( i + VECSZ*2 > len )
{
if( i == 0 || src == dst )
break;
i = len - VECSZ*2;
}
v_float64 t0 = vx_load(src + i), t1 = vx_load(src + i + VECSZ);
t0 = v_sqrt(t0);
t1 = v_sqrt(t1);
v_store(dst + i, t0); v_store(dst + i + VECSZ, t1);
}
vx_cleanup();
#endif
for( ; i < len; i++ )
dst[i] = std::sqrt(src[i]);
}
示例3: magnitude64f
void magnitude64f(const double* x, const double* y, double* mag, int len)
{
CV_INSTRUMENT_REGION();
int i = 0;
#if CV_SIMD_64F
const int VECSZ = v_float64::nlanes;
for( ; i < len; i += VECSZ*2 )
{
if( i + VECSZ*2 > len )
{
if( i == 0 || mag == x || mag == y )
break;
i = len - VECSZ*2;
}
v_float64 x0 = vx_load(x + i), x1 = vx_load(x + i + VECSZ);
v_float64 y0 = vx_load(y + i), y1 = vx_load(y + i + VECSZ);
x0 = v_sqrt(v_muladd(x0, x0, y0*y0));
x1 = v_sqrt(v_muladd(x1, x1, y1*y1));
v_store(mag + i, x0);
v_store(mag + i + VECSZ, x1);
}
vx_cleanup();
#endif
for( ; i < len; i++ )
{
double x0 = x[i], y0 = y[i];
mag[i] = std::sqrt(x0*x0 + y0*y0);
}
}
示例4: CV_INSTRUMENT_REGION
//void RhoanaGainCompensator::apply(int index, Point /*corner*/, Mat &image, const Mat &/*mask*/)
void RhoanaGainCompensator::apply(int index, Point /*corner*/, InputOutputArray image, InputArray /*mask*/)
{
//image *= gains_(index, 0);
CV_INSTRUMENT_REGION()
multiply(image, gains_(index, 0), image);
}
示例5: getcwd
cv::String getcwd()
{
CV_INSTRUMENT_REGION();
cv::AutoBuffer<char, 4096> buf;
#if defined WIN32 || defined _WIN32 || defined WINCE
#ifdef WINRT
return cv::String();
#else
DWORD sz = GetCurrentDirectoryA(0, NULL);
buf.allocate((size_t)sz);
sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data());
return cv::String(buf.data(), (size_t)sz);
#endif
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__
for(;;)
{
char* p = ::getcwd(buf.data(), buf.size());
if (p == NULL)
{
if (errno == ERANGE)
{
buf.allocate(buf.size() * 2);
continue;
}
return cv::String();
}
break;
}
return cv::String(buf.data(), (size_t)strlen(buf.data()));
#else
return cv::String();
#endif
}
示例6: CV_INSTRUMENT_REGION
void KeyPoint::convert(const std::vector<KeyPoint>& keypoints, std::vector<Point2f>& points2f,
const std::vector<int>& keypointIndexes)
{
CV_INSTRUMENT_REGION();
if( keypointIndexes.empty() )
{
points2f.resize( keypoints.size() );
for( size_t i = 0; i < keypoints.size(); i++ )
points2f[i] = keypoints[i].pt;
}
else
{
points2f.resize( keypointIndexes.size() );
for( size_t i = 0; i < keypointIndexes.size(); i++ )
{
int idx = keypointIndexes[i];
if( idx >= 0 )
points2f[i] = keypoints[idx].pt;
else
{
CV_Error( CV_StsBadArg, "keypointIndexes has element < 0. TODO: process this case" );
//points2f[i] = Point2f(-1, -1);
}
}
}
}
示例7: normHamming
int normHamming(const uchar* a, const uchar* b, int n)
{
CV_INSTRUMENT_REGION()
CV_CPU_DISPATCH(normHamming, (a, b, n),
CV_CPU_DISPATCH_MODES_ALL);
}
示例8: drawKeypoints
void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,
const Scalar& _color, DrawMatchesFlags flags )
{
CV_INSTRUMENT_REGION();
if( !(flags & DrawMatchesFlags::DRAW_OVER_OUTIMG) )
{
if (image.type() == CV_8UC3 || image.type() == CV_8UC4)
{
image.copyTo(outImage);
}
else if( image.type() == CV_8UC1 )
{
cvtColor( image, outImage, COLOR_GRAY2BGR );
}
else
{
CV_Error( Error::StsBadArg, "Incorrect type of input image: " + typeToString(image.type()) );
}
}
RNG& rng=theRNG();
bool isRandColor = _color == Scalar::all(-1);
CV_Assert( !outImage.empty() );
std::vector<KeyPoint>::const_iterator it = keypoints.begin(),
end = keypoints.end();
for( ; it != end; ++it )
{
Scalar color = isRandColor ? Scalar( rng(256), rng(256), rng(256), 255 ) : _color;
_drawKeypoint( outImage, *it, color, flags );
}
}
示例9: CV_INSTRUMENT_REGION
bool VideoCapture::retrieve(OutputArray image, int channel)
{
CV_INSTRUMENT_REGION();
if (!icap.empty())
return icap->retrieveFrame(channel, image);
return false;
}
示例10: invSqrt32f
void invSqrt32f(const float* src, float* dst, int len)
{
CV_INSTRUMENT_REGION();
int i = 0;
#if CV_SIMD
const int VECSZ = v_float32::nlanes;
for( ; i < len; i += VECSZ*2 )
{
if( i + VECSZ*2 > len )
{
if( i == 0 || src == dst )
break;
i = len - VECSZ*2;
}
v_float32 t0 = vx_load(src + i), t1 = vx_load(src + i + VECSZ);
t0 = v_invsqrt(t0);
t1 = v_invsqrt(t1);
v_store(dst + i, t0); v_store(dst + i + VECSZ, t1);
}
vx_cleanup();
#endif
for( ; i < len; i++ )
dst[i] = 1/std::sqrt(src[i]);
}
示例11: detect
void detect( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask )
{
CV_INSTRUMENT_REGION()
std::vector<Point2f> corners;
if (_image.isUMat())
{
UMat ugrayImage;
if( _image.type() != CV_8U )
cvtColor( _image, ugrayImage, COLOR_BGR2GRAY );
else
ugrayImage = _image.getUMat();
goodFeaturesToTrack( ugrayImage, corners, nfeatures, qualityLevel, minDistance, _mask,
blockSize, useHarrisDetector, k );
}
else
{
Mat image = _image.getMat(), grayImage = image;
if( image.type() != CV_8U )
cvtColor( image, grayImage, COLOR_BGR2GRAY );
goodFeaturesToTrack( grayImage, corners, nfeatures, qualityLevel, minDistance, _mask,
blockSize, useHarrisDetector, k );
}
keypoints.resize(corners.size());
std::vector<Point2f>::const_iterator corner_it = corners.begin();
std::vector<KeyPoint>::iterator keypoint_it = keypoints.begin();
for( ; corner_it != corners.end(); ++corner_it, ++keypoint_it )
*keypoint_it = KeyPoint( *corner_it, (float)blockSize );
}
示例12: CV_INSTRUMENT_REGION
bool p3p::solve(cv::Mat& R, cv::Mat& tvec, const cv::Mat& opoints, const cv::Mat& ipoints)
{
CV_INSTRUMENT_REGION();
double rotation_matrix[3][3] = {}, translation[3] = {};
std::vector<double> points;
if (opoints.depth() == ipoints.depth())
{
if (opoints.depth() == CV_32F)
extract_points<cv::Point3f,cv::Point2f>(opoints, ipoints, points);
else
extract_points<cv::Point3d,cv::Point2d>(opoints, ipoints, points);
}
else if (opoints.depth() == CV_32F)
extract_points<cv::Point3f,cv::Point2d>(opoints, ipoints, points);
else
extract_points<cv::Point3d,cv::Point2f>(opoints, ipoints, points);
bool result = solve(rotation_matrix, translation,
points[0], points[1], points[2], points[3], points[4],
points[5], points[6], points[7], points[8], points[9],
points[10], points[11], points[12], points[13], points[14],
points[15], points[16], points[17], points[18], points[19]);
cv::Mat(3, 1, CV_64F, translation).copyTo(tvec);
cv::Mat(3, 3, CV_64F, rotation_matrix).copyTo(R);
return result;
}
示例13: CV_INSTRUMENT_REGION
bool VideoCapture::grab()
{
CV_INSTRUMENT_REGION();
if (!icap.empty())
return icap->grabFrame();
return cvGrabFrame(cap) != 0;
}
示例14: CV_INSTRUMENT_REGION
Stitcher::Status Stitcher::stitch(InputArrayOfArrays images, InputArrayOfArrays masks, OutputArray pano)
{
CV_INSTRUMENT_REGION();
Status status = estimateTransform(images, masks);
if (status != OK)
return status;
return composePanorama(pano);
}
示例15: fastAtan64f
void fastAtan64f(const double *Y, const double *X, double *angle, int len, bool angleInDegrees)
{
CV_INSTRUMENT_REGION()
CALL_HAL(fastAtan64f, cv_hal_fastAtan64f, Y, X, angle, len, angleInDegrees);
CV_CPU_DISPATCH(fastAtan64f, (Y, X, angle, len, angleInDegrees),
CV_CPU_DISPATCH_MODES_ALL);
}