mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -1982,7 +1982,7 @@ struct RGB2Lab_f
|
||||
clipv(bvec0); clipv(bvec1);
|
||||
#undef clipv
|
||||
/* int iR = R*LAB_BASE, iG = G*LAB_BASE, iB = B*LAB_BASE, iL, ia, ib; */
|
||||
v_float32 basef = vx_setall_f32(LAB_BASE);
|
||||
v_float32 basef = vx_setall_f32(static_cast<float>(LAB_BASE));
|
||||
rvec0 = v_mul(rvec0, basef), gvec0 = v_mul(gvec0, basef), bvec0 = v_mul(bvec0, basef);
|
||||
rvec1 = v_mul(rvec1, basef), gvec1 = v_mul(gvec1, basef), bvec1 = v_mul(bvec1, basef);
|
||||
|
||||
@@ -2013,14 +2013,14 @@ struct RGB2Lab_f
|
||||
b_vec0 = v_cvt_f32(i_bvec0); b_vec1 = v_cvt_f32(i_bvec1);
|
||||
|
||||
/* dst[i] = L*100.0f */
|
||||
v_float32 v100dBase = vx_setall_f32(100.0f/LAB_BASE);
|
||||
v_float32 v100dBase = vx_setall_f32(100.0f / static_cast<float>(LAB_BASE));
|
||||
l_vec0 = v_mul(l_vec0, v100dBase);
|
||||
l_vec1 = v_mul(l_vec1, v100dBase);
|
||||
/*
|
||||
dst[i + 1] = a*256.0f - 128.0f;
|
||||
dst[i + 2] = b*256.0f - 128.0f;
|
||||
*/
|
||||
v_float32 v256dBase = vx_setall_f32(256.0f/LAB_BASE), vm128 = vx_setall_f32(-128.f);
|
||||
v_float32 v256dBase = vx_setall_f32(256.0f / static_cast<float>(LAB_BASE)), vm128 = vx_setall_f32(-128.f);
|
||||
a_vec0 = v_fma(a_vec0, v256dBase, vm128);
|
||||
a_vec1 = v_fma(a_vec1, v256dBase, vm128);
|
||||
b_vec0 = v_fma(b_vec0, v256dBase, vm128);
|
||||
@@ -2038,10 +2038,10 @@ struct RGB2Lab_f
|
||||
float G = clip(src[1]);
|
||||
float B = clip(src[bIdx^2]);
|
||||
|
||||
int iR = cvRound(R*LAB_BASE), iG = cvRound(G*LAB_BASE), iB = cvRound(B*LAB_BASE);
|
||||
int iR = cvRound(R*static_cast<float>(LAB_BASE)), iG = cvRound(G*static_cast<float>(LAB_BASE)), iB = cvRound(B*static_cast<float>(LAB_BASE));
|
||||
int iL, ia, ib;
|
||||
trilinearInterpolate(iR, iG, iB, LABLUVLUTs16.RGB2LabLUT_s16, iL, ia, ib);
|
||||
float L = iL*1.0f/LAB_BASE, a = ia*1.0f/LAB_BASE, b = ib*1.0f/LAB_BASE;
|
||||
float L = iL*1.0f/static_cast<float>(LAB_BASE), a = ia*1.0f/static_cast<float>(LAB_BASE), b = ib*1.0f/static_cast<float>(LAB_BASE);
|
||||
|
||||
dst[i] = L*100.0f;
|
||||
dst[i + 1] = a*256.0f - 128.0f;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace cv {
|
||||
namespace hal {
|
||||
|
||||
// 8u, 16u, 32f
|
||||
static void cvtBGRtoYUV(const uchar * src_data, size_t src_step,
|
||||
void cvtBGRtoYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int scn, bool swapBlue, bool isCbCr, AlgorithmHint hint)
|
||||
@@ -71,7 +71,7 @@ static void cvtBGRtoYUV(const uchar * src_data, size_t src_step,
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
static void cvtYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
void cvtYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int depth, int dcn, bool swapBlue, bool isCbCr, AlgorithmHint hint)
|
||||
@@ -128,7 +128,7 @@ static void cvtYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
static void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar * uv_data, size_t uv_step,
|
||||
void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar * uv_data, size_t uv_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx, AlgorithmHint hint)
|
||||
@@ -151,7 +151,7 @@ static void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar
|
||||
// 4:2:0, two planes in one array: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
static void cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
void cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx, AlgorithmHint hint)
|
||||
@@ -173,7 +173,7 @@ static void cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
static void cvtTwoPlaneYUVtoBGR(const uchar * y_data, const uchar * uv_data, size_t src_step,
|
||||
void cvtTwoPlaneYUVtoBGR(const uchar * y_data, const uchar * uv_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx, AlgorithmHint hint)
|
||||
@@ -186,7 +186,7 @@ static void cvtTwoPlaneYUVtoBGR(const uchar * y_data, const uchar * uv_data, siz
|
||||
// 4:2:0, three planes in one array: Y, U, V
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
static void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx, AlgorithmHint hint)
|
||||
@@ -207,7 +207,7 @@ static void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
// 4:2:0, three planes in one array: Y, U, V
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
static void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int scn, bool swapBlue, int uIdx, AlgorithmHint hint)
|
||||
@@ -225,10 +225,27 @@ static void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * y_data, uchar * uv_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int scn, bool swapBlue, int uIdx)
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
CALL_HAL(cvtBGRtoTwoPlaneYUV, cv_hal_cvtBGRtoTwoPlaneYUV,
|
||||
src_data, src_step, y_data, dst_step, uv_data, dst_step, width, height, scn, swapBlue, uIdx);
|
||||
|
||||
CV_CPU_DISPATCH(cvtBGRtoTwoPlaneYUV, (src_data, src_step, y_data, uv_data, dst_step, width, height, scn, swapBlue, uIdx),
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
// 4:2:2 interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
static void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int dcn, bool swapBlue, int uIdx, int ycn, AlgorithmHint hint)
|
||||
@@ -249,7 +266,7 @@ static void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
// 4:2:2 interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 14-bit fixed-point arithmetics is used
|
||||
static void cvtOnePlaneBGRtoYUV(const uchar * src_data, size_t src_step,
|
||||
void cvtOnePlaneBGRtoYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
int scn, bool swapBlue, int uIdx, int ycn, AlgorithmHint hint)
|
||||
|
||||
@@ -368,10 +368,6 @@ CNode& ContourScanner_::makeContour(schar& nbd_, const bool is_hole, const int x
|
||||
const Point start_pt(x - (is_hole ? 1 : 0), y);
|
||||
|
||||
CNode& res = tree.newElem();
|
||||
if (isChain)
|
||||
res.body.codes.reserve(200);
|
||||
else
|
||||
res.body.pts.reserve(200);
|
||||
res.body.isHole = is_hole;
|
||||
res.body.isChain = isChain;
|
||||
res.body.origin = start_pt + offset;
|
||||
|
||||
@@ -1027,8 +1027,8 @@ EllipseEx( Mat& img, Point2l center, Size2l axes,
|
||||
for (unsigned int i = 0; i < _v.size(); ++i)
|
||||
{
|
||||
Point2l pt;
|
||||
pt.x = (int64)cvRound(_v[i].x / XY_ONE) << XY_SHIFT;
|
||||
pt.y = (int64)cvRound(_v[i].y / XY_ONE) << XY_SHIFT;
|
||||
pt.x = (int64)cvRound(_v[i].x / static_cast<double>(XY_ONE)) << XY_SHIFT;
|
||||
pt.y = (int64)cvRound(_v[i].y / static_cast<double>(XY_ONE)) << XY_SHIFT;
|
||||
pt.x += cvRound(_v[i].x - pt.x);
|
||||
pt.y += cvRound(_v[i].y - pt.y);
|
||||
if (pt != prevPt) {
|
||||
@@ -1645,7 +1645,7 @@ static void
|
||||
ThickLine( Mat& img, Point2l p0, Point2l p1, const void* color,
|
||||
int thickness, int line_type, int flags, int shift )
|
||||
{
|
||||
static const double INV_XY_ONE = 1./XY_ONE;
|
||||
static const double INV_XY_ONE = 1./static_cast<double>(XY_ONE);
|
||||
|
||||
p0.x <<= XY_SHIFT - shift;
|
||||
p0.y <<= XY_SHIFT - shift;
|
||||
@@ -1981,8 +1981,8 @@ void ellipse(InputOutputArray _img, const RotatedRect& box, const Scalar& color,
|
||||
int _angle = cvRound(box.angle);
|
||||
Point2l center(cvRound(box.center.x),
|
||||
cvRound(box.center.y));
|
||||
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*XY_ONE);
|
||||
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*XY_ONE);
|
||||
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*static_cast<float>(XY_ONE));
|
||||
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*static_cast<float>(XY_ONE));
|
||||
Size2l axes(cvRound(box.size.width),
|
||||
cvRound(box.size.height));
|
||||
axes.width = (axes.width << (XY_SHIFT - 1)) + cvRound((box.size.width - axes.width)*(XY_ONE>>1));
|
||||
@@ -2153,21 +2153,70 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
|
||||
CV_Assert(ncontours <= (size_t)std::numeric_limits<int>::max());
|
||||
if (lineType == cv::LINE_AA && _image.depth() != CV_8U)
|
||||
lineType = 8;
|
||||
Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
|
||||
Mat image = _image.getMat();
|
||||
Mat_<Vec4i> hierarchy = _hierarchy.getMat();
|
||||
|
||||
if (thickness >= 0) // contour lines
|
||||
int i = 0, end = (int)ncontours;
|
||||
if (contourIdx >= 0)
|
||||
{
|
||||
double color_buf[4] {};
|
||||
scalarToRawData(color, color_buf, _image.type(), 0 );
|
||||
int i = 0, end = (int)ncontours;
|
||||
if (contourIdx >= 0)
|
||||
i = contourIdx;
|
||||
end = i + 1;
|
||||
}
|
||||
std::vector<int> indexesToFill;
|
||||
if (hierarchy.empty() || maxLevel == 0)
|
||||
{
|
||||
indexesToFill.resize(end - i);
|
||||
std::iota(indexesToFill.begin(), indexesToFill.end(), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::stack<int> indexes;
|
||||
for (; i != end; ++i)
|
||||
{
|
||||
i = contourIdx;
|
||||
end = i + 1;
|
||||
// either all from the top level or a single contour
|
||||
if (hierarchy(i)[3] < 0 || contourIdx >= 0)
|
||||
indexes.push(i);
|
||||
}
|
||||
for (; i < end; ++i)
|
||||
while (!indexes.empty())
|
||||
{
|
||||
// get current element
|
||||
const int cur = indexes.top();
|
||||
indexes.pop();
|
||||
|
||||
// check current element depth
|
||||
int curLevel = -1;
|
||||
int par = cur;
|
||||
while (par >= 0)
|
||||
{
|
||||
par = hierarchy(par)[3]; // parent
|
||||
++curLevel;
|
||||
}
|
||||
if (curLevel <= maxLevel)
|
||||
{
|
||||
indexesToFill.push_back(cur);
|
||||
}
|
||||
|
||||
int next = hierarchy(cur)[2]; // first child
|
||||
while (next > 0)
|
||||
{
|
||||
indexes.push(next);
|
||||
next = hierarchy(next)[0]; // next sibling
|
||||
}
|
||||
}
|
||||
}
|
||||
std::vector<Mat> contoursToFill;
|
||||
contoursToFill.reserve(indexesToFill.size());
|
||||
for (const int& idx : indexesToFill)
|
||||
contoursToFill.emplace_back(_contours.getMat(idx));
|
||||
|
||||
if (thickness < 0)
|
||||
fillPoly(image, contoursToFill, color, lineType, 0, offset);
|
||||
else
|
||||
{
|
||||
double color_buf[4]{};
|
||||
scalarToRawData(color, color_buf, _image.type(), 0);
|
||||
for (const Mat& cnt : contoursToFill)
|
||||
{
|
||||
Mat cnt = _contours.getMat(i);
|
||||
if (cnt.empty())
|
||||
continue;
|
||||
const int npoints = cnt.checkVector(2, CV_32S);
|
||||
@@ -2181,59 +2230,4 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
|
||||
}
|
||||
}
|
||||
}
|
||||
else // filled polygons
|
||||
{
|
||||
int i = 0, end = (int)ncontours;
|
||||
if (contourIdx >= 0)
|
||||
{
|
||||
i = contourIdx;
|
||||
end = i + 1;
|
||||
}
|
||||
std::vector<int> indexesToFill;
|
||||
if (hierarchy.empty() || maxLevel == 0)
|
||||
{
|
||||
for (; i != end; ++i)
|
||||
indexesToFill.push_back(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::stack<int> indexes;
|
||||
for (; i != end; ++i)
|
||||
{
|
||||
// either all from the top level or a single contour
|
||||
if (hierarchy.at<Vec4i>(i)[3] < 0 || contourIdx >= 0)
|
||||
indexes.push(i);
|
||||
}
|
||||
while (!indexes.empty())
|
||||
{
|
||||
// get current element
|
||||
const int cur = indexes.top();
|
||||
indexes.pop();
|
||||
|
||||
// check current element depth
|
||||
int curLevel = -1;
|
||||
int par = cur;
|
||||
while (par >= 0)
|
||||
{
|
||||
par = hierarchy.at<Vec4i>(par)[3]; // parent
|
||||
++curLevel;
|
||||
}
|
||||
if (curLevel <= maxLevel)
|
||||
{
|
||||
indexesToFill.push_back(cur);
|
||||
}
|
||||
|
||||
int next = hierarchy.at<Vec4i>(cur)[2]; // first child
|
||||
while (next > 0)
|
||||
{
|
||||
indexes.push(next);
|
||||
next = hierarchy.at<Vec4i>(next)[0]; // next sibling
|
||||
}
|
||||
}
|
||||
}
|
||||
std::vector<Mat> contoursToFill;
|
||||
for (const int & idx : indexesToFill)
|
||||
contoursToFill.push_back(_contours.getMat(idx));
|
||||
fillPoly(image, contoursToFill, color, lineType, 0, offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,7 +692,11 @@ namespace
|
||||
getContourPoints(edges, dx, dy, points);
|
||||
|
||||
features.resize(levels_ + 1);
|
||||
std::for_each(features.begin(), features.end(), [=](std::vector<Feature>& e) { e.clear(); e.reserve(maxBufferSize_); });
|
||||
const size_t maxBufferSize = maxBufferSize_;
|
||||
std::for_each(features.begin(), features.end(), [maxBufferSize](std::vector<Feature>& e) {
|
||||
e.clear();
|
||||
e.reserve(maxBufferSize);
|
||||
});
|
||||
|
||||
for (size_t i = 0; i < points.size(); ++i)
|
||||
{
|
||||
|
||||
@@ -1216,7 +1216,7 @@ void cv::calcHist( InputArrayOfArrays images, const std::vector<int>& channels,
|
||||
CV_OCL_RUN(images.total() == 1 && channels.size() == 1 && images.channels(0) == 1 &&
|
||||
channels[0] == 0 && images.isUMatVector() && mask.empty() && !accumulate &&
|
||||
histSize.size() == 1 && histSize[0] == BINS && ranges.size() == 2 &&
|
||||
ranges[0] == 0 && ranges[1] == BINS,
|
||||
ranges[0] == 0 && ranges[1] == static_cast<float>(BINS),
|
||||
ocl_calcHist(images, hist))
|
||||
|
||||
int i, dims = (int)histSize.size(), rsz = (int)ranges.size(), csz = (int)channels.size();
|
||||
|
||||
@@ -120,7 +120,7 @@ static void
|
||||
HoughLinesStandard( InputArray src, OutputArray lines, int type,
|
||||
float rho, float theta,
|
||||
int threshold, int linesMax,
|
||||
double min_theta, double max_theta )
|
||||
double min_theta, double max_theta, bool use_edgeval = false )
|
||||
{
|
||||
CV_CheckType(type, type == CV_32FC2 || type == CV_32FC3, "Internal error");
|
||||
|
||||
@@ -184,17 +184,31 @@ HoughLinesStandard( InputArray src, OutputArray lines, int type,
|
||||
irho, tabSin, tabCos);
|
||||
|
||||
// stage 1. fill accumulator
|
||||
for( i = 0; i < height; i++ )
|
||||
for( j = 0; j < width; j++ )
|
||||
{
|
||||
if( image[i * step + j] != 0 )
|
||||
for(int n = 0; n < numangle; n++ )
|
||||
{
|
||||
int r = cvRound( j * tabCos[n] + i * tabSin[n] );
|
||||
r += (numrho - 1) / 2;
|
||||
accum[(n+1) * (numrho+2) + r+1]++;
|
||||
}
|
||||
}
|
||||
if (use_edgeval) {
|
||||
for( i = 0; i < height; i++ )
|
||||
for( j = 0; j < width; j++ )
|
||||
{
|
||||
if( image[i * step + j] != 0 )
|
||||
for(int n = 0; n < numangle; n++ )
|
||||
{
|
||||
int r = cvRound( j * tabCos[n] + i * tabSin[n] );
|
||||
r += (numrho - 1) / 2;
|
||||
accum[(n + 1) * (numrho + 2) + r + 1] += image[i * step + j];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for( i = 0; i < height; i++ )
|
||||
for( j = 0; j < width; j++ )
|
||||
{
|
||||
if( image[i * step + j] != 0 )
|
||||
for(int n = 0; n < numangle; n++ )
|
||||
{
|
||||
int r = cvRound( j * tabCos[n] + i * tabSin[n] );
|
||||
r += (numrho - 1) / 2;
|
||||
accum[(n + 1) * (numrho + 2) + r + 1]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// stage 2. find local maximums
|
||||
findLocalMaximums( numrho, numangle, threshold, accum, _sort_buf );
|
||||
@@ -561,7 +575,8 @@ HoughLinesProbabilistic( Mat& image,
|
||||
Point line_end[2];
|
||||
float a, b;
|
||||
int* adata = accum.ptr<int>();
|
||||
int i = point.y, j = point.x, k, x0, y0, dx0, dy0, xflag;
|
||||
int i = point.y, j = point.x, k, xflag;
|
||||
int64_t x0, y0, dx0, dy0;
|
||||
int good_line;
|
||||
const int shift = 16;
|
||||
|
||||
@@ -612,8 +627,8 @@ HoughLinesProbabilistic( Mat& image,
|
||||
|
||||
for( k = 0; k < 2; k++ )
|
||||
{
|
||||
int gap = 0, x = x0, y = y0, dx = dx0, dy = dy0;
|
||||
|
||||
int gap = 0;
|
||||
int64_t x = x0, y = y0, dx = dx0, dy = dy0 ;
|
||||
if( k > 0 )
|
||||
dx = -dx, dy = -dy;
|
||||
|
||||
@@ -622,7 +637,7 @@ HoughLinesProbabilistic( Mat& image,
|
||||
for( ;; x += dx, y += dy )
|
||||
{
|
||||
uchar* mdata;
|
||||
int i1, j1;
|
||||
int64_t i1, j1;
|
||||
|
||||
if( xflag )
|
||||
{
|
||||
@@ -647,8 +662,8 @@ HoughLinesProbabilistic( Mat& image,
|
||||
if( *mdata )
|
||||
{
|
||||
gap = 0;
|
||||
line_end[k].y = i1;
|
||||
line_end[k].x = j1;
|
||||
line_end[k].y = static_cast<int>(i1);
|
||||
line_end[k].x = static_cast<int>(j1);
|
||||
}
|
||||
else if( ++gap > lineGap )
|
||||
break;
|
||||
@@ -660,7 +675,7 @@ HoughLinesProbabilistic( Mat& image,
|
||||
|
||||
for( k = 0; k < 2; k++ )
|
||||
{
|
||||
int x = x0, y = y0, dx = dx0, dy = dy0;
|
||||
int64_t x = x0, y = y0, dx = dx0, dy = dy0;
|
||||
|
||||
if( k > 0 )
|
||||
dx = -dx, dy = -dy;
|
||||
@@ -670,7 +685,7 @@ HoughLinesProbabilistic( Mat& image,
|
||||
for( ;; x += dx, y += dy )
|
||||
{
|
||||
uchar* mdata;
|
||||
int i1, j1;
|
||||
int64_t i1, j1;
|
||||
|
||||
if( xflag )
|
||||
{
|
||||
@@ -907,7 +922,7 @@ static bool ocl_HoughLinesP(InputArray _src, OutputArray _lines, double rho, dou
|
||||
|
||||
void HoughLines( InputArray _image, OutputArray lines,
|
||||
double rho, double theta, int threshold,
|
||||
double srn, double stn, double min_theta, double max_theta )
|
||||
double srn, double stn, double min_theta, double max_theta, bool use_edgeval )
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
@@ -922,7 +937,7 @@ void HoughLines( InputArray _image, OutputArray lines,
|
||||
ocl_HoughLines(_image, lines, rho, theta, threshold, min_theta, max_theta));
|
||||
|
||||
if( srn == 0 && stn == 0 )
|
||||
HoughLinesStandard(_image, lines, type, (float)rho, (float)theta, threshold, INT_MAX, min_theta, max_theta );
|
||||
HoughLinesStandard(_image, lines, type, (float)rho, (float)theta, threshold, INT_MAX, min_theta, max_theta, use_edgeval );
|
||||
else
|
||||
HoughLinesSDiv(_image, lines, type, (float)rho, (float)theta, threshold, cvRound(srn), cvRound(stn), INT_MAX, min_theta, max_theta);
|
||||
}
|
||||
|
||||
@@ -1276,8 +1276,8 @@ public:
|
||||
#endif
|
||||
for( ; x1 < bcols; x1++ )
|
||||
{
|
||||
int sx = cvRound(sX[x1]*INTER_TAB_SIZE);
|
||||
int sy = cvRound(sY[x1]*INTER_TAB_SIZE);
|
||||
int sx = cvRound(sX[x1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int sy = cvRound(sY[x1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int v = (sy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (sx & (INTER_TAB_SIZE-1));
|
||||
XY[x1*2] = saturate_cast<short>(sx >> INTER_BITS);
|
||||
XY[x1*2+1] = saturate_cast<short>(sy >> INTER_BITS);
|
||||
@@ -1316,8 +1316,8 @@ public:
|
||||
|
||||
for( ; x1 < bcols; x1++ )
|
||||
{
|
||||
int sx = cvRound(sXY[x1*2]*INTER_TAB_SIZE);
|
||||
int sy = cvRound(sXY[x1*2+1]*INTER_TAB_SIZE);
|
||||
int sx = cvRound(sXY[x1*2]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int sy = cvRound(sXY[x1*2+1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int v = (sy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (sx & (INTER_TAB_SIZE-1));
|
||||
XY[x1*2] = saturate_cast<short>(sx >> INTER_BITS);
|
||||
XY[x1*2+1] = saturate_cast<short>(sy >> INTER_BITS);
|
||||
@@ -2016,7 +2016,7 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
bool useSSE4_1 = CV_CPU_HAS_SUPPORT_SSE4_1;
|
||||
#endif
|
||||
|
||||
const float scale = 1.f/INTER_TAB_SIZE;
|
||||
const float scale = 1.f/static_cast<float>(INTER_TAB_SIZE);
|
||||
int x, y;
|
||||
for( y = 0; y < size.height; y++ )
|
||||
{
|
||||
@@ -2096,8 +2096,8 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
#endif
|
||||
for( ; x < size.width; x++ )
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x]*INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src2f[x]*INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src2f[x]*static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x*2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x*2+1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE-1)));
|
||||
@@ -2142,8 +2142,8 @@ void cv::convertMaps( InputArray _map1, InputArray _map2,
|
||||
#endif
|
||||
for( ; x < size.width; x++ )
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x*2]*INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src1f[x*2+1]*INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x*2]*static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src1f[x*2+1]*static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x*2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x*2+1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE-1)));
|
||||
@@ -3270,7 +3270,7 @@ void WarpPerspectiveLine_Process_CV_SIMD(const double *M, short* xy, short* alph
|
||||
for( ; x1 < bw; x1++ )
|
||||
{
|
||||
double W = W0 + M[6]*x1;
|
||||
W = W ? INTER_TAB_SIZE/W : 0;
|
||||
W = W ? static_cast<double>(INTER_TAB_SIZE)/W : 0;
|
||||
double fX = std::max((double)INT_MIN, std::min((double)INT_MAX, (X0 + M[0]*x1)*W));
|
||||
double fY = std::max((double)INT_MIN, std::min((double)INT_MAX, (Y0 + M[3]*x1)*W));
|
||||
int X = saturate_cast<int>(fX);
|
||||
|
||||
@@ -157,8 +157,8 @@ void convertMaps_32f1c16s_SSE41(const float* src1f, const float* src2f, short* d
|
||||
}
|
||||
for (; x < width; x++)
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x] * INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src2f[x] * INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x] * static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src2f[x] * static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x * 2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x * 2 + 1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE - 1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE - 1)));
|
||||
@@ -190,8 +190,8 @@ void convertMaps_32f2c16s_SSE41(const float* src1f, short* dst1, ushort* dst2, i
|
||||
}
|
||||
for (; x < width; x++)
|
||||
{
|
||||
int ix = saturate_cast<int>(src1f[x * 2] * INTER_TAB_SIZE);
|
||||
int iy = saturate_cast<int>(src1f[x * 2 + 1] * INTER_TAB_SIZE);
|
||||
int ix = saturate_cast<int>(src1f[x * 2] * static_cast<float>(INTER_TAB_SIZE));
|
||||
int iy = saturate_cast<int>(src1f[x * 2 + 1] * static_cast<float>(INTER_TAB_SIZE));
|
||||
dst1[x * 2] = saturate_cast<short>(ix >> INTER_BITS);
|
||||
dst1[x * 2 + 1] = saturate_cast<short>(iy >> INTER_BITS);
|
||||
dst2[x] = (ushort)((iy & (INTER_TAB_SIZE - 1))*INTER_TAB_SIZE + (ix & (INTER_TAB_SIZE - 1)));
|
||||
@@ -469,7 +469,7 @@ public:
|
||||
for (; x1 < bw; x1++)
|
||||
{
|
||||
double W = W0 + M[6] * x1;
|
||||
W = W ? INTER_TAB_SIZE / W : 0;
|
||||
W = W ? static_cast<double>(INTER_TAB_SIZE) / W : 0;
|
||||
double fX = std::max((double)INT_MIN, std::min((double)INT_MAX, (X0 + M[0] * x1)*W));
|
||||
double fY = std::max((double)INT_MIN, std::min((double)INT_MAX, (Y0 + M[3] * x1)*W));
|
||||
int X = saturate_cast<int>(fX);
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include <stack>
|
||||
#include <numeric>
|
||||
|
||||
#define GET_OPTIMIZED(func) (func)
|
||||
|
||||
|
||||
@@ -1324,7 +1324,9 @@ void vlineSmooth3N<uint8_t, ufixedpoint16>(const ufixedpoint16* const * src, con
|
||||
ufixedpoint32 val[] = { (m[0] + m[1] + m[2]) * ufixedpoint16((uint8_t)128) };
|
||||
v_128_4 = vx_setall_s32(*((int32_t*)val));
|
||||
}
|
||||
v_int16 v_mul01 = v_reinterpret_as_s16(vx_setall_u32(*((uint32_t*)m)));
|
||||
uint32_t val01;
|
||||
std::memcpy(&val01, m, sizeof(val01));
|
||||
v_int16 v_mul01 = v_reinterpret_as_s16(vx_setall_u32(val01));
|
||||
v_int16 v_mul2 = v_reinterpret_as_s16(vx_setall_u16(*((uint16_t*)(m + 2))));
|
||||
for (; i <= len - 4*VECSZ; i += 4*VECSZ)
|
||||
{
|
||||
|
||||
@@ -1056,7 +1056,7 @@ static bool ipp_crossCorr(const Mat& src, const Mat& tpl, Mat& dst, bool normed)
|
||||
if (ippiCrossCorrNorm==0)
|
||||
return false;
|
||||
|
||||
IppEnum funCfg = (IppEnum)(ippAlgAuto | ippiROIValid);
|
||||
IppEnum funCfg = (IppEnum)(+ippAlgAuto | ippiROIValid);
|
||||
if(normed)
|
||||
funCfg |= ippiNorm;
|
||||
else
|
||||
@@ -1093,7 +1093,7 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst)
|
||||
if (ippiSqrDistanceNorm==0)
|
||||
return false;
|
||||
|
||||
IppEnum funCfg = (IppEnum)(ippAlgAuto | ippiROIValid | ippiNormNone);
|
||||
IppEnum funCfg = (IppEnum)(+ippAlgAuto | ippiROIValid | ippiNormNone);
|
||||
status = ippiSqrDistanceNormGetBufferSize(srcRoiSize, tplRoiSize, funCfg, &bufSize);
|
||||
if ( status < 0 )
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user