概述
在上一节中,我们进行了视频采集的需求分析,并封装了视频采集的接口类。在视频画面上,往往会叠加时间信息和各种文字信息,这就需要用到点阵字库。点阵字库一般有两种,一种是纯色字库,另一种是描边字库。纯色字库在视频背景色与文字颜色大致相同时,会导致文字很难辨认。描边字库则克服了纯色字库的缺点,但描边字库占用的空间更大。
除此之外,我们还需要能叠加图片,比如:bmp格式的图片、png格式的图片等。因此,读取图片,并将图片数据转换为君正SDK OSD模块需要的数据形式,也是必须提前实现的功能。
点阵字库的实现
点阵字库的头文件如下:
#pragma once#include <stdio.h>#include "HP_Mutex.h"class CHP_LatticeFont
{
public:static void Open();static CHP_LatticeFont *&Singleton();static void Close();int Init(const char *pszAsc16File, const char *pszHz16File, const char *pszAsc16StrokeFile = NULL,const char *pszHz16StrokeFile = NULL);void DeInit();int GetCode(const char *pszText, char *pCode, int &nTotalCodeLen, bool bUseStrokeFont = false);