Commit 9110ccb2 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 3901fb76 f58493d0
......@@ -1767,7 +1767,7 @@ void drawMarker(const Ptr<Dictionary> &dictionary, int id, int sidePixels, Outpu
void _drawPlanarBoardImpl(Board *_board, Size outSize, OutputArray _img, int marginSize,
int borderBits) {
CV_Assert(outSize.area() > 0);
CV_Assert(!outSize.empty());
CV_Assert(marginSize >= 0);
_img.create(outSize, CV_8UC1);
......
......@@ -53,7 +53,7 @@ using namespace std;
*/
void CharucoBoard::draw(Size outSize, OutputArray _img, int marginSize, int borderBits) {
CV_Assert(outSize.area() > 0);
CV_Assert(!outSize.empty());
CV_Assert(marginSize >= 0);
_img.create(outSize, CV_8UC1);
......
......@@ -532,7 +532,7 @@ void cv::omnidir::initUndistortRectifyMap(InputArray K, InputArray D, InputArray
void cv::omnidir::undistortImage(InputArray distorted, OutputArray undistorted,
InputArray K, InputArray D, InputArray xi, int flags, InputArray Knew, const Size& new_size, InputArray R)
{
Size size = new_size.area() != 0 ? new_size : distorted.size();
Size size = new_size.empty() ? distorted.size() : new_size;
cv::Mat map1, map2;
omnidir::initUndistortRectifyMap(K, D, xi, R, Knew, size, CV_16SC2, map1, map2, flags);
......
......@@ -135,14 +135,22 @@ struct MACEImpl CV_FINAL : MACE {
}
}
Mat sq; cv::sqrt(D, sq);
Mat_<Vec2d> DINV = TOTALPIXEL * size / sq;
#if 0 // https://github.com/opencv/opencv_contrib/issues/1848
// FIXIT What is expected here? complex numbers math?
// D(,)[1] is 0 (always)
Mat sq; cv::sqrt(D, sq); // Per-element sqrt(): sq(,)[1] is 0 (always)
Mat_<Vec2d> DINV = TOTALPIXEL * size / sq; // "per-element" division which provides "Inf"
#else
Mat sq; cv::sqrt(D.reshape(1).col(0), sq);
Mat_<Vec2d> DINV(TOTALPIXEL, 1, Vec2d(0, 0));
DINV.reshape(1).col(0) = TOTALPIXEL * size / sq;
#endif
Mat_<Vec2d> DINV_S(TOTALPIXEL, size, 0.0);
Mat_<Vec2d> SPLUS_DINV(size, TOTALPIXEL, 0.0);
for (int l=0; l<size; l++) {
for (int m=0; m<TOTALPIXEL; m++) {
SPLUS_DINV(l, m)[0] = SPLUS(l,m)[0] * DINV(m,0)[0];
SPLUS_DINV(l, m)[1] = SPLUS(l,m)[1] * DINV(m,0)[1];
SPLUS_DINV(l, m)[1] = SPLUS(l,m)[1] * DINV(m,0)[1]; // FIXIT: DINV(,)[1] is 0 (always)
DINV_S(m, l)[0] = S(m,l)[0] * DINV(m,0)[0];
DINV_S(m, l)[1] = S(m,l)[1] * DINV(m,0)[1];
}
......
......@@ -66,7 +66,7 @@ namespace cv{
}
double TrackingFunctionPF::calc(const double* x) const{
Rect rect=rectFromRow(x);
if(rect.area()==0){
if(rect.empty()){
return 2.0;
}
return _origHist.dist(TrackingHistogram(_image(rect),_nh,_ns,_nv));
......
......@@ -261,7 +261,7 @@ void DisparityWLSFilterImpl::filter_(InputArray disparity_map_left, InputArray l
resize_factor = disparity_map_left.cols()/(float)left_view.cols();
else
resize_factor = 1.0;
if(ROI.area()!=0) /* user provided a ROI */
if(!ROI.empty()) /* user provided a ROI */
valid_disp_ROI = ROI;
else
valid_disp_ROI = Rect(left_offset,top_offset,
......
......@@ -130,8 +130,8 @@ void calculateChannelSums(uint &sumB, uint &sumG, uint &sumR, uchar *src_data, i
v_expand(v_max_val, v_max1, v_max2);
// Calculate masks
v_m1 = ~((v_max1 - v_min1) * v_255 > v_thresh * v_max1);
v_m2 = ~((v_max2 - v_min2) * v_255 > v_thresh * v_max2);
v_m1 = ~(v_mul_wrap(v_max1 - v_min1, v_255) > v_mul_wrap(v_thresh, v_max1));
v_m2 = ~(v_mul_wrap(v_max2 - v_min2, v_255) > v_mul_wrap(v_thresh, v_max2));
// Apply masks
v_iB1 = (v_iB1 & v_m1) + (v_iB2 & v_m2);
......@@ -282,12 +282,12 @@ void applyChannelGains(InputArray _src, OutputArray _dst, float gainB, float gai
v_expand(v_inR, v_sR1, v_sR2);
// Multiply by gains
v_sB1 = (v_sB1 * v_gainB) >> 8;
v_sB2 = (v_sB2 * v_gainB) >> 8;
v_sG1 = (v_sG1 * v_gainG) >> 8;
v_sG2 = (v_sG2 * v_gainG) >> 8;
v_sR1 = (v_sR1 * v_gainR) >> 8;
v_sR2 = (v_sR2 * v_gainR) >> 8;
v_sB1 = v_mul_wrap(v_sB1, v_gainB) >> 8;
v_sB2 = v_mul_wrap(v_sB2, v_gainB) >> 8;
v_sG1 = v_mul_wrap(v_sG1, v_gainG) >> 8;
v_sG2 = v_mul_wrap(v_sG2, v_gainG) >> 8;
v_sR1 = v_mul_wrap(v_sR1, v_gainR) >> 8;
v_sR2 = v_mul_wrap(v_sR2, v_gainR) >> 8;
// Pack into vectors of v_uint8x16
v_store_interleave(&dst_data[i], v_pack(v_sB1, v_sB2), v_pack(v_sG1, v_sG2), v_pack(v_sR1, v_sR2));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment