imgproc_getTextSize

[32/64bit] テキスト文字列の幅と高さを計算します。

imgproc_getTextSize p1,p2,p3,p4,p5,p6

p1 = str : [MarshalAs(UnmanagedType.LPStr)] string text
p2 = int : int fontFace
p3 = double : double fontScale
p4 = int : int thickness
p5 = var : out int baseLine
p6 = var : out Size returnValue

(プラグイン / モジュール : OpenCvSharpExtern.dll)

解説

関数 cv::getTextSize は,指定されたテキストを含むボックスのサイズを計算して返します.つまり,次のコードは,いくつかのテキストと,それを囲むタイトなボックス,そしてベースラインをレンダリングします: :String text = "Funny text inside the box";int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX;double fontScale = 2;int thickness = 3;Mat img(600, 800, CV_8UC3, Scalar::all(0));int baseline=0;Size textSize = getTextSize(text, fontFace, fontScale, thickness, &baseline);baseline += thickness;// textPoint を中央に配置 textOrg((img.cols - textSize.width)/2, (img.rows + textSize.height)/2);// boxrectangle(img, textOrg + Point(0, baseline), textOrg + Point(textSize.width, -textSize.height), Scalar(0,0,255));// ...そしてベースライン firstline(img, textOrg + Point(0, thickness), textOrg + Point(textSize.width, thickness), Scalar(0, 0, 255));// そしてテキスト自体を配置putText(img, text, textOrg, fontFace, fontScale, Scalar::all(255), thickness, 8);fragmentSee alsoputTextExamples: samples/cpp/fitellipse.cpp, samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_2.cpp, and samples/dnn/object_detection.cpp.

元関数名(C#): imgproc_getTextSize
元DLLエクスポート名: imgproc_getTextSize
参照元CSファイル: Internal\PInvoke\NativeMethods\imgproc\NativeMethods_imgproc.cs
▼ C言語側関数定義
CVAPI(ExceptionStatus) imgproc_getTextSize(const char *text, int fontFace,
                                 double fontScale, int thickness, int *baseLine, MyCvSize *returnValue)
{
    BEGIN_WRAP
    *returnValue = c(cv::getTextSize(text, fontFace, fontScale, thickness, baseLine));
    END_WRAP
}

情報

プラグイン / モジュールOpenCvSharpExtern.dll
バージョン1.00
作成日2021/11/30
著作者inovia
URLhttps://hsp.moe/
備考#include "OpenCvSharpExtern32.as"
#include "OpenCvSharpExtern64.as"
使用するHSPランタイムのビット数に合わせたインクルードファイルを使用すること
タイプOpenCVSharpラッパーDLL
グループNativeMethods_imgproc
対応環境
  • Windows 版 HSP
hs ファイルhsphelp\OpenCvSharpExtern.hs