AI 音乐推荐的质量评估:协同过滤与内容理解的混合策略
2026/7/25 1:27:24
这个程序使用OpenCV检测场景中的文本。
输入图片:
程序运行后会用绿色的多边形标注出图片里的两行文本:
用到的AI模型是frozen_east_text_detection.pb
代码:
#include <iostream> #include <fstream> #include <opencv2/imgproc.hpp> #include <opencv2/highgui.hpp> int main() { Mat frame = imread("/path/to/text_det_test.png"); TextDetectionModel_EAST model("/path/to/EAST.pb"); float confThreshold = 0.5; float nmsThreshold = 0.4; model.setConfidenceThreshold(confThresh) .setNMSThreshold(nmsThresh); double detScale = 1.0; Size detInputSize = Size(320, 320); Scalar detMean = Scalar(123.68, 116.78, 103.94); bool swapRB = true; model.setInputParams(detScale, detInputSize, detMean, swapRB); std::vector<std::vector<Point>> detResults; model.detect(detResults); polylines(frame, results, true, Scalar(0, 255, 0), 2); imshow("Text Detection", image); waitKey(); }