mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 20:09:23 +08:00
Merge pull request #10514 from alalek:build_warnings
This commit is contained in:
commit
d0b2e60edc
@ -487,7 +487,7 @@ bool PAMDecoder::readData( Mat& img )
|
||||
bool res = false, funcout;
|
||||
PaletteEntry palette[256];
|
||||
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 */
|
||||
AutoBuffer<uchar> _src(src_elems_per_row * 2);
|
||||
@ -506,9 +506,7 @@ bool PAMDecoder::readData( Mat& img )
|
||||
layout.bchan = 0;
|
||||
layout.gchan = 1;
|
||||
layout.rchan = 2;
|
||||
} else
|
||||
layout.bchan = layout.gchan = layout.rchan = 0;
|
||||
layout.graychan = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CV_TRY
|
||||
|
@ -1483,14 +1483,14 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m
|
||||
imaxval = saturate_cast<ushort>(imaxval);
|
||||
|
||||
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 ||
|
||||
((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) :
|
||||
type == THRESH_BINARY_INV ? (ithresh >= USHRT_MAX ? imaxval : 0) :
|
||||
int v = type == THRESH_BINARY ? (ithresh >= (int)USHRT_MAX ? 0 : imaxval) :
|
||||
type == THRESH_BINARY_INV ? (ithresh >= (int)USHRT_MAX ? imaxval : 0) :
|
||||
/*type == THRESH_TRUNC ? imaxval :*/ 0;
|
||||
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/.*/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_funcs.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_types.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_type_reg.h"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_ns_reg.h"
|
||||
)
|
||||
|
||||
set(cv2_generated_files ${cv2_generated_hdrs}
|
||||
"${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_}")
|
||||
add_custom_command(
|
||||
OUTPUT ${cv2_generated_files}
|
||||
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/hdr_parser.py
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/headers.txt
|
||||
DEPENDS ${opencv_hdrs}
|
||||
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"
|
||||
"${PYTHON_SOURCE_DIR}/src2/hdr_parser.py"
|
||||
# not a real build dependency (file(WRITE) result): ${CMAKE_CURRENT_BINARY_DIR}/headers.txt
|
||||
${opencv_hdrs}
|
||||
COMMENT "Generate files for Python bindings and documentation"
|
||||
)
|
||||
|
||||
add_custom_target(gen_opencv_python_source DEPENDS ${cv2_generated_files})
|
||||
|
||||
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})
|
||||
file(APPEND ${cv2_custom_hdr} "#include \"${uh}\"\n")
|
||||
set(cv2_custom_hdr_str "${cv2_custom_hdr_str}#include \"${uh}\"\n")
|
||||
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…
Reference in New Issue
Block a user