Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Mar 6, 2021
2 parents b450dd7 + 04a9ff8 commit d643a90
Show file tree
Hide file tree
Showing 15 changed files with 651 additions and 370 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,12 @@ if(COMMAND ocv_pylint_finalize)
ocv_pylint_add_directory_recurse(${CMAKE_CURRENT_LIST_DIR}/samples/python/tutorial_code)
ocv_pylint_finalize()
endif()
if(TARGET check_pylint)
message(STATUS "Registered 'check_pylint' target: using ${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}), checks: ${PYLINT_TOTAL_TARGETS}")
endif()
if(TARGET check_flake8)
message(STATUS "Registered 'check_flake8' target: using ${FLAKE8_EXECUTABLE} (ver: ${FLAKE8_VERSION})")
endif()

if(OPENCV_GENERATE_SETUPVARS)
include(cmake/OpenCVGenSetupVars.cmake)
Expand Down Expand Up @@ -1628,12 +1634,6 @@ endif()

status("")
status(" Python (for build):" PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE NO)
if(PYLINT_FOUND AND PYLINT_EXECUTABLE)
status(" Pylint:" PYLINT_FOUND THEN "${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}, checks: ${PYLINT_TOTAL_TARGETS})" ELSE NO)
endif()
if(FLAKE8_FOUND AND FLAKE8_EXECUTABLE)
status(" Flake8:" FLAKE8_FOUND THEN "${FLAKE8_EXECUTABLE} (ver: ${FLAKE8_VERSION})" ELSE NO)
endif()

# ========================== java ==========================
if(BUILD_JAVA)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindPylint.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(PYLINT_EXECUTABLE AND NOT DEFINED PYLINT_VERSION)
execute_process(COMMAND ${PYLINT_EXECUTABLE} --version RESULT_VARIABLE _result OUTPUT_VARIABLE PYLINT_VERSION_RAW)
if(NOT _result EQUAL 0)
ocv_clear_vars(PYLINT_EXECUTABLE PYLINT_VERSION)
elseif(PYLINT_VERSION_RAW MATCHES "pylint([^,]*) ([0-9\\.]+[0-9])")
elseif(PYLINT_VERSION_RAW MATCHES "pylint([^,\n]*) ([0-9\\.]+[0-9])")
set(PYLINT_VERSION "${CMAKE_MATCH_2}")
else()
set(PYLINT_VERSION "unknown")
Expand Down
1 change: 0 additions & 1 deletion cmake/OpenCVPylint.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ function(ocv_pylint_finalize)

list(LENGTH PYLINT_TARGET_ID __total)
set(PYLINT_TOTAL_TARGETS "${__total}" CACHE INTERNAL "")
message(STATUS "Pylint: registered ${__total} targets. Build 'check_pylint' target to run checks (\"cmake --build . --target check_pylint\" or \"make check_pylint\")")
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/pylint.cmake.in" "${CMAKE_BINARY_DIR}/pylint.cmake" @ONLY)

add_custom_target(check_pylint
Expand Down
14 changes: 11 additions & 3 deletions modules/calib3d/src/polynom_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ int solve_deg3(double a, double b, double c, double d,
return 3;
}
else {
x0 = pow(2 * R, 1 / 3.0) - b_a_3;
double cube_root = cv::cubeRoot(2 * R);
x0 = cube_root - b_a_3;
return 1;
}
}
Expand All @@ -82,8 +83,15 @@ int solve_deg3(double a, double b, double c, double d,
}

// D > 0, only one real root
double AD = pow(fabs(R) + sqrt(D), 1.0 / 3.0) * (R > 0 ? 1 : (R < 0 ? -1 : 0));
double BD = (AD == 0) ? 0 : -Q / AD;
double AD = 0.;
double BD = 0.;
double R_abs = fabs(R);
if (R_abs > DBL_EPSILON)
{
AD = cv::cubeRoot(R_abs + sqrt(D));
AD = (R >= 0) ? AD : -AD;
BD = -Q / AD;
}

// Calculate the only real root
x0 = AD + BD - b_a_3;
Expand Down
10 changes: 10 additions & 0 deletions modules/core/include/opencv2/core/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,16 @@ _AccTp normInf(const _Tp* a, const _Tp* b, int n)
*/
CV_EXPORTS_W float cubeRoot(float val);

/** @overload
cubeRoot with argument of `double` type calls `std::cbrt(double)`
*/
static inline
double cubeRoot(double val)
{
return std::cbrt(val);
}

/** @brief Calculates the angle of a 2D vector in degrees.
The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured
Expand Down
Loading

0 comments on commit d643a90

Please sign in to comment.