| | |
| | | #include <opencv2/core/mat.hpp>
|
| | | #include <opencv2/imgproc.hpp>
|
| | |
|
| | | ~PLPLContext::PLPLContext()
|
| | | {
|
| | | delete (CvxText*)cvxText;
|
| | | cvxText = nullptr;
|
| | | }
|
| | |
|
| | | struct PL_Paint_Internal
|
| | | {
|
| | | uint8_t* buffer;
|
| | |
| | | LOG_ERROR << "fontPath is null!" << LOG_ENDL;
|
| | | return false;
|
| | | }
|
| | |
|
| | | if(in->config.plplCtx->cvxText != nullptr)
|
| | | {
|
| | | delete(in->config.plplCtx->cvxText);
|
| | | delete (CvxText*)in->config.plplCtx->cvxText;
|
| | | }
|
| | | CvxText* cvxText =new CvxText(in->config.fontPath.c_str());
|
| | | in->config.plplCtx->cvxText = cvxText;
|
| | | cvxText->setBackColor(cvScalar(128, 33, 14));
|
| | | CvScalar font = cvScalar(40,1,0.2,1);
|
| | | cvxText->setFont(0, &font);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | cv::putText(yMat, TXT, cv::Point(LTX, LTY), CV_FONT_HERSHEY_COMPLEX, 1, CV_RGB(Y, Y, Y));
|
| | | cv::putText(uvMat, TXT, cv::Point(MH_SUBSAMPLE1(LTX, 2), MH_SUBSAMPLE1(LTY, 2)), CV_FONT_HERSHEY_COMPLEX, 0.5, CV_RGB(UV, UV, UV));
|
| | | }
|
| | |
|
| | | bool plplDraw_WText_NV12(PLPLContext* plplCtx, MB_Frame* paintMb, int& paramOffset)
|
| | | {
|
| | | int LTX = plplCtx->params[paramOffset + 0].val_i;
|
| | | int LTY = plplCtx->params[paramOffset + 1].val_i;
|
| | | const char* TXT = plplCtx->params[paramOffset + 2].val_s;
|
| | | const char* WTXT = plplCtx->params[paramOffset + 2].val_s;
|
| | | paramOffset += 3;
|
| | |
|
| | | int src_width = paintMb->width;
|
| | |
| | |
|
| | | // void rectangle(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
|
| | |
|
| | | if (in->config.plplCtx->cvxText == nullptr)
|
| | | {
|
| | | CvxText* cvxText = new CvxText(in->config.fontPath.c_str());
|
| | | in->config.plplCtx->cvxText = cvxText;
|
| | | cvxText->setBackColor(cvScalar(128, 33, 14));
|
| | | CvScalar font = cvScalar(40, 1, 0.2, 1);
|
| | | cvxText->setFont(0, &font);
|
| | | }
|
| | | |
| | | const uint16_t Y = plplCtx->color_front.toY();
|
| | | const uint16_t UV = plplCtx->color_front.toUV();
|
| | | |
| | | CvxText* cvText = (CvxText*)plplCtx->cvxText;
|
| | | cvText->putText(yMat, L"中文ABCDabcd", cv::Point(LTX, LTY), CV_RGB(Y, Y, Y));
|
| | | cvText->putText(uvMat, L"中文ABCDabcd", cv::Point(MH_SUBSAMPLE1(LTX, 2),MH_SUBSAMPLE1(LTY, 2)), CV_RGB(UV, UV, UV));
|
| | | cvText->putText(yMat, (const wchar_t*)WTXT, cv::Point(LTX, LTY), CV_RGB(Y, Y, Y)); // L"中文ABCDabcd"
|
| | | cvText->putText(uvMat, (const wchar_t*)WTXT, cv::Point(MH_SUBSAMPLE1(LTX, 2), MH_SUBSAMPLE1(LTY, 2)), CV_RGB(UV, UV, UV)); // L"中文ABCDabcd"
|
| | | }
|
| | |
|
| | | bool plplExecutor_YUV(PL_Paint_Internal *in)
|
| | | {
|
| | | MB_Frame* paintMb = &(in->lastMbfBuffOrigin);
|
| | |
| | | break;
|
| | |
|
| | | case PLPLC_WTEXT:
|
| | | //TEXT LTX,LTY,"STR"
|
| | | //WTEXT LTX,LTY,"STR"
|
| | | if (paintMb->type == MB_Frame::MBFT_NV12)
|
| | | ret = plplDraw_WText_NV12(plplCtx, paintMb, paramOffset);
|
| | | else
|