Analize python opencv error. imgproc/src/thresh.cpp:1555: error: (-2:Unspecified error)…
- User
Analize python opencv error. imgproc/src/thresh.cpp:1555: error: (-2:Unspecified error) in function 'double cv::threshold(cv::InputArray, cv::OutputArray, double, double, int)'
THRESH_OTSU mode: 'src_type == CV_8UC1 || src_type == CV_16UC1' where 'src_type' is 16 (CV_8UC3)
Assistant
This error indicates that the input image type passed to the cv::threshold function is not supported when using the THRESH_OTSU thresholding mode.
Specifically:
- cv::threshold was called with THRESH_OTSU mode
- The input image (src) type was CV_8UC3 (8-bit 3-channel image)
- But THRESH_OTSU only supports single-channel images of type CV_8UC1 (8-bit 1-channel) or CV_16UC1 (16-bit 1-channel)
To fix this, you need to:
- Convert the input image to single channel, either grayscale (CV_8UC1) or 16-bit (CV_16UC1)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.