摘要
OpenCV只提供英文字符的输出函数,不直接提供中文汉字的输出方法,而传统的视频图像添加汉字方法会造成字体大小不一、字体变形等问题。对此,基于OpenCV技术,采用像素过滤法,消除了传统方法的缺点,实现了视频图像时间、标题以及各种测井参数的中文汉字的动态添加。该方法算法简单、效率高、数据量少、效果良好。仅将程序关键代码封装在DLL中,内存占用量小;同时对录制的视频进行H264压缩和播放,节约大量存储空间。优化后的井下电视成像系统可以随时抓拍特殊井段图片,连续多小时采集录制,程序运行时内存平稳。
OpenCV only provides the output function of English characters,but does not directly provide the output function of Chinese characters. Traditional method of adding Chinese characters to video image will cause font size differences,font deformation and other problems. The disadvantages of traditional methods are eliminated by pixel filtering method based on OpenCV technology,which realizes the dynamic addition of time,title,Chinese characters and various logging parameters to video image. The algorithm is simple and efficient,and with less data and good results. Meanwhile,the recorded video is compressed and played by H264,which saves a lot of storage space. The system can capture the pictures of special well sections at any time. The program key codes are encapsulated in DLL. The system can collect and record continuously for many hours,and the memory is stable when the program is running.
引文
[1]柴树杉.基于Open CV的汉字绘制研究[J].计算机工程与设计,2008,29(19):5093-5095.CHAI Shushan. Research on drawing Chinese characters by Open CV[J]. Computer Engineering and Design,2008,29(19):5093-5095.
[2] FFMPEG.百度百科[EB/OL]. https://baike. baidu.com/item/ffmpeg/2665727? fr=aladdin,2014-09-15.
[3]雷霄骅.视音频数据处理入门:RGB、YUV像素数据处理[EB/OL]. https://blog. csdn. net/leixiaohua1020/article/details/50534150,2016-01-29.
[4]雷霄骅.最简单的基于FFMPEG的视频编码器[EB/OL]. https://blog. csdn. net/leixiaohua1020/article/details/25430425,2014-05-12.
[5] WULAFLY.基于Open CV 2. 4. 9/3. 1的汉字显示(Free Type 2. 6. 2)[EB/OL]. https://www. 2cto. com/kf/201612/561738. html,2016-12-10.
[6] DXTORY.视频压缩编码和解码(H264篇)[EB/OL].http://tieba. baidu. com/f? kw=dxtory&ie=utf-8,2013-08-15.
[7]希热明玛的博客. VC++主程序与DLL共享内存数据[EB/OL]. http://blog. sina. com. cn/s/blog_8a7012cf01014plk. html,2012-07-13.