# OpenCV 显示文字相关函数

文字结构

  • 函数: CvFont()
  • 定义:
/** Font structure */
typedef struct CvFont
{
const char* nameFont;   //Qt:nameFont
CvScalar color;       //Qt:ColorFont -> cvScalar(blue_component, green_component, red_component[, alpha_component])
  int         font_face;    //Qt: bool italic         /** =CV_FONT_* */
  const int*  ascii;      //!< font data and metrics
  const int*  greek;
  const int*  cyrillic;
  float       hscale, vscale;
  float       shear;      //!< slope coefficient: 0 - normal, >0 - italic
  int         thickness;    //!< Qt: weight               /** letters thickness */
  float       dx;       //!< horizontal interval between letters
  int         line_type;    //!< Qt: PointSize
}
CvFont;

文字输出

    • 函数:cvInitFont()
    • 定义:
    CVAPI(void)  cvInitFont( CvFont* font, int font_face,
                          double hscale, double vscale,
                          double shear CV_DEFAULT(0),
                          int thickness CV_DEFAULT(1),
                          int line_type CV_DEFAULT(8));
    
    
    • 函数:getTextSize()
    • 定义:
    CV_EXPORTS_W Size getTextSize(const String& text, int fontFace,
                             double fontScale, int thickness,
                             CV_OUT int* baseLine);
    
    • 函数:putText()
    • 定义
    CV_EXPORTS_W void putText( InputOutputArray img, const String& text, Point org,
                           int fontFace, double fontScale, Scalar color,
                           int thickness = 1, int lineType = LINE_8,
                           bool bottomLeftOrigin = false );
    
    • 描述
    /** @brief Draws a text string.
    
    The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered
    using the specified font are replaced by question marks. See #getTextSize for a text rendering code
    example.
    
    @param img Image.
    @param text Text string to be drawn.
    @param org Bottom-left corner of the text string in the image.
    @param fontFace Font type, see #HersheyFonts.
    @param fontScale Font scale factor that is multiplied by the font-specific base size.
    @param color Text color.
    @param thickness Thickness of the lines used to draw a text.
    @param lineType Line type. See #LineTypes
    @param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise,
    it is at the top-left corner.
    */
    
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值