美文网首页
OpenCVforUnity案例说明

OpenCVforUnity案例说明

作者: 爱喝粥的西瓜 | 来源:发表于2020-09-09 00:47 被阅读0次

Basic(基础)

场景名 说明
Texture2D To Mat Example 演示Texture2D和自定义Mat对象如何互相转换
WebCam Texture To Mat Example 通过指定摄像头编号或名称,从而获取WebCamDevice对象和WebCamTexture对象;如果没有指定,则默认从后置摄像头获取。

WebCamDevice对象创建时,可以指定宽度,高度,帧率。

Update中,将WebCamDevice对象先缓存到自定义Mat对象中,再从Mat转存至Texture2D对象中。分别用到Utils.webCamTextureToMat (webCamTexture, rgbaMat, colors)和Utils.matToTexture2D (rgbaMat, texture, colors)两个方法。
WebCamTexture To MatHelper Example 外接摄像头的相关操作
Mat Basic Processing Example Core工具类对于Mat的操作
Utils_Get File Path Example 获取StreamingAssets中指定文件名的文件的路径

Advanced(进阶)

场景名 说明
Comic Filter Example 素描风格滤镜
Green Screen Example 绿幕抠像
Hand Pose Estimation Example 手势识别
Multi Object Tracking Based On Color Example 依据颜色区分多个物体
Polygon Filter Example 多边形风格滤镜
Alpha Blending Example 透明度融合
Mat To Texture In Render Thread Example 渲染管线中Mat于Texture的转换

Main Modules(主要模块)

  core

场景名 说明
PCA Example 识别几个物体轮廓并用红线描边

用PCA算法计算单个物体的主成方向,并用青色箭头指示

  imgproc

场景名 说明
Circle Detection Example 圆形检测
Connected Components Example 连续图案检测
Convex Hull Example 凸包逼近
Drawing Example 基础图形绘制
Grab Cut Example 遮罩抠像

利用遮罩图对原始图片进行抠像
Hough LinesP Example 霍夫曼直线检测
Match Shapes Example 轮廓匹配

Imgproc.findContours (srcMat, srcContours, srcHierarchy, Imgproc.RETR_CCOMP, Imgproc.CHAIN_APPROX_NONE)--识别轮廓数目

Imgproc.drawContours (dstMat, srcContours, i, new Scalar (255, 0, 0), 2, 8, srcHierarchy, 0, new Point ())绘制红色轮廓线

Imgproc.circle (dstMat, point, 5, new Scalar (0, 0, 255), -1)绘制蓝色轮廓中心点

Imgproc.putText (dstMat, " " + returnVal, point, Imgproc.FONT_HERSHEY_SIMPLEX, 0.4, new Scalar (0, 255, 0), 1, Imgproc.LINE_AA, false)绘制绿色误差数值
Match Template Example 模板匹配

对于旋转,缩放缺少应对力
Threshold Example 阈值

Imgproc.threshold (Mat src, Mat dst, double thresh, double maxval, int type)
Wrap Perspective Example 透视变换

Mat perspectiveTransform = Imgproc.getPerspectiveTransform (src_mat, dst_mat)

  videoio

场景名 说明
Video Capture Example 视频播放
Video Writer Example 视频写入

  video

场景名 说明
Background Subtractor MOG2 Example 背景抠像
CamShift Example 四点确定追踪
Kalman Filter Example 鼠标轨迹绘制
Optical Flow Example 光流追踪

摄像机运动追踪?

  calib3d

场景名 说明
StereoBm Example 双目深度计算

  features2d

场景名 说明
Feature2D Example 特征点匹配
MSER Example 表示没看懂也不知道什么时候用

  imgcodecs

场景名 说明
imwrite Screen Capture Example 屏幕截图

imwrite (string filename, Mat img)

  imgcodecs

场景名 说明
Face Detection Example 人脸检测_图片
Face Detection WebCamTexture Example 人脸检测_摄像头画面
Asynchronous Face Detection WebCamTexture Example 人脸检测摄像头画面异步
HOGDescriptor Example 行人检测
QRCodeDetector Example 二维码区域检测
QRCodeDetector WebCamTexture Example 二维码区域检测_摄像头

好像没效果?

  dnn

ps:dnn网络训练? 貌似要下载相应的训练数据库才行

场景名 说明

  ml(机器学期)

场景名 说明
SVM Example 图像分类器(支持向量机)?

  photo

场景名 说明
Inpaint Example 图像修复

Photo.inpaint (Mat src, Mat inpaintMask, Mat dst, double inpaintRadius, int flags)
SeamlessClone Example 无缝融合

Photo.seamlessClone (Mat src, Mat dst, Mat mask, Point p, Mat blend, int flags)

Contrib modules(暂时不知道什么模块)

  aruco

场景名 说明
ArUco Example mark跟踪_图像
ArUco WebCamTexture Example mark跟踪_摄像头
ArUco Create Marker Example mark创建
ArUco Camera Calibration Example 不知道干啥的,创建了一个xml文件

  face

场景名 说明
FaceMark Example 没看出效果,还报错
FaceRecognizer Example 面部识别(相似度检测)?

  plot

场景名 说明
Plot Example 图表

  shape

场景名 说明
ThinPlateSplineShapeTransformer Example 变形操作

  text

场景名 说明
Text Detection Example 获取文字位置
Text Recognition Example 文字识别(中文然并卵)

  tracking

场景名 说明
Tracking Example 追踪

相关文章

网友评论

      本文标题:OpenCVforUnity案例说明

      本文链接:https://www.haomeiwen.com/subject/boksektx.html