Merge pull request #10514 from alalek:build_warnings

pull/10629/head
Alexander Alekhin 7 years ago
commit d0b2e60edc
  1. 6
      modules/imgcodecs/src/grfmt_pam.cpp
  2. 8
      modules/imgproc/src/thresh.cpp
  3. 30
      modules/python/bindings/CMakeLists.txt

@ -487,7 +487,7 @@ bool PAMDecoder::readData( Mat& img )
bool res = false, funcout; bool res = false, funcout;
PaletteEntry palette[256]; PaletteEntry palette[256];
const struct pam_format *fmt = NULL; const struct pam_format *fmt = NULL;
struct channel_layout layout; struct channel_layout layout = { 0, 0, 0, 0 }; // normalized to 1-channel grey format
/* setting buffer to max data size so scaling up is possible */ /* setting buffer to max data size so scaling up is possible */
AutoBuffer<uchar> _src(src_elems_per_row * 2); AutoBuffer<uchar> _src(src_elems_per_row * 2);
@ -506,9 +506,7 @@ bool PAMDecoder::readData( Mat& img )
layout.bchan = 0; layout.bchan = 0;
layout.gchan = 1; layout.gchan = 1;
layout.rchan = 2; layout.rchan = 2;
} else }
layout.bchan = layout.gchan = layout.rchan = 0;
layout.graychan = 0;
} }
CV_TRY CV_TRY

@ -1483,14 +1483,14 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m
imaxval = saturate_cast<ushort>(imaxval); imaxval = saturate_cast<ushort>(imaxval);
int ushrt_min = 0; int ushrt_min = 0;
if (ithresh < ushrt_min || ithresh >= USHRT_MAX) if (ithresh < ushrt_min || ithresh >= (int)USHRT_MAX)
{ {
if (type == THRESH_BINARY || type == THRESH_BINARY_INV || if (type == THRESH_BINARY || type == THRESH_BINARY_INV ||
((type == THRESH_TRUNC || type == THRESH_TOZERO_INV) && ithresh < ushrt_min) || ((type == THRESH_TRUNC || type == THRESH_TOZERO_INV) && ithresh < ushrt_min) ||
(type == THRESH_TOZERO && ithresh >= USHRT_MAX)) (type == THRESH_TOZERO && ithresh >= (int)USHRT_MAX))
{ {
int v = type == THRESH_BINARY ? (ithresh >= USHRT_MAX ? 0 : imaxval) : int v = type == THRESH_BINARY ? (ithresh >= (int)USHRT_MAX ? 0 : imaxval) :
type == THRESH_BINARY_INV ? (ithresh >= USHRT_MAX ? imaxval : 0) : type == THRESH_BINARY_INV ? (ithresh >= (int)USHRT_MAX ? imaxval : 0) :
/*type == THRESH_TRUNC ? imaxval :*/ 0; /*type == THRESH_TRUNC ? imaxval :*/ 0;
dst.setTo(v); dst.setTo(v);
} }

@ -38,15 +38,12 @@ ocv_list_filterout(opencv_hdrs "modules/.*_inl\\\\.h*")
ocv_list_filterout(opencv_hdrs "modules/.*\\\\.details\\\\.h*") ocv_list_filterout(opencv_hdrs "modules/.*\\\\.details\\\\.h*")
ocv_list_filterout(opencv_hdrs "modules/.*/detection_based_tracker\\\\.hpp") # Conditional compilation ocv_list_filterout(opencv_hdrs "modules/.*/detection_based_tracker\\\\.hpp") # Conditional compilation
set(cv2_generated_hdrs set(cv2_generated_files
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h" "${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_funcs.h" "${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_funcs.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_types.h" "${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_types.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h" "${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h"
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_ns_reg.h" "${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_ns_reg.h"
)
set(cv2_generated_files ${cv2_generated_hdrs}
"${OPENCV_PYTHON_SIGNATURES_FILE}" "${OPENCV_PYTHON_SIGNATURES_FILE}"
) )
@ -54,18 +51,29 @@ string(REPLACE ";" "\n" opencv_hdrs_ "${opencv_hdrs}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${opencv_hdrs_}") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" "${opencv_hdrs_}")
add_custom_command( add_custom_command(
OUTPUT ${cv2_generated_files} OUTPUT ${cv2_generated_files}
COMMAND ${PYTHON_DEFAULT_EXECUTABLE} "${PYTHON_SOURCE_DIR}/src2/gen2.py" ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/headers.txt" COMMAND "${PYTHON_DEFAULT_EXECUTABLE}" "${PYTHON_SOURCE_DIR}/src2/gen2.py" "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/headers.txt"
DEPENDS ${PYTHON_SOURCE_DIR}/src2/gen2.py DEPENDS "${PYTHON_SOURCE_DIR}/src2/gen2.py"
DEPENDS ${PYTHON_SOURCE_DIR}/src2/hdr_parser.py "${PYTHON_SOURCE_DIR}/src2/hdr_parser.py"
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/headers.txt # not a real build dependency (file(WRITE) result): ${CMAKE_CURRENT_BINARY_DIR}/headers.txt
DEPENDS ${opencv_hdrs} ${opencv_hdrs}
COMMENT "Generate files for Python bindings and documentation" COMMENT "Generate files for Python bindings and documentation"
) )
add_custom_target(gen_opencv_python_source DEPENDS ${cv2_generated_files}) add_custom_target(gen_opencv_python_source DEPENDS ${cv2_generated_files})
set(cv2_custom_hdr "${CMAKE_CURRENT_BINARY_DIR}/pyopencv_custom_headers.h") set(cv2_custom_hdr "${CMAKE_CURRENT_BINARY_DIR}/pyopencv_custom_headers.h")
file(WRITE ${cv2_custom_hdr} "//user-defined headers\n") set(cv2_custom_hdr_str "//user-defined headers\n")
foreach(uh ${opencv_userdef_hdrs}) foreach(uh ${opencv_userdef_hdrs})
file(APPEND ${cv2_custom_hdr} "#include \"${uh}\"\n") set(cv2_custom_hdr_str "${cv2_custom_hdr_str}#include \"${uh}\"\n")
endforeach(uh) endforeach(uh)
if(EXISTS "${cv2_custom_hdr}")
file(READ "${cv2_custom_hdr}" __content)
else()
set(__content "")
endif()
if("${__content}" STREQUAL "${cv2_custom_hdr_str}")
# Up-to-date
else()
file(WRITE "${cv2_custom_hdr}" "${cv2_custom_hdr_str}")
endif()
unset(__content)

Loading…
Cancel
Save