Untiy UDP局域网 异步发送图片

2023-10-27

同步画面有问题,传图片吧

using System.Text;
using System.Net.Sockets;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using System.Net;
using System;
using System.Threading.Tasks;
using System.Threading;

public class UdpNet : MonoBehaviour
{
    public static UdpNet Instance { get; private set; }
    /// <summary>
    /// 默认发送数据最大长度,UDP一次性最大发送长度为65536,也就是64kb
    /// </summary>
    const int DEFAULT_SIZE = 60000;
    public UdpClient udpClient;
    /// <summary>
    /// 是否可以发送数据
    /// </summary>
    public bool isSend;
    /// <summary>
    /// 要发送的数据缓存队列
    /// </summary>
    private Queue<NetData> datasBuffer;
    /// <summary>
    /// 当前发送的数据
    /// </summary>
    private NetData curSendData;
    /// <summary>
    /// 数据接收注册方法
    /// </summary>
    public UnityAction<byte[]> ReceiveDataAction;
    /// <summary>
    /// UDP是否开启
    /// </summary>
    public bool IsConnect { get; private set; }
    /// <summary>
    /// 数据接收缓存队列
    /// </summary>
    public Queue<NetData> receiveBufferQueue;
    /// <summary>
    /// 当前接收的缓存数据
    /// </summary>
    private NetData curReceiveData;
    /// <summary>
    /// 当前发送的数据长度
    /// </summary> <summary>
    private int byteLen;
    /// <summary>
    /// 当前接收的数据长度
    /// </summary> <summary>
    private int receiveLen;
    public int Port;

    /// <summary>
    /// 开启UDP
    /// </summary>
    /// <param name="port"></param>
    public void Init(int port)
    {
        if (udpClient != null)
        {
            //Debug.LogWarning("已开启UDP控制端");
            return;
        }
        Port = port;
        udpClient = new UdpClient(port);
        datasBuffer = new Queue<NetData>();
        receiveBufferQueue = new Queue<NetData>();
        isSend = true;
        IsConnect = true;
        ReceiveFile();
    }
    /// <summary>
    /// 关闭UDP
    /// </summary>
    void Close()
    {
        if (udpClient != null)
        {
            udpClient.Close();
            udpClient.Dispose();
            udpClient = null;
            IsConnect = false;
            isSend = false;
            datasBuffer.Clear();
            curSendData = null;
            curReceiveData = null;
            receiveBufferQueue.Clear();
            //Debug.Log("UdpNet 已关闭");
        }
    }

    #region Mono方法
    void Awake()
    {
        Instance = this;
        // Init(Port);
    }
    private void Update()
    {
        if (!IsConnect)
        {
            return;
        }
        if (isSend && datasBuffer.Count > 0 && curSendData == null)
        {
            isSend = false;
            curSendData = datasBuffer.Dequeue();
            byteLen = 0;
            int len = curSendData.byteArray.length;
            if (curSendData.byteArray.length > DEFAULT_SIZE)
            {
                len = DEFAULT_SIZE;
            }
            byteLen += len;
            byte[] bytes = curSendData.byteArray.Read(len);
            udpClient.BeginSend(bytes, len, curSendData.iPEndPoint, SendFileAysncCallBack, curSendData);
        }

        if (receiveBufferQueue.Count > 0)
        {
            ReceiveDataAction?.Invoke(receiveBufferQueue.Dequeue().byteArray.bytes);
        }
    }
    void OnDestroy()
    {
        Close();
    }
    #endregion

    #region 发送消息
    public void SendMsg(string msg, string ip, int port)
    {
        byte[] data = Encoding.UTF8.GetBytes(msg);
        SendBytes(data, ip, port);

    }
    public void SendMsg(string msg, IPEndPoint iPEndPoint)
    {
        byte[] data = Encoding.UTF8.GetBytes(msg);
        SendBytes(data, iPEndPoint);

    }

    public void SendBytes(byte[] data, string ip, int port)
    {
        IPEndPoint iPEndPoint = new IPEndPoint(IPAddress.Parse(ip), port);
        SendBytes(data, iPEndPoint);
    }
    public void SendBytes(byte[] data, IPEndPoint iPEndPoint)
    {
        byte[] bytes = Encode(data);
        //Debug.Log(bytes.Length);
        ByteArray byteArray = new ByteArray(bytes);
        datasBuffer.Enqueue(new NetData(byteArray, iPEndPoint));
    }
    private void SendFileAysncCallBack(IAsyncResult ar)
    {
        try
        {
            int count = udpClient.EndSend(ar);
            if (ar.IsCompleted)
            {

                curSendData.byteArray.readIdx += count;
            }
            else
            {
                Debug.Log("发送未成功,重新发送");
            }

            if (curSendData.byteArray.length == 0)
            {
                isSend = true;
                //Debug.Log("发送完毕,共发送数据: " + byteLen);
                curSendData = null;
                return;
            }
            int len = curSendData.byteArray.length;
            if (curSendData.byteArray.length > DEFAULT_SIZE)
            {
                len = DEFAULT_SIZE;
            }


            byte[] bytes;
            lock (curSendData)
            {
                bytes = curSendData.byteArray.Read(len);
            }
            byteLen += len;

            //Debug.Log(len);

            RunThread(bytes, len);

        }
        catch (System.Exception e)
        {
            Debug.LogError(e.Message);
            Close();
            return;
        }
    }
    //延迟1毫秒发送已缓解udp无法接收完全的问题
    async void RunThread(byte[] bytes, int len)
    {
        await Task.Run(() =>
        {
            Thread.Sleep(1);
            udpClient.BeginSend(bytes, len, curSendData.iPEndPoint, SendFileAysncCallBack, curSendData);
        });
    }
    #endregion

    #region 接收消息
    private void ReceiveFile()
    {
        udpClient.BeginReceive(ReceiveFileAsyncBackCall, null);
    }


    private void ReceiveFileAsyncBackCall(IAsyncResult ar)
    {

        IPEndPoint remoteIp = null;

        byte[] data = udpClient.EndReceive(ar, ref remoteIp);


        receiveLen += data.Length;
        if (curReceiveData == null)
        {

            int len = Decode(data, out byte[] conData);

            curReceiveData = new NetData(new ByteArray(len), remoteIp);

            // curReceiveData.byteArray.Write(data, 4, data.Length - 4);
            curReceiveData.byteArray.Write(conData, 0, conData.Length);

            //Debug.Log($"当前接收数据长度: {receiveLen},总接收数据长度: {receiveLen}, 当前剩余容量: {curReceiveData.byteArray.remain}");
        }
        else
        {

            int dataLen = data.Length;
            if (data.Length > curReceiveData.byteArray.remain)
            {
                dataLen = curReceiveData.byteArray.remain;
            }

            curReceiveData.byteArray.Write(data, 0, dataLen);

            //Debug.Log($"当前接收数据长度: {data.Length},总接收数据长度: {receiveLen}, 当前剩余容量: {curReceiveData.byteArray.remain}");
        }


        if (curReceiveData.byteArray.remain == 0)
        {
            receiveBufferQueue.Enqueue(curReceiveData);
            //Debug.Log("接收完毕: " + curReceiveData.byteArray.writeIdx);
            curReceiveData = null;
        }

        ReceiveFile();
    }

    #endregion


    private static byte[] Encode(byte[] data)
    {
        byte[] bytes = new byte[data.Length + 4];
        byte[] byteLen = BitConverter.GetBytes(data.Length);
        Array.Copy(byteLen, 0, bytes, 0, 4);
        Array.Copy(data, 0, bytes, 4, data.Length);
        //Debug.Log(bytes.Length);
        return bytes;
    }
    private static int Decode(byte[] data, out byte[] bytes)
    {
        byte[] byteLen = new byte[4];
        Array.Copy(data, 0, byteLen, 0, 4);
        int len = BitConverter.ToInt32(byteLen);
        bytes = new byte[data.Length - 4];
        //Debug.Log("总数据长度: " + (len + 4));
        //Debug.Log("数据内容长度: " + len);
        Array.Copy(data, 4, bytes, 0, bytes.Length);
        return len;
    }

    public class NetData
    {
        public NetData(ByteArray byteArray, IPEndPoint iPEndPoint)
        {
            this.byteArray = byteArray;
            this.iPEndPoint = iPEndPoint;
        }
        public ByteArray byteArray;
        public IPEndPoint iPEndPoint;
    }
}

using UnityEngine.UI;
using System;

[Serializable]
public class ByteArray
{
    //默认大小
    const int DEFAULT_SIZE = 4096;
    //初始大小
    int initSize = 0;
    //缓冲区
    public byte[] bytes;
    //读写位置
    public int readIdx = 0;
    public int writeIdx = 0;
    //容量
    private int capacity = 0;
    //剩余空间
    public int remain { get { return capacity - writeIdx; } }
    //数据长度
    public int length { get { return writeIdx - readIdx; } }

    //构造函数
    public ByteArray(int size = DEFAULT_SIZE)
    {
        bytes = new byte[size];
        capacity = size;
        initSize = size;
        readIdx = 0;
        writeIdx = 0;
    }

    //构造函数
    public ByteArray(byte[] defaultBytes)
    {
        bytes = defaultBytes;
        capacity = defaultBytes.Length;
        initSize = defaultBytes.Length;
        readIdx = 0;
        writeIdx = defaultBytes.Length;
    }

    //重设尺寸
    public void ReSize(int size)
    {
        if (size < length) return;
        if (size < initSize) return;
        int n = 1;
        while (n < size) n *= 2;
        capacity = n;
        byte[] newBytes = new byte[capacity];
        Array.Copy(bytes, readIdx, newBytes, 0, writeIdx - readIdx);
        bytes = newBytes;
        writeIdx = length;
        readIdx = 0;
    }

    //写入数据
    public int Write(byte[] bs, int offset, int count)
    {
        // UnityEngine.Debug.Log($"remain: {remain} - bs.Length: {bs.Length} - offset: {offset} - count{count} - bytes.Length: {bytes.Length} - writeIdx: {writeIdx}");
        if (remain < count)
        {
            ReSize(length + count);
        }
        Array.Copy(bs, offset, bytes, writeIdx, count);
        writeIdx += count;
        return count;
    }

    //读取数据
    public int Read(byte[] bs, int offset, int count)
    {
        count = Math.Min(count, length);
        Array.Copy(bytes, 0, bs, offset, count);
        readIdx += count;
        CheckAndMoveBytes();
        return count;
    }
    //读取数据
    public byte[] Read(int count)
    {
        // UnityEngine.Debug.Log($"当前数据长度为 {length},从 {readIdx} 开始读取长度为 {count} 的数据, 剩余数据长度为 {writeIdx - readIdx - count}");
        byte[] bs = new byte[count];
        Array.Copy(bytes, readIdx, bs, 0, count);
        // readIdx += count;
        return bs;
    }

    //检查并移动数据
    public void CheckAndMoveBytes()
    {
        if (length < 8)
        {
            MoveBytes();
        }
    }

    //移动数据
    public void MoveBytes()
    {
        Array.Copy(bytes, readIdx, bytes, 0, length);
        writeIdx = length;
        readIdx = 0;
    }

    //读取Int16
    public Int16 ReadInt16()
    {
        if (length < 2) return 0;
        Int16 ret = BitConverter.ToInt16(bytes, readIdx);
        readIdx += 2;
        CheckAndMoveBytes();
        return ret;
    }

    //读取Int32
    public Int32 ReadInt32()
    {
        if (length < 4) return 0;
        Int32 ret = BitConverter.ToInt32(bytes, readIdx);
        readIdx += 4;
        CheckAndMoveBytes();
        return ret;
    }



    //打印缓冲区
    public override string ToString()
    {
        return BitConverter.ToString(bytes, readIdx, length);
    }

    //打印调试信息
    public string Debug()
    {
        return string.Format("readIdx({0}) writeIdx({1}) bytes({2})",
            readIdx,
            writeIdx,
            BitConverter.ToString(bytes, 0, capacity)
        );
    }
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
//接收视频画面
public class : MonoBehaviour
{
    public RawImage rawImage;
    public int port = 8889;
    // Start is called before the first frame update
    void Start()
    {
        UdpNet.Instance.Init(port);
        UdpNet.Instance.ReceiveDataAction += ReceiveDataAction;
    }

    private void ReceiveDataAction(byte[] arg0)
    {
        if (arg0.Length < 1000)
        {
            Debug.Log(Encoding.UTF8.GetString(arg0));
            return;
        }

        Texture2D texture2D = new Texture2D(10, 10);
        texture2D.LoadImage(arg0);
        texture2D.Apply();
        rawImage.texture = texture2D;

        Resources.UnloadUnusedAssets();

    }

    // Update is called once per frame
    void Update()
    {

    }
}

using System.Collections;
using System.Collections.Generic;
using System.Net;
using UnityEngine;
using UnityEngine.UI;
//发送视频画面
public class SendWebCameraVideo: MonoBehaviour
{
    public string deviceName;
    public WebCamTexture webCam;
    public RawImage rawImage;
    public int frames = 30;
    public string ToIP = "127.0.0.1";
    public int ToPort = 8889;
    public int Port = 7777;
    private IPEndPoint iPEndPoint;
    public float maxTime;
    public float timer;
    public bool send;
    // Start is called before the first frame update
    void Start()
    {
        UdpNet.Instance.Init(Port);
        WebCamDevice[] devices = WebCamTexture.devices;
        deviceName = devices[0].name;
        RectTransform rawRect = rawImage.GetComponent<RectTransform>();
        webCam = new WebCamTexture(deviceName, (int)rawRect.sizeDelta.x, (int)rawRect.sizeDelta.y, frames);//设置宽、高和帧率   
        rawImage.texture = webCam;//渲染脚本所在有RawImage组件的物体
        maxTime = 1f / frames;
        iPEndPoint = new IPEndPoint(IPAddress.Parse(ToIP), ToPort);

        UdpNet.Instance.SendMsg("gogogo", iPEndPoint);
    }

    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;
        if (timer >= maxTime && send)
        {
            // send = false;
            timer = 0;
            byte[] data = TextureToTexture2D(rawImage.texture).EncodeToJPG();
            UdpNet.Instance.SendBytes(data, iPEndPoint);
            // Resources.UnloadUnusedAssets();
        }
    }

    public void Play()
    {

        webCam.Play();
        send = true;
    }
    public void Pause()
    {
        send = false;
        webCam.Pause();
    }

    /// 运行模式下Texture转换成Texture2D
    private Texture2D TextureToTexture2D(Texture texture)
    {
        Texture2D texture2D = new Texture2D(texture.width, texture.height, TextureFormat.RGBA32, false);
        RenderTexture currentRT = RenderTexture.active;
        RenderTexture renderTexture = RenderTexture.GetTemporary(texture.width, texture.height, 32);
        Graphics.Blit(texture, renderTexture);

        RenderTexture.active = renderTexture;
        texture2D.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
        texture2D.Apply();

        RenderTexture.active = currentRT;
        RenderTexture.ReleaseTemporary(renderTexture);

        return texture2D;
    }


}

建两个工程,一个发送一个接收,UdpNet和ByteArray是通用的,每个工程都必须要有
1.发送工程界面
发送工程界面
2.接收界面工程
在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Untiy UDP局域网 异步发送图片 的相关文章

  • 使用 Twisted Python 的 UDP 客户端和服务器

    我想创建一个服务器和客户端 使用 Twisted 从网络发送和接收 UDP 数据包 我已经用 Python 中的套接字编写了此代码 但想利用 Twisted 的回调和线程功能 然而 我需要 Twisted 设计方面的帮助 我想接收多种类型的
  • 在调用堆栈中看到大量 clr!CLR Semaphore::Wait

    我们看到很多像下面这样的调用堆栈 我可以知道什么条件 情况会发生这种情况吗 OS Thread Id 0x48654 559 Current frame ntdll NtWaitForSingleObject 0xa Child SP Re
  • 代码块 power 函数在 c 中不起作用

    我正在使用代码块来学习c 我的代码是 include
  • 在 DataGridView 中隐藏行非常慢

    我在 Winforms 应用程序中有一个 DataGridView 大约有 1000 行 未绑定 和 50 列 隐藏一列需要整整 2 秒 当我想隐藏大约一半的行时 这就成为一个问题 private void ShowRows string
  • 操作/Lambda 表达式内存管理问题

    我将一个操作存储在局部变量中 然后在该局部变量超出范围后使用 使用前是否有被清理的危险 这是一个例子 public List GetMaps Action
  • C++:将模板参数的模板类型成员添加为好友的正确语法?

    我有一个带有模板类型参数 tTRAIT 的类 我想加一个模板为好友type member aliastTRAIT 但我无法弄清楚语法 这可能吗 template
  • 如何填充两个样条线或直线系列之间的区域

    我有这个Chart 如何填充两个之间的区域Series S0 and S1 说蓝色和黄色Series 为此 我们编写了其中之一Paint事件 这里的ValueToPixelPosition https msdn microsoft com
  • 带双重检查锁的单例设计模式

    假设您有以下代码 1 为什么我们使用双重检查锁 为什么单锁不够好 请提供详细的例子 2 这种实施方式的主要缺点是什么 我该如何证明呢 Thanks public sealed class SomeSingleton5 private sta
  • Visual Studio Code 调试默认 ASP.NET Core MVC WebApp:不起作用

    我正在使用 Manjaro linux 并尝试调试默认的 ASP NET Core MVC 项目 但调试停止 没有任何错误 我创建了该项目 dotnet new mvc in a Meow文件夹 没什么特别的 然后添加了新的配置 NET C
  • 使用宏计算源文件行数?

    是否可以使用 C C 预处理器将源文件中的行数计算为宏或某种编译时可用值 例如 我可以更换吗MAGIC1 MAGIC2 and MAGIC3在下面 并在使用时以某种方式获取值 4MAGIC3 MAGIC1 can be placed whe
  • printf() 使用字符串表“解码器环”调试库

    我写这封信是想看看你们中是否有人见过或听说过我即将描述的想法的实现 我有兴趣为嵌入式目标开发 printf 风格的调试库 目标非常遥远 并且我和目标之间的通信带宽预算非常紧张 因此我希望能够以非常有效的格式获取调试消息 通常 调试语句如下所
  • TreeView:仅在子节点中存在复选框

    我需要一个树视图控件 根节点没有复选框 只有图像 所有子节点都有一个复选框 图像 C net 2 0 winforms 不是 wpf WinForms树视图默认不支持混合复选框 非复选框节点 您可以在树视图上全局启用复选框 并使用以下命令在
  • C# Julian 日期解析器

    我在电子表格中有一个单元格 它是 Excel 中的日期对象 但当它来自 C1 的 xls 类时 它会变成双精度型 类似于 2009 年 1 月 7 日的 39820 0 我读到这是儒略日期格式 有人可以告诉我如何在 C 中将其解析回 Dat
  • 如何使用 xamarin 表单提示用户进行地理定位

    我正在 Xamarin Forms 应用程序中开发一个应用程序 需要请求地理位置权限 如果获得许可 它需要从设备获取地理位置数据 然后将地理位置坐标放入 Forecast io URL 我正在使用 James 的 Geolocator 插件
  • 未找到 _sqlite3_open 等符号错误

    您好 我收到此错误 Undefined symbols sqlite3 open referenced from main in ccRlWVer o sqliite3 close referenced from main in ccRlW
  • 在 C# WinForms 中预览文档(Word、Excel、PDF、文本文件等)?

    我正在开发一个 C WinForms 应用程序 我希望能够 预览 其中的各种文档类型 也就是说 当用户从列表中选择文件名时 它会在下面以相同的形式显示所选文件的预览 这很像 Outlook 允许您无需双击即可预览选定邮件的方式 有没有什么方
  • 如何在 Winform DataGridView 中创建不同的单元格格式

    我有一个 DataGridView 我将其绑定到 DataTable DataTable 是一个全数字值 要求 DataGridView 中的每 n 行都包含文本 而不是数值 以便在视觉上为用户分隔部分 我很高兴在绑定后将此文本数据放入 D
  • 获取会议组织者邮件地址 EWS API

    我想使用 EWS API 获取会议组织者的邮件地址 目前 我刚刚获得约会项目的一些属性 我听说你可以设置你想要获取哪些属性 我的代码看起来像这样 CalendarView cview new CalendarView start end c
  • 如何在没有 Visual Studio 的情况下将新文件添加到 .csproj 文件

    如何添加新文件到 csproj从命令提示符 我认为没有任何工具可以响应命令行上的 add project 命令来执行此操作 但我认为您可以幸运地创建一个程序 脚本来直接操作 csproj 文件的 XML 内容 csproj 文件的结构如下所
  • 类模板的 C++ 静态成员 - 链接器警告“多重定义”[重复]

    这个问题在这里已经有答案了 假设出于某种原因 我想要一个类模板 MyTemp 和一些静态数据成员 smDummyVar Mytemp h ifndef MY TEMP H define MY TEMP H template

随机推荐

  • Keil 5使用JLink直接调试正在运行的CPU

    原文链接 环境 目标CPU STM32F429 连接工具 JLink V9 连接方式 SWD 调试工具 Keil MDK 5 20 使用场景 目标板正在运行 但是出BUG了 需要调试 而当前又没有在线debug 于是就需要用调试器在不复位C
  • C++ Streams

    1 fstream File table data txt 的内容为 137 2 71828 42 3 14159 7897987 1 608 1337 01101010001 从上述文件中读取第一个整数和第二个小数 ifstream in
  • 一篇文章学懂ADB命令和Monkey命令

    一篇文章学懂ADB命令和Monkey命令 1 adb命令 1 1 查看连接设备 1 2 查看adb版本 1 3 查看手机当前启动App的应用名和包名 1 4 使用aapt使用aapt 查看app的包名和启动名 查看app的包名和启动名 1
  • Element框架更换主题色

    Element 默认的主题色是鲜艳 友好的蓝色 但是UI小姐姐在设计的时候会为了更贴合项目主旨设计出其他颜色的主题色 比如新能源项目一般选用绿色做为主题色 此时我们就需要更改Element框架的主题色 一开始博主的想法是全局修改框架默认样式
  • JDBC连接各种数据库

    ConnectHSQLDB java Java代码 ConnectHSQLDB java package com javaworkspace connecthsqldb import java sql Connection import j
  • /usr/lib64/sa/sa2脚本解释

    文章目录 前言 脚本原文 脚本解释 前言 usr lib64 sa sa1脚本和 usr lib64 sa sa2脚本都是Linux 系统上的 sysstat 工具的一部分 在 etc cron d sysstat这个定时任务下执行 用来收
  • arm+linux swap出错问题

    今天 程序跑了两个小时 忽然出现如下信息 swap dup Bad swap file entry 002fdf80 VM killing process intrusion test swap free Bad swap file ent
  • Android-S模拟器

    0 前言 参考资料 1 基于Android P对Emulator的使用进行了说明 Android S情况有变 因此撰写本文进行记录 1 编译 根据参考资料 1 的方法编译 aosp x86 64 eng 完成后执行emulator无法正常进
  • 南京美食,为吃遍天下做准备~~

    标点美食地址 1 羊肉泡馍 长白街348号有家 老陕家 面馆 郑和公园北面 肉加馍 2 蓝空饭店 三条巷那边 稻香鸭 红烧老鹅 韭香脆皮鸡 是很好的还有一个叫什么牛肉粒的也好吃昏的了 3 山西炸酱面馆 顺着流行青年广场旁的天桥走到马路对面
  • 【阅读笔记】联邦学习实战——构建公平的大数据交易市场

    联邦学习实战 构建公平的大数据交易市场 前言 1 大数据交易 1 1 数据交易定义 1 2 数据确权 1 3 数据定价 2 基于联邦学习构建新一代大数据交易市场 3 联邦学习激励机制助力数据交易 4 FedCoin支付系统设计 4 1 Po
  • stm32 SystemInit函数详解

    官方固件库中的对应函数为 void SystemInit void Reset the RCC clock configuration to the default reset state for debug purpose Set HSI
  • 终于明白协方差的意义了

    转自 https blog csdn net GoodShot article details 79940438 协方差其意义 度量各个维度偏离其均值的程度 协方差的值如果为正值 则说明两者是正相关的 从协方差可以引出 相关系数 的定义 结
  • 程序员必读书目推荐

    1 Effective Java Joschua 稍许过时 但没有替代java方面的书 2 Effectvie C Scott Meyer 3 More Effective C Scott Meyer的书是非常非常好书 每次读都感到汗颜 自
  • Vue 动态锚点

    这是封装的组件 判断容器的滚动 接收父组件传来的Tab参数
  • Qt Quick里的图形效果——混合(Blend)

    Blend 元素用指定的模式混合两个 Item 在我们使用 QPainter 绘图时 支持 Composition Modes Blend 干的事儿与此类似 使用 Blend 需要 import QtGraphicalEffects 1 0
  • IDEA导入MySQL的jdbc驱动出现“java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver”

    目录 一 一般的解决思路 1 JDBC下载链接 2 选择下载内容 并进行下载 3 将驱动导入java项目 二 依然导入驱动失败怎么办 当我们在idea中使用java操作mysql数据库时会出现 Exception in thread mai
  • 自动驾驶多边形iou计算Shapely库笔记

    参考 https cloud tencent com developer ask 42755 https blog csdn net u014421797 article details 89501572 https www itransl
  • MMDetection= Cuda10.0.130 + Pytorch1.4.0 + torchvision0.5.0 + mmcv-full1.1.6 + mmdet2.5.0

    1 版本选取 MMDetection的版本选择 安装的时候 需要选择合适的版本 下载不同版本的MMDetection 从 Github 的历史版本中选择合适的版本 https github com open mmlab mmdetectio
  • Python之线程编程(Thread)

    线程基本概念 1 什么是线程 1 线程被称为轻量级的进程 2 线程也可以使用计算机多核资源 是多任务编程方式 3 线程是系统分配内核的最小单元 4 线程可以理解为进程的分支任务 2 线程特征 1 一个进程中可以包含多个线程 2 线程也是一个
  • Untiy UDP局域网 异步发送图片

    同步画面有问题 传图片吧 using System Text using System Net Sockets using System Collections using System Collections Generic using