|
|
@ -11,7 +11,7 @@
|
|
|
|
#include <opencv2/core.hpp>
|
|
|
|
#include <opencv2/core.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
namespace cv {
|
|
|
|
namespace cv {
|
|
|
|
namespace ft {
|
|
|
|
namespace ft {
|
|
|
|
|
|
|
|
|
|
|
|
using cv::String;
|
|
|
|
using cv::String;
|
|
|
|
// using cv::CV_Assert;
|
|
|
|
// using cv::CV_Assert;
|
|
|
@ -21,38 +21,38 @@ namespace ft {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/** @brief Load font data.
|
|
|
|
/** @brief Load font data.
|
|
|
|
|
|
|
|
|
|
|
|
The function loadFontData loads font data.
|
|
|
|
The function loadFontData loads font data.
|
|
|
|
|
|
|
|
|
|
|
|
@param fontFileName FontFile Name
|
|
|
|
@param fontFileName FontFile Name
|
|
|
|
@param idx face_index to select a font faces in a single file.
|
|
|
|
@param idx face_index to select a font faces in a single file.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
virtual void loadFontData(String fontFileName, int idx) = 0;
|
|
|
|
virtual void loadFontData(String fontFileName, int idx) = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief Set Split Number from Bezier-curve to line
|
|
|
|
/** @brief Set Split Number from Bezier-curve to line
|
|
|
|
|
|
|
|
|
|
|
|
The function setSplitNumber set the number of split points from bezier-curve to line.
|
|
|
|
The function setSplitNumber set the number of split points from bezier-curve to line.
|
|
|
|
If you want to draw large glyph, large is better.
|
|
|
|
If you want to draw large glyph, large is better.
|
|
|
|
If you want to draw small glyph, small is better.
|
|
|
|
If you want to draw small glyph, small is better.
|
|
|
|
|
|
|
|
|
|
|
|
@param num number of split points from bezier-curve to line
|
|
|
|
@param num number of split points from bezier-curve to line
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
virtual void setSplitNumber( int num ) = 0;
|
|
|
|
virtual void setSplitNumber(int num) = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief Draws a text string.
|
|
|
|
/** @brief Draws a text string.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
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. (Only 8UC1/8UC3/8UC4 2D mat is supported.)
|
|
|
|
@param img Image. (Only 8UC1/8UC3/8UC4 2D mat is supported.)
|
|
|
|
@param text Text string to be drawn.
|
|
|
|
@param text Text string to be drawn.
|
|
|
|
@param org Bottom-left/Top-left corner of the text string in the image.
|
|
|
|
@param org Bottom-left/Top-left corner of the text string in the image.
|
|
|
|
@param fontHeight Drawing font size by pixel unit.
|
|
|
|
@param fontHeight Drawing font size by pixel unit.
|
|
|
|
@param color Text color.
|
|
|
|
@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 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 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.
|
|
|
|
@param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
virtual void putText(
|
|
|
|
virtual void putText(
|
|
|
|
InputOutputArray img, const String& text, Point org,
|
|
|
|
InputOutputArray img, const String& text, Point org,
|
|
|
@ -60,11 +60,11 @@ The function putText renders the specified text string in the image. Symbols tha
|
|
|
|
int thickness, int line_type, bool bottomLeftOrigin
|
|
|
|
int thickness, int line_type, bool bottomLeftOrigin
|
|
|
|
) = 0;
|
|
|
|
) = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief Calculates the width and height of a text string.
|
|
|
|
/** @brief Calculates the width and height of a text string.
|
|
|
|
|
|
|
|
|
|
|
|
The function getTextSize calculates and returns the approximate size of a box that contains the specified text.
|
|
|
|
The function getTextSize calculates and returns the approximate size of a box that contains the specified text.
|
|
|
|
That is, the following code renders some text, the tight box surrounding it, and the baseline: :
|
|
|
|
That is, the following code renders some text, the tight box surrounding it, and the baseline: :
|
|
|
|
@code
|
|
|
|
@code
|
|
|
|
String text = "Funny text inside the box";
|
|
|
|
String text = "Funny text inside the box";
|
|
|
|
int fontHeight = 60;
|
|
|
|
int fontHeight = 60;
|
|
|
|
int thickness = -1;
|
|
|
|
int thickness = -1;
|
|
|
@ -104,16 +104,16 @@ That is, the following code renders some text, the tight box surrounding it, and
|
|
|
|
// then put the text itself
|
|
|
|
// then put the text itself
|
|
|
|
ft2->putText(img, text, textOrg, fontHeight,
|
|
|
|
ft2->putText(img, text, textOrg, fontHeight,
|
|
|
|
Scalar::all(255), thickness, linestyle, true );
|
|
|
|
Scalar::all(255), thickness, linestyle, true );
|
|
|
|
@endcode
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
|
|
|
|
@param text Input text string.
|
|
|
|
@param text Input text string.
|
|
|
|
@param fontHeight Drawing font size by pixel unit.
|
|
|
|
@param fontHeight Drawing font size by pixel unit.
|
|
|
|
@param thickness Thickness of lines used to render the text. See putText for details.
|
|
|
|
@param thickness Thickness of lines used to render the text. See putText for details.
|
|
|
|
@param[out] baseLine y-coordinate of the baseline relative to the bottom-most text
|
|
|
|
@param[out] baseLine y-coordinate of the baseline relative to the bottom-most text
|
|
|
|
point.
|
|
|
|
point.
|
|
|
|
@return The size of a box that contains the specified text.
|
|
|
|
@return The size of a box that contains the specified text.
|
|
|
|
|
|
|
|
|
|
|
|
@see cv::putText
|
|
|
|
@see cv::putText
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
virtual Size getTextSize(const String& text,
|
|
|
|
virtual Size getTextSize(const String& text,
|
|
|
|
int fontHeight, int thickness,
|
|
|
|
int fontHeight, int thickness,
|
|
|
@ -121,15 +121,16 @@ point.
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief Create FreeType2 Instance
|
|
|
|
/** @brief Create FreeType2 Instance
|
|
|
|
|
|
|
|
|
|
|
|
The function createFreeType2 create instance to draw UTF-8 strings.
|
|
|
|
The function createFreeType2 create instance to draw UTF-8 strings.
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
Ptr<FreeType2> createFreeType2();
|
|
|
|
Ptr<FreeType2> createFreeType2();
|
|
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
//! @}
|
|
|
|
} } // namespace freetype
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace freetype
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _OPENCV_CVText_
|
|
|
|
#endif // _OPENCV_CVText_
|
|
|
|