GithubHelp home page GithubHelp logo

xiaqibo / freetype_opencv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from busyboxs/freetype_opencv

0.0 0.0 0.0 50.26 MB

OpenCV 在图像上显示中文

License: MIT License

C++ 93.35% C 2.14% CMake 4.51%

freetype_opencv's Introduction

freetype_opencv


更新:2020-11-14

  • 修改了画字形时移动画笔的方法(英文字体有高度位置关系,看起来更合适,但也有一点问题)
  • 修改多字节转 wchar 的方法,删除了原来跨平台的部分

修改了画字形的方法后,也引出了另一个问题,根据 freetype 官方的说明,使用修改后的画图方法会使得画的文字位置与你想要的位置有一定的偏差,因为我的代码里是使用字型的 origin 点作为 pos。因此,为了画出你想要的结果,可以在定位时稍微将 pos 的 y 增加一点点。或者在 putWChar 函数中的 gPos 加上一个 0 ~ font size 的值。

为了方便直接使用,我创建了两个分支

  • Clion 项目分支
  • Visual Studio 项目分支

你也可以新建项目,拷贝主分支的代码。


更新:2020-3-5

  • 重构代码
  • 添加下划线
  • 测试了其他字符集(包括日语和 Segoe UI)

更新:2019-11-2

  • 使用 OpenCV 4.1
  • 使用 freetype 2.10.1
  • 支持 竖向文字、旋转文字

运行效果

中文测试效果

日文测试效果

Unicode 字符测试效果(需要使用对应的字体)

freetype_opencv's People

Contributors

busyboxs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.