-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jiasibo
committed
May 9, 2017
1 parent
c18b5c0
commit 2293afc
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# cvUniText | ||
|
||
A C++ library of drawing unicode text with user-defined font based on OpenCV 2. | ||
Modified based on [this opencv 1 library](https://github.com/buaabyl/cvPutUniText) | ||
|
||
## Compilation | ||
|
||
This repo contains the source of the library and a pre-compiled version (with GCC 4.8.5, on our GPU servers). You can always try the pre-compiled version first, under `install/`. If it fails, compile as follows: | ||
|
||
1. Navigate to the root of this repo. Run `cmake .`. The minimum version of cmake required is 3.8. | ||
2. `make` | ||
3. Copy `cvUniText.hpp` and `libcvunitext.so` to your project. | ||
|
||
## Example | ||
``` | ||
cv::Mat img = cv::imread("1.jpg"); | ||
// Create an instance with font file path and size | ||
uni_text::UniText uniText("/usr/share/fonts/wqy-microhei/wqy-microhei.ttc", 80); | ||
// Specify the position and color of your text | ||
cv::Point p(100, 100); | ||
cv::Scalar color(0,255,0); | ||
// Draw the text. The return value is the bounding box of the text | ||
// Set the last argument to `true` in order to get the rect without actually drawing the text | ||
cv::Rect rect = uniText.PutText(img, "Hello, 哈哈哈哈嗝", p, color, false); | ||
std::cout << rect << std::endl; | ||
cv::imwrite("1.jpg", img); | ||
return 0; | ||
``` | ||
|
||
Detailed comments can be found in `cvUniText.hpp` |