From 1e338d90e12eede8765b050906e717713414de53 Mon Sep 17 00:00:00 2001 From: kumataro Date: Sun, 6 Dec 2020 18:59:49 +0900 Subject: [PATCH 1/5] freetype2: Update README.md --- modules/freetype/README.md | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/freetype/README.md b/modules/freetype/README.md index 44ecb1648c3..140cdde560d 100644 --- a/modules/freetype/README.md +++ b/modules/freetype/README.md @@ -1,34 +1,34 @@ -FreeType Module -=========== +FreeType2 Wrapper Module +========================== -This FreeType module allows you to draw strings with outlines and bitmaps. +This FreeType2 wrapper module allows to draw strings with outlines and bitmaps. -Installation ------------ +Requested external libraries. +------------------------------ harfbuzz is requested to convert UTF8 to gid(GlyphID). + freetype library is requested to rasterize given gid. -harfbuzz https://www.freedesktop.org/wiki/Software/HarfBuzz/ -freetype https://www.freetype.org/ +- harfbuzz https://www.freedesktop.org/wiki/Software/HarfBuzz/ +- freetype https://www.freetype.org/ Usage ----------- -cv::freetype::FreeType2 ft2; -ft2.loadFontData("your-font.ttf", 0); -ft2.setSplitNumber( 4 ); // Bezier-line is splited by 4 segment. -ft2.putText(src, .... ) + +``` +cv::Ptr ft2; +ft2 = cv::freetype::createFreeType2(); +ft2->loadFontData(ttf_pathname, 0); +ft2->putText(mat, "hello world", cv::Point(20, 200), + 30, CV_RGB(0, 0, 0), cv::FILLED, cv::LINE_AA, true); +``` Option ------------ - 2nd argument of loadFontData is used if font file has many font data. - 3 drawing mode is available. --- outline mode is used if lineWidth is larger than 0. (like original putText) --- bitmap mode is used if lineWidth is less than 0. ---- 1bit bitmap mode is used if lineStyle is 4 or 8. ---- gray bitmap mode is used if lineStyle is 16. + - outline mode is used if lineWidth is larger than 0. (like original putText) + - bitmap mode is used if lineWidth is less than 0. + - 1bit bitmap mode is used if lineStyle is 4 or 8. + - gray bitmap mode is used if lineStyle is 16. -Future work ------------- -- test --- CJK and ... -- RTL,LTR,TTB,BTT... From 594682b4939918ae3327bcdf44be243827d00a85 Mon Sep 17 00:00:00 2001 From: kumataro Date: Sun, 6 Dec 2020 19:15:49 +0900 Subject: [PATCH 2/5] freetype2: Update freetype.hpp --- modules/freetype/include/opencv2/freetype.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/freetype/include/opencv2/freetype.hpp b/modules/freetype/include/opencv2/freetype.hpp index 6e41ec7ff4e..5395dd8b797 100644 --- a/modules/freetype/include/opencv2/freetype.hpp +++ b/modules/freetype/include/opencv2/freetype.hpp @@ -99,11 +99,11 @@ If you want to draw small glyph, small is better. The function putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by "Tofu" or non-drawn. -@param img Image. +@param img Image. (Only 8UC3 image is supported.) @param text Text string to be drawn. @param org Bottom-left/Top-left corner of the text string in the image. @param fontHeight Drawing font size by pixel unit. -@param color Text color. +@param color Text color.(Only 3ch 8bit Scalar is supported.) @param thickness Thickness of the lines used to draw a text when negative, the glyph is filled. Otherwise, the glyph is drawn with this thickness. @param line_type Line type. See the line for details. @param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner. From f24bccb4bb18d43a1d36f60f685dedd26a36a612 Mon Sep 17 00:00:00 2001 From: kumataro Date: Sun, 6 Dec 2020 20:04:15 +0900 Subject: [PATCH 3/5] freetype2: remove new blank line --- modules/freetype/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/freetype/README.md b/modules/freetype/README.md index 140cdde560d..b4723c33817 100644 --- a/modules/freetype/README.md +++ b/modules/freetype/README.md @@ -31,4 +31,3 @@ Option - bitmap mode is used if lineWidth is less than 0. - 1bit bitmap mode is used if lineStyle is 4 or 8. - gray bitmap mode is used if lineStyle is 16. - From 377005e33e05e9cc21db32e37735153ce7494bba Mon Sep 17 00:00:00 2001 From: Kumataro Date: Mon, 7 Dec 2020 06:17:08 +0900 Subject: [PATCH 4/5] Update README.md - Remove dots from the Headers - Align number of === / --- symbols on the next line --- modules/freetype/README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/freetype/README.md b/modules/freetype/README.md index b4723c33817..cfea3e0e0dd 100644 --- a/modules/freetype/README.md +++ b/modules/freetype/README.md @@ -1,10 +1,11 @@ FreeType2 Wrapper Module -========================== +======================== This FreeType2 wrapper module allows to draw strings with outlines and bitmaps. -Requested external libraries. ------------------------------- +Requested external libraries +---------------------------- + harfbuzz is requested to convert UTF8 to gid(GlyphID). freetype library is requested to rasterize given gid. @@ -13,7 +14,7 @@ freetype library is requested to rasterize given gid. - freetype https://www.freetype.org/ Usage ------------ +----- ``` cv::Ptr ft2; @@ -24,7 +25,7 @@ ft2->putText(mat, "hello world", cv::Point(20, 200), ``` Option ------------- +------ - 2nd argument of loadFontData is used if font file has many font data. - 3 drawing mode is available. - outline mode is used if lineWidth is larger than 0. (like original putText) From af7433e551dda4920c6dcc7fe5c6a06afe2033fd Mon Sep 17 00:00:00 2001 From: Kumataro Date: Mon, 7 Dec 2020 07:11:19 +0900 Subject: [PATCH 5/5] freetype: remove comment for color. --- modules/freetype/include/opencv2/freetype.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/freetype/include/opencv2/freetype.hpp b/modules/freetype/include/opencv2/freetype.hpp index 5395dd8b797..1c0a6e5e224 100644 --- a/modules/freetype/include/opencv2/freetype.hpp +++ b/modules/freetype/include/opencv2/freetype.hpp @@ -103,7 +103,7 @@ The function putText renders the specified text string in the image. Symbols tha @param text Text string to be drawn. @param org Bottom-left/Top-left corner of the text string in the image. @param fontHeight Drawing font size by pixel unit. -@param color Text color.(Only 3ch 8bit Scalar is supported.) +@param color Text color. @param thickness Thickness of the lines used to draw a text when negative, the glyph is filled. Otherwise, the glyph is drawn with this thickness. @param line_type Line type. See the line for details. @param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.