Python中使用CV2截取图片时,352行出现错误信息如何解决?

2026-06-11 07:161阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计324个文字,预计阅读时间需要2分钟。

Python中使用CV2截取图片时,352行出现错误信息如何解决?

今天想用CV2+截取ROI(Region Of Interest)的时候,发现是这样写的,但发现截取img那句出了错,应该是:先横后纵,这样就好了。cv2.selectROI用法:selectROI(windowName, img, showCrosshair=None, fromCenter=False)

今天想用CV2 截个ROI ( Region Of Interest ) 的时候,

是这样写的

结果,

Python中使用CV2截取图片时,352行出现错误信息如何解决?

发现是截取img 那句出了错

应该为:

先纵后横

这样就OK了

cv2.selectROI 用法:

selectROI(windowName, img,showCrosshair=None,fromCenter=None)

selectROI(windowName, img[, showCrosshair[, fromCenter]]) -> retval . @brief Selects ROI on the given image. . Function creates a window and allows user to select a ROI using mouse. . Controls: usespaceorenterto finish selection, use keycto cancel selection (function will return the zero cv::Rect). . . @param windowName name of the window where selection process will be shown. . @param img image to select a ROI. . @param showCrosshair if true crosshair of selection rectangle will be shown. . @param fromCenter if true center of selection will match initial mouse position. In opposite case a corner of . selection rectangle will correspont to the initial mouse position. . @return selected ROI or empty rect if selection canceled. . . @note The function sets it‘s own mouse callback for specified window using cv::setMouseCallback(windowName, ...). . After finish of work an empty callback will be set for the used window.

selectROI(img[, showCrosshair[, fromCenter]]) -> retval . @overload

就是这样, ┏(^0^)┛

本文共计324个文字,预计阅读时间需要2分钟。

Python中使用CV2截取图片时,352行出现错误信息如何解决?

今天想用CV2+截取ROI(Region Of Interest)的时候,发现是这样写的,但发现截取img那句出了错,应该是:先横后纵,这样就好了。cv2.selectROI用法:selectROI(windowName, img, showCrosshair=None, fromCenter=False)

今天想用CV2 截个ROI ( Region Of Interest ) 的时候,

是这样写的

结果,

Python中使用CV2截取图片时,352行出现错误信息如何解决?

发现是截取img 那句出了错

应该为:

先纵后横

这样就OK了

cv2.selectROI 用法:

selectROI(windowName, img,showCrosshair=None,fromCenter=None)

selectROI(windowName, img[, showCrosshair[, fromCenter]]) -> retval . @brief Selects ROI on the given image. . Function creates a window and allows user to select a ROI using mouse. . Controls: usespaceorenterto finish selection, use keycto cancel selection (function will return the zero cv::Rect). . . @param windowName name of the window where selection process will be shown. . @param img image to select a ROI. . @param showCrosshair if true crosshair of selection rectangle will be shown. . @param fromCenter if true center of selection will match initial mouse position. In opposite case a corner of . selection rectangle will correspont to the initial mouse position. . @return selected ROI or empty rect if selection canceled. . . @note The function sets it‘s own mouse callback for specified window using cv::setMouseCallback(windowName, ...). . After finish of work an empty callback will be set for the used window.

selectROI(img[, showCrosshair[, fromCenter]]) -> retval . @overload

就是这样, ┏(^0^)┛