![](/img/trans.png)
[英]OpenCV cv::getStructuringElement with CV_SHAPE_ELLIPSE produces a black square
[英]Message “‘CV_SHAPE_ELLIPSE’ was not declared in this scope” in OpenCV 3
版本是3.0.0。 我沒有編寫源代碼,我不是C ++專家。
我第一次嘗試編譯,不得不從CV_LOAD_IMAGE_COLOR
更改為cv::IMREAD_COLOR
,然后將CV_YCrCb2BGR
為cv::COLOR_YCrCb2BGR
(並對其他顏色轉換執行相同操作)。
現在它說沒有聲明CV_SHAPE_ELLIPSE
,但我不知道下一步該做什么,也無法在線找到答案。
我想你想設置getStructuringElement
的形狀。
它已被更改為cv::MORPH_ELLIPSE
。 CV_SHAPE_ELLIPSE
是舊OpenCV 1.x API中形態操作的結構元素形狀之一。
根據opencv2/imgproc/types_c.h
:
/** Shapes of a structuring element for morphological operations
@see cv::MorphShapes, cv::getStructuringElement
*/
enum MorphShapes_c
{
CV_SHAPE_RECT =0,
CV_SHAPE_CROSS =1,
CV_SHAPE_ELLIPSE =2,
CV_SHAPE_CUSTOM =100 //!< custom structuring element
};
CV_SHAPE_ELLIPSIS
現在是MORPH_ELLIPSE.
,在opencv2/imgproc.hpp
定義:
//! shape of the structuring element
enum MorphShapes {
MORPH_RECT = 0, //!< a rectangular structuring element: \f[E_{ij}=1\f]
MORPH_CROSS = 1, //!< a cross-shaped structuring element:
//!< \f[E_{ij} = \fork{1}{if i=\texttt{anchor.y} or j=\texttt{anchor.x}}{0}{otherwise}\f]
MORPH_ELLIPSE = 2 //!< an elliptic structuring element, that is, a filled ellipse inscribed
//!< into the rectangle Rect(0, 0, esize.width, 0.esize.height)
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.