hal*_*ato 0 python opencv numpy
运行cv2.getRectSubPix(img, (5,5), (0,0))抛出错误:
OpenCV Error: Unsupported format or combination of formats (Unsupported combination of input and output formats) in getRectSubPix.
Run Code Online (Sandbox Code Playgroud)
所述dtype的img是float64,将其用确定img.dtype。
查看源代码显示,只有 getRectSubPix 的输入组合是:
depth == CV_8U && ddepth == CV_8U
depth == CV_8U && ddepth == CV_32F
depth == CV_32F && ddepth == CV_32F
Run Code Online (Sandbox Code Playgroud)
这意味着输入数组需要转换为int8或float32才能传入,可以通过以下方式完成:
np.int8(img)
Run Code Online (Sandbox Code Playgroud)
或者
np.float32(img)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21505 次 |
| 最近记录: |