Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasibo committed May 9, 2017
1 parent c18b5c0 commit 2293afc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
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`

0 comments on commit 2293afc

Please sign in to comment.