当前位置: 首页 > news >正文

C# WPF 读写CAN数据

C# WPF 读写CAN数据

CAN 分析仪

在这里插入图片描述

分析仪资料下载

官方地址:https://www.zhcxgd.com/1.html

CSDN:

项目配置

复制Dll库文件

文件在上面的资料里面

在这里插入图片描述

设置不安全代码

在这里插入图片描述

CAN C#工具类

CAN_Tool.cs

using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;namespace CAN_TEST.tool
{/*------------兼容ZLG的数据类型---------------------------------*///1.ZLGCAN系列接口卡信息的数据类型。//public struct VCI_BOARD_INFO //{ //    public UInt16 hw_Version;//    public UInt16 fw_Version;//    public UInt16 dr_Version;//    public UInt16 in_Version;//    public UInt16 irq_Num;//    public byte   can_Num;//    [MarshalAs(UnmanagedType.ByValArray, SizeConst=20)] public byte []str_Serial_Num;//    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)]//    public byte[] str_hw_Type;//    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]//    public byte[] Reserved;//}//以下为简易定义与调用方式,在项目属性->生成->勾选使用不安全代码即可unsafe public struct VCI_BOARD_INFO//使用不安全代码{public UInt16 hw_Version;public UInt16 fw_Version;public UInt16 dr_Version;public UInt16 in_Version;public UInt16 irq_Num;public byte can_Num;public fixed byte str_Serial_Num[20];public fixed byte str_hw_Type[40];public fixed byte Reserved[8];}///2.定义CAN信息帧的数据类型。unsafe public struct VCI_CAN_OBJ  //使用不安全代码{public uint ID;public uint TimeStamp;        //时间标识public byte TimeFlag;         //是否使用时间标识public byte SendType;         //发送标志。保留,未用public byte RemoteFlag;       //是否是远程帧public byte ExternFlag;       //是否是扩展帧public byte DataLen;          //数据长度public fixed byte Data[8];    //数据public fixed byte Reserved[3];//保留位}//3.定义初始化CAN的数据类型public struct VCI_INIT_CONFIG{public UInt32 AccCode;public UInt32 AccMask;public UInt32 Reserved;public byte Filter;   //0或1接收所有帧。2标准帧滤波,3是扩展帧滤波。public byte Timing0;  //波特率参数,具体配置,请查看二次开发库函数说明书。public byte Timing1;public byte Mode;     //模式,0表示正常模式,1表示只听模式,2自测模式}/*------------其他数据结构描述---------------------------------*///4.USB-CAN总线适配器板卡信息的数据类型1,该类型为VCI_FindUsbDevice函数的返回参数。public struct VCI_BOARD_INFO1{public UInt16 hw_Version;public UInt16 fw_Version;public UInt16 dr_Version;public UInt16 in_Version;public UInt16 irq_Num;public byte can_Num;public byte Reserved;[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] str_Serial_Num;[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]public byte[] str_hw_Type;[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]public byte[] str_Usb_Serial;}/*------------数据结构描述完成---------------------------------*/public struct CHGDESIPANDPORT{[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]public byte[] szpwd;[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]public byte[] szdesip;public Int32 desport;public void Init(){szpwd = new byte[10];szdesip = new byte[20];}}public class CAN_Tool{const int DEV_USBCAN = 3;const int DEV_USBCAN2 = 4;/// <summary>/// /// </summary>/// <param name="DeviceType"></param>/// <param name="DeviceInd"></param>/// <param name="Reserved"></param>/// <returns></returns>/*------------兼容ZLG的函数描述---------------------------------*//*------------兼容ZLG的函数描述---------------------------------*/[DllImport("controlcan.dll")]public static extern UInt32 VCI_OpenDevice(UInt32 DeviceType, UInt32 DeviceInd, UInt32 Reserved);[DllImport("controlcan.dll")]public static extern UInt32 VCI_CloseDevice(UInt32 DeviceType, UInt32 DeviceInd);[DllImport("controlcan.dll")]public static extern UInt32 VCI_InitCAN(UInt32 DeviceType, UInt32 DeviceInd, UInt32 CANInd, ref VCI_INIT_CONFIG pInitConfig);[DllImport("controlcan.dll")]public static extern UInt32 VCI_ReadBoardInfo(UInt32 DeviceType, UInt32 DeviceInd, ref VCI_BOARD_INFO pInfo);[DllImport("controlcan.dll")]public static extern UInt32 VCI_GetReceiveNum(UInt32 DeviceType, UInt32 DeviceInd, UInt32 CANInd);[DllImport("controlcan.dll")]public static extern UInt32 VCI_ClearBuffer(UInt32 DeviceType, UInt32 DeviceInd, UInt32 CANInd);[DllImport("controlcan.dll")]public static extern UInt32 VCI_StartCAN(UInt32 DeviceType, UInt32 DeviceInd, UInt32 CANInd);[DllImport("controlcan.dll")]public static extern UInt32 VCI_ResetCAN(UInt32 DeviceType, UInt32 DeviceInd, UInt32 CANInd);[DllImport("controlcan.dll")]public static extern UInt32 VCI_Transmit(UInt32 DeviceType, UInt32 DeviceInd, UInt32 CANInd, ref VCI_CAN_OBJ pSend, UInt32 Len);[DllImport("controlcan.dll")]public static extern UInt32 VCI_Receive(UInt32 DeviceType, UInt32 DeviceInd, UInt32 CANInd, ref VCI_CAN_OBJ pReceive, UInt32 Len, Int32 WaitTime);/*------------其他函数描述---------------------------------*/[DllImport("controlcan.dll")]public static extern UInt32 VCI_ConnectDevice(UInt32 DevType, UInt32 DevIndex);[DllImport("controlcan.dll")]public static extern UInt32 VCI_UsbDeviceReset(UInt32 DevType, UInt32 DevIndex, UInt32 Reserved);[DllImport("controlcan.dll")]public static extern UInt32 VCI_FindUsbDevice2(ref VCI_BOARD_INFO pInfo);/*------------函数描述结束---------------------------------*/static UInt32 m_bOpen = 0;static UInt32 m_devind = 0;static UInt32 m_canind = 0;static UInt32[] m_arrdevtype = new UInt32[20];static VCI_CAN_OBJ[] m_recobj = new VCI_CAN_OBJ[1000];static UInt32 m_devtype = 4;//USBCAN2//this.timer_rec = new System.Windows.Forms.Timer(this.components);public static void init(){m_arrdevtype[2] = 3;m_arrdevtype[3] = 4;}public static void close_CAN(){CAN_Tool.VCI_CloseDevice(m_devtype, m_devind);m_bOpen = 0;}public static void start_CAN(){if (m_bOpen == 0)return;CAN_Tool.VCI_StartCAN(m_devtype, m_devind, m_canind);}unsafe public static string can_send(string can_data_idText,string can_send_data){if (m_bOpen == 0){MessageBox.Show("CAN断开连接", "错误");return null;}VCI_CAN_OBJ sendobj = new VCI_CAN_OBJ();//sendobj.Init();sendobj.RemoteFlag = (byte)0;sendobj.ExternFlag = (byte)0;sendobj.ID = System.Convert.ToUInt32("0x" + can_data_idText, 16);int len = (can_send_data.Length + 1) / 3;sendobj.DataLen = System.Convert.ToByte(len);String strdata = can_send_data;//MessageBox.Show(strdata);int i = -1;if (i++ < len - 1)sendobj.Data[0] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);if (i++ < len - 1)sendobj.Data[1] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);if (i++ < len - 1)sendobj.Data[2] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);if (i++ < len - 1)sendobj.Data[3] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);if (i++ < len - 1)sendobj.Data[4] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);if (i++ < len - 1)sendobj.Data[5] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);if (i++ < len - 1)sendobj.Data[6] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);if (i++ < len - 1)sendobj.Data[7] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);if (CAN_Tool.VCI_Transmit(m_devtype, m_devind, m_canind, ref sendobj, 1) == 0){MessageBox.Show("发送失败", "错误");return null;}else{return "TX   帧ID:" + can_data_idText + " 数据:  " + can_send_data;}}public static string connect_CAN(int CAN_Type, int CAN_id,int RUN_mod){//以下两行为多卡同机测试代码,用来获取序列号与对应的设备索引号,单卡可以不使用。VCI_BOARD_INFO[] vbi2 = new VCI_BOARD_INFO[50];uint num1 = CAN_Tool.VCI_FindUsbDevice2(ref vbi2[0]);m_devtype = m_arrdevtype[CAN_Type + 2];m_devind = 0;m_canind = (UInt32)CAN_id;if (CAN_Tool.VCI_OpenDevice(m_devtype, m_devind, 0) == 0){MessageBox.Show("打开设备失败,请检查设备类型和设备索引号是否正确", "错误");m_bOpen = 0;return "";}m_bOpen = 1;VCI_INIT_CONFIG config = new VCI_INIT_CONFIG();config.AccCode = System.Convert.ToUInt32("0x" + "00000000", 16);config.AccMask = System.Convert.ToUInt32("0x" + "FFFFFFFF", 16);config.Timing0 = System.Convert.ToByte("0x" + "00", 16);config.Timing1 = System.Convert.ToByte("0x" + "1C", 16);config.Filter = (Byte)(0 + 1);config.Mode = (Byte)RUN_mod;CAN_Tool.VCI_InitCAN(m_devtype, m_devind, m_canind, ref config);return m_bOpen == 0 ? "断开" : "连接";}unsafe public static string TimerRecTick(){UInt32 res = new UInt32();res = CAN_Tool.VCI_Receive(m_devtype, m_devind, m_canind, ref m_recobj[0], 1000, 100);///IntPtr[] ptArray = new IntPtr[1];//ptArray[0] = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VCI_CAN_OBJ)) * 50);//IntPtr pt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)) * 1);//Marshal.Copy(ptArray, 0, pt, 1);//MessageBox.Show(res+"");//res = VCI_Receive(m_devtype, m_devind, m_canind, pt, 50/*50*/, 100);if (res == 0xFFFFFFFF) res = 0;//当设备未初始化时,返回0xFFFFFFFF,不进行列表显示。String str = "";for (UInt32 i = 0; i < res; i++){//VCI_CAN_OBJ obj = (VCI_CAN_OBJ)Marshal.PtrToStructure((IntPtr)((UInt32)pt + i * Marshal.SizeOf(typeof(VCI_CAN_OBJ))), typeof(VCI_CAN_OBJ));str = "RX: ";str += "  帧ID:0x" + System.Convert.ToString(m_recobj[i].ID, 16);str += "  帧格式:";if (m_recobj[i].RemoteFlag == 0)str += "数据帧 ";elsestr += "远程帧 ";if (m_recobj[i].ExternFlag == 0)str += "标准帧 ";elsestr += "扩展帧 ";//if (m_recobj[i].RemoteFlag == 0){str += "数据: ";byte len = (byte)(m_recobj[i].DataLen % 9);byte j = 0;fixed (VCI_CAN_OBJ* m_recobj1 = &m_recobj[i]){if (j++ < len)str += " " + System.Convert.ToString(m_recobj1->Data[0], 16);if (j++ < len)str += " " + System.Convert.ToString(m_recobj1->Data[1], 16);if (j++ < len)str += " " + System.Convert.ToString(m_recobj1->Data[2], 16);if (j++ < len)str += " " + System.Convert.ToString(m_recobj1->Data[3], 16);if (j++ < len)str += " " + System.Convert.ToString(m_recobj1->Data[4], 16);if (j++ < len)str += " " + System.Convert.ToString(m_recobj1->Data[5], 16);if (j++ < len)str += " " + System.Convert.ToString(m_recobj1->Data[6], 16);if (j++ < len)str += " " + System.Convert.ToString(m_recobj1->Data[7], 16);}}return str + "\n";}return null;}}
}

主界面

在这里插入图片描述

MainWindow.xaml

<Window x:Class="CAN_TEST.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"mc:Ignorable="d"Title="CAN测试" Height="600" Width="400"><Grid><StackPanel><StackPanel Orientation="Horizontal" Height="30" Margin="0,20,0,0"><Button Margin="10,0,0,0" Click="connect_CAN" Width="100">连接分析仪</Button><Button Margin="20,0,0,0" Click="close_CAN"  Width="100">断开分析仪</Button><Button Margin="20,0,0,0" Click="start_CAN"  Width="100">启动CAN</Button></StackPanel><StackPanel Orientation="Horizontal" Height="30" Margin="0,20,0,0"><StackPanel Orientation="Horizontal" Margin="20,0,0,0"><TextBlock>CAN类型</TextBlock><ComboBox HorizontalAlignment="Center" Width="100" Margin="20,0,0,0" x:Name="CAN_Type"><ComboBoxItem>USBCAN V1</ComboBoxItem><ComboBoxItem>USBCAN V2</ComboBoxItem></ComboBox></StackPanel><StackPanel Orientation="Horizontal" Margin="20,0,0,0"><TextBlock>CAN通道</TextBlock><ComboBox HorizontalAlignment="Center" Width="100" Margin="20,0,0,0"  x:Name="CAN_id"><ComboBoxItem>CAN1</ComboBoxItem><ComboBoxItem>CAN2</ComboBoxItem></ComboBox></StackPanel></StackPanel><StackPanel Orientation="Horizontal" Height="30" Margin="0,20,0,0"><StackPanel Orientation="Horizontal" Margin="20,0,0,0"><TextBlock>CAN运行模式</TextBlock><ComboBox HorizontalAlignment="Center" Width="100" Margin="20,0,0,0"  x:Name="RUN_mod"><ComboBoxItem>正常</ComboBoxItem><ComboBoxItem>只听</ComboBoxItem><ComboBoxItem>自测</ComboBoxItem></ComboBox></StackPanel><TextBlock Margin="20,0,0,0">连接状态:</TextBlock><TextBlock Text="断开" x:Name="CAN_statusText"></TextBlock></StackPanel><StackPanel Orientation="Horizontal"><StackPanel Orientation="Vertical"  Width="300"  Margin="0,10,0,0"><TextBlock TextAlignment="Center">数据发送</TextBlock><StackPanel Orientation="Horizontal" Margin="0,10,0,0"><TextBlock  TextAlignment="Center" Margin="20,0,0,0">帧ID:</TextBlock><TextBox Width="200" Margin="33,0,0,0"  x:Name="can_data_id" Text="00000123"></TextBox></StackPanel><StackPanel Orientation="Horizontal" Margin="0,10,0,0"><TextBlock  TextAlignment="Center" Margin="20,0,0,0">发送数据:</TextBlock><TextBox Width="200" Margin="10,0,0,0"  x:Name="can_send_data" Text="00 01 02 03 04 05 06 07 "></TextBox></StackPanel><Button Width="50"  Margin="0,10,0,0" Click="can_send">发送</Button></StackPanel></StackPanel><StackPanel Orientation="Horizontal"><TextBlock TextAlignment="Center">数据接收</TextBlock></StackPanel><StackPanel Orientation="Horizontal"><TextBox Width="350" Height="200" Margin="10,0,0,0" VerticalScrollBarVisibility="Visible" MaxLines="5" x:Name="resData" TextWrapping="Wrap"></TextBox></StackPanel></StackPanel></Grid>
</Window>

MainWindow.xaml.cs

using CAN_TEST.tool;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Configuration;
using System.Runtime.InteropServices;
using System.Text;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using static CAN_TEST.MainWindow;namespace HZFM_TEST
{/// <summary>/// Interaction logic for MainWindow.xaml/// </summary>public partial class MainWindow : Window{DispatcherTimer m_timer = new DispatcherTimer();public MainWindow(){InitializeComponent();// 初始化CANCAN_Tool.init();// 启动定时器m_timer.Interval = TimeSpan.FromSeconds(0.2);m_timer.Tick += new System.EventHandler(timer_rec_Tick);}private void close_CAN(object sender, RoutedEventArgs e){// 关闭CANCAN_Tool.close_CAN();}private void start_CAN(object sender, RoutedEventArgs e){// 启动CANCAN_Tool.start_CAN();}private void connect_CAN(object sender, RoutedEventArgs e){	// 连接CAN分析仪string outData = CAN_Tool.connect_CAN(CAN_Type.SelectedIndex,  CAN_id.SelectedIndex, RUN_mod.SelectedIndex);if(outData.Length > 0){m_timer.Start();}CAN_statusText.Text = outData;}// 定时收数据任务unsafe private void timer_rec_Tick(object sender, EventArgs e){string res = CAN_Tool.TimerRecTick();if(res != null){resData.AppendText(res + "\r\n");}}// 发送惨数据unsafe private void can_send(object sender, RoutedEventArgs e){string res = CAN_Tool.can_send(can_data_id.Text, can_send_data.Text);if (res != null){resData.AppendText(res + "\r\n");}}// 读取数据private void read_Data(object sender, RoutedEventArgs e){Button btn = sender as Button;int id = int.Parse(btn.CommandParameter.ToString()) + 1;string res = CAN_Tool.can_send("01800300", can_send_data.Text);if (res != null){resData.AppendText(res + "\r\n");}}}
}

相关文章:

C# WPF 读写CAN数据

C# WPF 读写CAN数据 CAN 分析仪 分析仪资料下载 官方地址&#xff1a;https://www.zhcxgd.com/1.html CSDN&#xff1a; 项目配置 复制Dll库文件 文件在上面的资料里面 设置不安全代码 CAN C#工具类 CAN_Tool.cs using Microsoft.VisualBasic; using System; using Sys…...

力扣2517.礼盒的最大甜蜜度

力扣2517.礼盒的最大甜蜜度 二分答案求最小值 排完序判断是否有k个差距至少为mid的元素别用i遍历 可能会越界 用 : 有多少取多少 class Solution {public:int maximumTastiness(vector<int>& price, int k) {ranges::sort(price);auto check [&](int mid) -&…...

多模块存储器

随着计算机技术的发展&#xff0c;处理的信息量越来越多&#xff0c;对存储器的速度和容量要求也越来越高&#xff1b;而且随着CPU性能的不断提高、IO设备数量不断增加&#xff0c;导致主存的存取速度已经称为了整个计算机系统的性能瓶颈。这就要求我们必须提高主存的访问速度。…...

Windows反截屏开发实现

文章目录 Windows反截屏开发实现1. SetWindowDisplayAffinity2. 反截屏系统3. 总结 Windows反截屏开发实现 最近在我们云桌面中需要做到反截屏能力&#xff0c;所谓反截屏就是我们无法通过截图软件&#xff08;微信&#xff0c;QQ&#xff0c;截图等程序&#xff09;截取桌面的…...

Android.mk的用法

前言 Android.mk 文件是 Android 编译系统中用于描述项目源文件、库和模块的 Makefile。它采用 GNU Make 的语法,但也包含了一些特定于 Android 编译系统的规则和变量。以下是对其语法和使用方法的详细解释及示例。 一:模块种类 一个Android.mk file用来向编译系统描述你的源…...

android studio CreateProcess error=2, 系统找不到指定的文件

【问题记录篇】 在AndroidStudio编译开发jni相关工程代码的时候&#xff0c;编译遇到的这个报错&#xff1a; CreateProcess error2, 系统找不到指定的文件。排查处理步骤: 先查看Build Output的具体日志输出 2.了解到问题出在了NDK配置上&#xff0c;此时需要根据自己的gra…...

jQuery如何把单选框设置为选中状态

在网页开发中&#xff0c;我们经常需要使用表单元素来收集用户数据。其中&#xff0c;单选框&#xff08;radio button&#xff09;是一种常见的表单元素&#xff0c;用于从一组选项中选择一个。使用jQuery&#xff0c;我们可以轻松地控制这些单选框的状态&#xff0c;包括将它…...

Mware Fusion Pro 13 mac版:一键掌控虚拟世界

VMware Fusion Pro 13是一款功能卓越的虚拟化软件&#xff0c;专为Mac操作系统量身打造。这款软件为用户提供了一个一站式的虚拟化解决方案&#xff0c;能够满足各种多样化的需求。 VMware Fusion Pro 13 Mac获取 VMware Fusion Pro 13的强大之处在于其采用了最 先进的虚拟化…...

PTA - 函数的定义与调用

编写一个名为collatz()的函数,它有一个名为number的参数&#xff1a; 如果number是偶数,那么collatz()就打印number加上2如果number是奇数,那么collatz()就打印number乘以2 函数接口定义&#xff1a; def collatz(number)裁判测试程序样例&#xff1a; /* 请在这里填写答案…...

Solr7.4.0报错org.apache.solr.common.SolrException

文章目录 org.apache.solr.common.SolrException: Exception writing document id MATERIAL-99598435990497269125316 to the index; possible analysis error: cannot change DocValues type from NUMERIC to SORTED_NUMERIC for field "opt_time"Exception writing…...

从2-3-4树开始理解红黑二叉树(JAVA代码手撸版)

经典的红黑二叉树在新增/删除数据时维持自平衡始终对应着一个2-3-4 树。本文只关注2-3-4 对应的经典红黑二叉树。 暂时不考虑 2-3 树对应的左倾红黑二叉树。 背景知识 2-3-4 树简介 一棵 2-3-4 树的结点分为 内部结点 (internal nodes) 和 叶子结点 (leaf nodes) &#xff0c;…...

模板类与继承

1模板类继承普通类&#xff08;常见&#xff09; #include<iostream> using namespace std; class AA { public:int m_a;AA(int a) :m_a(a) { cout << "调用了AA的构造函数\n"; }void func1() { cout << "调用func1&#xff08;&#xff09;…...

随手记:uniapp图片展示,剩余的堆叠

UI效果图&#xff1a; 实现思路&#xff1a; 循环图片数组&#xff0c;只展示几张宽度就为几张图片边距的宽度&#xff0c;剩下的图片直接堆叠展示 点击预览的时候传入当前的下标&#xff0c;如果是点击堆叠的话&#xff0c;下标从堆叠数量开始计算 <template><…...

微服务迁移、重构最佳经验

1. 了解现有的单体应用: - 应用架构和技术栈 要了解现有的应用架构和技术栈&#xff0c;可以采取以下几个步骤&#xff1a; 1. 了解应用的背景和目标&#xff1a;首先要了解应用的背景和目标&#xff0c;包括应用所属的行业、应用的类型&#xff08;例如Web应用、移动应用等…...

【Python】从0开始的Django基础

Django框架基础 unit01一、Django基础1.1 什么是Django?1.2 安装与卸载1.2.1 Python与Django的版本1.2.2 安装1.2.3 查看Django版本1.2.4 卸载 二、Django项目2.1 概述2.2 创建项目2.3 启动项目2.4 项目的目录结构2.5 配置 三、URL 调度器3.2 定义URL路由3.2 定义首页的路由3.…...

红黑树(数据结构篇)

数据结构之红黑树 红黑树(RB-tree) 概念&#xff1a; 红黑树是AVL树的变种&#xff0c;它是每一个节点或者着成红色&#xff0c;或者着成黑色的一棵二叉查找树。对红黑树的操作在最坏情形下花费O(logN)时间&#xff0c;它的插入操作使用的是非递归形式实现红黑树的高度最多是…...

高级视频编码器性能对比(H265、VP9、AV1)

1、背景介绍 目前在视频编解码器中&#xff0c;H264已经成为绝对的主流&#xff0c;被大部分设备、浏览器所支持。虽然有更先进的编码器推出&#xff0c;但是受限于推广速度和设备支持成本&#xff0c;一直未能成为主流。 今年公司目标是持续降本增效&#xff0c;现在将”屠刀…...

示例:WPF中DataGrid简单设置合并列头

一、目的&#xff1a;应用DataGridTemplateColumn列模板&#xff0c;去拆分列头和单元格布局的方式设置列头合并样式 二、实现 效果如下 三、环境 VS2022 四、示例 应用DataGridTemplateColumn自定义列头信息和单元格信息 <DataGrid AutoGenerateColumns"False"…...

Matlab图像处理——细胞图像的分割和计数显示

一. 项目介绍 使用MATLAB编写的细胞图像分割及计数系统&#xff0c;实现了对图像内细胞的计数&#xff0c;以及对每个细胞周长和面积的测量&#xff0c;并分别展示了分割后的每个细胞的图像。实验步骤共分为图像预处理、图像预分割、空洞填充、黏连细胞分割、细胞个数统计、细胞…...

六爻排盘神机

选修课留了3000字的论文......确实&#xff0c;削微有那么一点小困难…… 但是&#xff0c;倘若我拿出已经占了6419个字符的 “六爻排盘神机” &#xff0c;阁下…应该…不会…骂我吧 且看&#xff0c;六爻排盘神机&#xff01; import random import datetime from lunarcale…...

【ARMv8/v9 GIC 系列 2.1 -- GIC SPI 中断的 pending 和 clear pending 配置】

文章目录 GIC Pending 和 Clear PendingGICD_ISPENDR<n>GICD_ICPENDR<n>参数<n>编号解释使用举例设置中断ID 100为挂起状态清除中断ID 100的挂起状态 代码实现小结 GIC Pending 和 Clear Pending 在ARMv8体系结构中&#xff0c;GICD_ISPENDR<n> 和 GI…...

SpringBoot集成logback初始化源码解析(部分)

一.SpringBoot配置扩展点 SpringBoot日志模块使用监听的方式进行初始化&#xff0c;在SpringBoot项目启动后&#xff0c;会通知日志监听器 在日志监听器中ApplicationStartingEvent事件用来确定到底使用哪个日志系统&#xff0c;logback log4j等 在日志监听器中ApplicationEn…...

【Linux工具】yum软件包管理器与Vim编辑器的高效运用

目录 Linux 软件包管理器 YUM 什么是软件包 安装工具 rzsz 及注意事项 查看软件包 安装和卸载软件 安装软件 卸载软件 Linux 开发工具 编辑器 - Vim 使用 ​编辑 Vim 与 Vi 的区别 Vim 的基本概念 三种模式 Vim 的基本操作 操作尝试&#xff1a; Vim 命令集解释…...

Matlab数学建模实战应用:案例4 - 图像处理

目录 前言 一、图像处理基础 二、Matlab图像处理工具箱 三、案例&#xff1a;图像锐化、去噪和分割 步骤 1&#xff1a;读取和显示图像 步骤 2&#xff1a;图像锐化 步骤 3&#xff1a;图像去噪 步骤 4&#xff1a;图像分割 完整代码示例 四、实际应用 实例总结 总…...

Studying-代码随想录训练营day15| 222.完全二叉树的节点个数、110.平衡二叉树、257.二叉树的所有路径、404.左叶子之和

第十五天&#xff0c;二叉树part03&#x1f4aa;&#xff0c;编程语言&#xff1a;C 目录 257.完全二叉树的节点个数 110.平衡二叉树 257.二叉树的所有路径 404.左叶子之和 总结 257.完全二叉树的节点个数 文档讲解&#xff1a;代码随想录完全二叉树的节点个数 视频讲解…...

Python 基础:异常

目录 一、异常概念二、处理异常2.1 抛出异常2.2 使用 try-except 代码块2.3 使用 try-except-else 代码块2.4 静默失败 三、总结 遇到看不明白的地方&#xff0c;欢迎在评论中留言呐&#xff0c;一起讨论&#xff0c;一起进步&#xff01; 本文参考&#xff1a;《Python编程&a…...

XML 应用程序

XML 应用程序 XML&#xff08;可扩展标记语言&#xff09;是一种用于存储和传输数据的标记语言。它是一种自我描述的语言&#xff0c;允许用户定义自己的标签和文档结构。XML广泛应用于各种应用程序中&#xff0c;包括网站开发、数据交换、文档管理等。本文将探讨XML的一些主要…...

SprringCloud Gateway动态添加路由不重启

文章目录 前言&#xff1a;一、动态路由必要性二、SpringCloud Gateway路由加载过程RouteDefinitionLocator接口PropertiesRouteDefinitionLocator类DiscoveryClientRouteDefinitionLocatorInMemoryRouteDefinitionRepositoryCompositeRouteDefinitionLocator类CachingRouteDef…...

Windows安装mysql

首先去官网下载社区版本的mysql&#xff08;如果连不上&#xff0c;挂梯子&#xff09; https://www.mysql.com/downloads/ 2. 去配置环境变量path 3. 在cmd里面初始化数据库&#xff08;在搜索框输入cmd&#xff0c;或者在资源管理器下搜索烂输入cmd回车就行&#xff09; my…...

chatgpt: linux 下用纯c 编写ui

在Linux下用纯C语言编写用户界面&#xff08;UI&#xff09;&#xff0c;通常会使用GTK或Xlib。GTK是一个更高级的库&#xff0c;提供了丰富的控件和功能&#xff0c;而Xlib则是一个更底层的库&#xff0c;提供了直接操作X Window系统的功能。 下面是一个使用GTK在Linux上创建…...

自己做婚恋网站/小程序推广的十种方式

1 链表 列表 链表不是列表。我们所谈的列表更倾向于是针对对象而言的。 或许应该说列表是链表的扩展。他们的物理存储结构都不是连续的&#xff0c;而是依赖于节点指针指向的。所以链表里面的很多算法拿到列表对象上来说&#xff0c;都差不多。 2 向量 列表 向量在物理存储上地…...

中文网站开发软件/网站怎么优化推广

一、为什么需要使用filterRules在使用富文本编辑器ueditor的时候&#xff0c;有时候需要控制内容&#xff0c;例如&#xff1a;不允许带链接、不允许插入图片、控制内部html的样式等等&#xff0c;除了设置toolbars之外&#xff0c;还要保证粘贴到编辑器里面的内容也能被控制&a…...

怎样手机网站建设/搜索热词排行榜

最近学习es&#xff0c;先是在图书馆借了几本书&#xff0c;但是发现与es现在的版本相差太远了&#xff0c;所以就选择直接在网上看The Definitive Guide&#xff0c;感觉这本书讲得倒还挺好&#xff0c;不过在看到这个地方的时候&#xff0c;按照书上的代码总是出现错误&#…...

做计算机版权需要网站源代码/百度投放广告平台

大数据平台架构 大数据技术已经被应用到各行各业&#xff0c;涉及人们生活的方方面面。大数据技术大大提高了数据存储和计算能力&#xff0c;从而为企业快速决策提供了数据支撑&#xff0c;能够助力企业改进业务流程、控制成本、提高产品质量&#xff0c;应用大数据技术为企业…...

日照在线网站建设/什么时候友情链接

一、安装selenium 前提是已安装Python&#xff0c;python安装 自行百度&#xff0c;这里不概述 安装好python后&#xff0c;cmd打开终端窗口--》pip命令安装 &#xff1a;pip install selenium二、安装chromedriver 首先&#xff0c;查看自己的chrome版本Chrome与Chromedriver版…...

wordpress背景调用/做关键词排名好的公司

世界正变得越来越数字化&#xff0c;大数据正在以这种或那种方式影响着每个人的生活。 我们在日常生活中所做的一切都会留下数字痕迹&#xff08;或者数据&#xff09;&#xff0c;也就是大数据&#xff0c;我们可以利用和分析这些数据来让我们的生活更加美好。下面让我们看看大…...