当前位置:网站首页>In unity, opencv and QT are used to create a plugin (I)
In unity, opencv and QT are used to create a plugin (I)
2022-06-11 19:51:00 【qianbo_ insist】
1、unity
unity Is a very good tool , Simple and easy to use , How to be in unity Use in opencv? There are two ways , One is the rgba Transmit past , Create a service receiving , One is to use plug-ins , For those familiar with dynamic libraries , Relatively simple .
2、 Use qt Build dynamic link library
qt Inside, a dynamic link library is built , choice mingw 64
Use qt The advantage is to build a dynamic library and adapt to multiple operating systems at the same time
#include "imagelib_global.h"
struct Color32
{
uchar r;
uchar g;
uchar b;
uchar a;
};
extern "C"
{
IMAGELIB_EXPORT void ImageProcess(Color32* raw, int width, int height);
}
#endif // IMAGELIB_H
/
#include "imagelib.h"
extern "C"
{
void ImageProcess(Color32* raw, int width, int height)
{
// Use here opencv function
using namespace cv;
using namespace std;
Mat frame(height, width, CV_8UC4, raw);
}
}
The above is the most basic use method , Just compile it , stay windows Inside is dll Dynamic library , stay linux and android Inside is so file .
3、unity camera
Again ,unity The dynamic library can be used to receive rtsp The picture of , meanwhile , You can also use WebCapTexture To get web camera , untiy Use c# Code
public WebCamTexture webcam;
if (webcam.isPlaying)
{
Color32[] rawImg = webcam.GetPixels32();
System.Array.Reverse(rawImg);
processImage(rawImg, webcam.width, webcam.height);
}
//Runtime
using System.Runtime.InteropServices;
[DllImport("Imagelib", EntryPoint = "processImage")]
public static extern void processImage(Color32[] raw, int width, int height);
The above is the use of usb 's camera , There is no need to process every frame , Bear in mind
4、unity Transport in
unity Transmission schemes can be used in , Like receiving rtsp perhaps sip GB28181 In the video , You can use plug-ins , Use c++ Complete the transmission Library , stay unity Just show it inside .
This will be covered in the next article .
边栏推荐
- Are there any techniques for 3D modeling?
- Richter's substitution principle
- APB2standard_ handshake_ Bridge design
- 巴比特 | 元宇宙每日必读:数字藏品二级市场乱象丛生,00后成新韭菜,监管迫在眉睫?...
- 【C语言刷题——Leetcode10道简单题】
- 【求助】请问如何让微信公众号文章在外部浏览器中打开后还能显示下方的精选留言?
- Image transformation torchvision Transforms notes
- Common - name of conference room
- PIL pilot image processing [1] - installation and creation
- Leetcode2027. 转换字符串的最少操作次数(可以,一次过)
猜你喜欢

In 2021, the global adult diaper revenue was about $11560million, which is expected to reach $15440million in 2028. From 2022 to 2028, the CAGR was 4.2%

Postman configuration Chinese

Tensorflow --- creation and reading of tfrecord file

激活函数公式、导数、图像笔记

Global Market Consulting - Research Report on the overall scale and application segmentation of the global HVDC converter station market in 2022

2022年最新宁夏建筑八大员(标准员)考试试题及答案

Anaconda安装、Jupyter Notebook默认启动路径修改及Nbextensions插件安装

Hanging memory recursive dynamic programming (with example explanation POJ 1163)

计算926的9260次方里的字符串里有多少个926

In 2021, the global revenue of flexible fireproof sealant is about 755.2 million dollars, and it is expected to reach 1211.7 million dollars in 2028
随机推荐
Lecture 30 linear algebra Lecture 2 Matrix
RTL arbiter design
Questions and requirements of the "high rise building structure" assignment of Dayong in the 21st autumn [standard answer]
Proficient in xmake
Qubicle notes: Hello voxel
POJ 1458 longest common subsequence (dynamic planning exercise)
Anaconda安装、Jupyter Notebook默认启动路径修改及Nbextensions插件安装
Two minutes to show you the charging standard of the Sub Ledger System
Golang learning notes - Basics
Hospital intelligent infusion management system source code hospital source code
A brief talk on shutter button
【四川大学】初试复试考研资料分享
AHB2Standard_ handshake_ Bridge design
Flutter doctor shows the solution that Xcode is not installed
CMU 15-445 數據庫課程第五課文字版 - 緩沖池
Comp3411 -prolog language
Template and requirements of curriculum design of reinforced concrete structure in autumn 21 of Dagong [standard answer]
基于飞桨搭建的多模态学习工具包PaddleMM
【 aide 】 comment puis - je faire en sorte que les messages sélectionnés ci - dessous puissent être affichés après l'ouverture de l'article Wechat public number dans un navigateur externe?
556. 下一个更大元素 III-(31. 下一个排列)-两次遍历