C# OpenCvSharp DNN 部署yolov5不规则四边形目标检测

本文主要是介绍C# OpenCvSharp DNN 部署yolov5不规则四边形目标检测,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

效果

模型信息

项目

代码

下载


C# OpenCvSharp DNN 部署yolov5不规则四边形目标检测

效果

模型信息

Inputs
-------------------------
name:images
tensor:Float[1, 3, 1024, 1024]
---------------------------------------------------------------

Outputs
-------------------------
name:output
tensor:Float[1, 64512, 11]
---------------------------------------------------------------

项目

代码

using OpenCvSharp;
using OpenCvSharp.Dnn;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Windows.Forms;

namespace OpenCvSharp_DNN_Demo
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        string image_path = "";

        DateTime dt1 = DateTime.Now;
        DateTime dt2 = DateTime.Now;

        float confThreshold;
        float nmsThreshold;
        float objThreshold;

        float[,] anchors = new float[3, 6] {
                                           {31, 30, 28, 49, 50, 31},
                                           {46, 45, 58, 58, 74, 74},
                                           {94, 94, 115, 115, 151, 151}
                                           };

        float[] stride = new float[3] { 8.0f, 16.0f, 32.0f };

        string modelpath;

        int inpHeight;
        int inpWidth;

        List<string> class_names;
        int num_class;

        Net opencv_net;
        Mat BN_image;

        Mat image;
        Mat result_image;

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = fileFilter;
            if (ofd.ShowDialog() != DialogResult.OK) return;

            pictureBox1.Image = null;
            pictureBox2.Image = null;
            textBox1.Text = "";

            image_path = ofd.FileName;
            pictureBox1.Image = new Bitmap(image_path);
            image = new Mat(image_path);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            confThreshold = 0.5f;
            nmsThreshold = 0.5f;
            objThreshold = 0.5f;

            modelpath = "model/best.onnx";

            inpHeight = 1024;
            inpWidth = 1024;

            opencv_net = CvDnn.ReadNetFromOnnx(modelpath);

            class_names = new List<string>();
            StreamReader sr = new StreamReader("model/coco.names");
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                class_names.Add(line);
            }
            num_class = class_names.Count();

            image_path = "test_img/1.png";
            pictureBox1.Image = new Bitmap(image_path);

        }

        float sigmoid(float x)
        {
            return (float)(1.0 / (1 + Math.Exp(-x)));
        }

        Mat ResizeImage(Mat srcimg, out int newh, out int neww, out int top, out int left)
        {
            int srch = srcimg.Rows, srcw = srcimg.Cols;
            top = 0;
            left = 0;
            newh = inpHeight;
            neww = inpWidth;
            Mat dstimg = new Mat();
            if (srch != srcw)
            {
                float hw_scale = (float)srch / srcw;
                if (hw_scale > 1)
                {
                    newh = inpHeight;
                    neww = (int)(inpWidth / hw_scale);
                    Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh), 0, 0, InterpolationFlags.Area);
                    left = (int)((inpWidth - neww) * 0.5);
                    Cv2.CopyMakeBorder(dstimg, dstimg, 0, 0, left, inpWidth - neww - left, BorderTypes.Constant);
                }
                else
                {
                    newh = (int)(inpHeight * hw_scale);
                    neww = inpWidth;
                    Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh), 0, 0, InterpolationFlags.Area);
                    top = (int)((inpHeight - newh) * 0.5);
                    Cv2.CopyMakeBorder(dstimg, dstimg, top, inpHeight - newh - top, 0, 0, BorderTypes.Constant);
                }
            }
            else
            {
                Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh));
            }
            return dstimg;
        }

        float IoU(BoxInfo polya, BoxInfo polyb, int max_w, int max_h)
        {
            List<List<OpenCvSharp.Point>> poly_array0 = new List<List<OpenCvSharp.Point>>();
            List<List<OpenCvSharp.Point>> poly_array1 = new List<List<OpenCvSharp.Point>>();
            poly_array0.Add(polya.pts);
            poly_array1.Add(polyb.pts);

            Mat _poly0 = Mat.Zeros(max_h, max_w, MatType.CV_8UC1);
            Mat _poly1 = Mat.Zeros(max_h, max_w, MatType.CV_8UC1);
            Mat _result = new Mat();

            List<List<OpenCvSharp.Point>> _pts0 = new List<List<OpenCvSharp.Point>>();
            List<int> _npts0 = new List<int>();

            foreach (var item in poly_array0)
            {
                if (item.Count < 3)//invalid poly
                    return -1f;

                _pts0.Add(item);
                _npts0.Add(item.Count);

            }

            List<List<OpenCvSharp.Point>> _pts1 = new List<List<OpenCvSharp.Point>>();
            List<int> _npts1 = new List<int>();

            foreach (var item in poly_array1)
            {
                if (item.Count < 3)//invalid poly
                    return -1f;

                _pts1.Add(item);
                _npts1.Add(item.Count);

            }

            Cv2.FillPoly(_poly0, _pts0, new Scalar(1));
            Cv2.FillPoly(_poly1, _pts1, new Scalar(1));

            Cv2.BitwiseAnd(_poly0, _poly1, _result);

            int _area0 = Cv2.CountNonZero(_poly0);
            int _area1 = Cv2.CountNonZero(_poly1);
            int _intersection_area = Cv2.CountNonZero(_result);
            float _iou = (float)_intersection_area / (float)(_area0 + _area1 - _intersection_area);
            return _iou;
        }

        void nms(List<BoxInfo> input_boxes, int max_w, int max_h)
        {
            input_boxes.Sort((a, b) => { return a.score > b.score ? -1 : 1; });

            bool[] isSuppressed = new bool[input_boxes.Count];

            for (int i = 0; i < input_boxes.Count(); ++i)
            {
                if (isSuppressed[i]) { continue; }
                for (int j = i + 1; j < input_boxes.Count(); ++j)
                {
                    if (isSuppressed[j]) { continue; }
                    float ovr = IoU(input_boxes[i], input_boxes[j], max_w, max_h);
                    if (ovr >= nmsThreshold)
                    {
                        isSuppressed[j] = true;
                    }
                }
            }

            for (int i = isSuppressed.Length - 1; i >= 0; i--)
            {
                if (isSuppressed[i])
                {
                    input_boxes.RemoveAt(i);
                }
            }

        }

        private unsafe void button2_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }
            textBox1.Text = "检测中,请稍等……";
            pictureBox2.Image = null;
            Application.DoEvents();

            image = new Mat(image_path);

            int newh = 0, neww = 0, padh = 0, padw = 0;
            Mat dstimg = ResizeImage(image, out newh, out neww, out padh, out padw);

            BN_image = CvDnn.BlobFromImage(dstimg, 1 / 255.0, new OpenCvSharp.Size(inpWidth, inpHeight), new Scalar(0, 0, 0), true, false);

            //配置图片输入数据
            opencv_net.SetInput(BN_image);

            //模型推理,读取推理结果
            Mat[] outs = new Mat[3] { new Mat(), new Mat(), new Mat() };
            string[] outBlobNames = opencv_net.GetUnconnectedOutLayersNames().ToArray();

            dt1 = DateTime.Now;

            opencv_net.Forward(outs, outBlobNames);

            dt2 = DateTime.Now;

            int num_proposal = outs[0].Size(1);
            int nout = outs[0].Size(2);

            if (outs[0].Dims > 2)
            {
                outs[0] = outs[0].Reshape(0, num_proposal);
            }

            float ratioh = 1.0f * image.Rows / newh, ratiow = 1.0f * image.Cols / neww;

            float* pdata = (float*)outs[0].Data;

            List<BoxInfo> generate_boxes = new List<BoxInfo>();

            int row_ind = 0;

            for (int n = 0; n < 3; n++)
            {

                int num_grid_x = (int)(inpWidth / stride[n]);
                int num_grid_y = (int)(inpHeight / stride[n]);

                for (int q = 0; q < 3; q++)    //anchor
                {
                    float anchor_w = anchors[n, q * 2];
                    float anchor_h = anchors[n, q * 2 + 1];
                    for (int i = 0; i < num_grid_y; i++)
                    {
                        for (int j = 0; j < num_grid_x; j++)
                        {
                            float box_score = sigmoid(pdata[8]);
                            if (box_score > objThreshold)
                            {

                                Mat scores = outs[0].Row(row_ind).ColRange(9, 9 + num_class);
                                double minVal, max_class_socre;
                                OpenCvSharp.Point minLoc, classIdPoint;
                                // Get the value and location of the maximum score
                                Cv2.MinMaxLoc(scores, out minVal, out max_class_socre, out minLoc, out classIdPoint);

                                int class_idx = classIdPoint.X;
                                max_class_socre = sigmoid((float)max_class_socre) * box_score;
                                if (max_class_socre > confThreshold)
                                {
                                    List<OpenCvSharp.Point> pts = new List<OpenCvSharp.Point>();
                                    for (int k = 0; k < 8; k += 2)
                                    {
                                        float x = (pdata[k] + j) * stride[n];  //x
                                        float y = (pdata[k + 1] + i) * stride[n];   //y
                                        x = (x - padw) * ratiow;
                                        y = (y - padh) * ratioh;
                                        pts.Add(new OpenCvSharp.Point(x, y));
                                    }

                                    Rect r = Cv2.BoundingRect(pts);

                                    generate_boxes.Add(new BoxInfo(pts, (float)max_class_socre, class_idx));
                                }
                            }
                            row_ind++;
                            pdata += nout;
                        }
                    }

                }

            }

            nms(generate_boxes, image.Cols, image.Rows);

            result_image = image.Clone();

            for (int ii = 0; ii < generate_boxes.Count; ++ii)
            {
                int idx = generate_boxes[ii].label;

                for (int jj = 0; jj < 4; jj++)
                {
                    Cv2.Line(result_image, generate_boxes[ii].pts[jj], generate_boxes[ii].pts[(jj + 1) % 4], new Scalar(0, 0, 255), 2);
                }

                string label = class_names[idx] + ":" + generate_boxes[ii].score.ToString("0.00");

                int xmin = (int)generate_boxes[ii].pts[0].X;
                int ymin = (int)generate_boxes[ii].pts[0].Y - 10;

                Cv2.PutText(result_image, label, new OpenCvSharp.Point(xmin, ymin - 5), HersheyFonts.HersheySimplex, 0.75, new Scalar(0, 0, 255), 1);
            }

            pictureBox2.Image = new Bitmap(result_image.ToMemoryStream());
            textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";
        }

        private void pictureBox2_DoubleClick(object sender, EventArgs e)
        {
            Common.ShowNormalImg(pictureBox2.Image);
        }

        private void pictureBox1_DoubleClick(object sender, EventArgs e)
        {
            Common.ShowNormalImg(pictureBox1.Image);
        }
    }
}

using OpenCvSharp;
using OpenCvSharp.Dnn;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Windows.Forms;namespace OpenCvSharp_DNN_Demo
{public partial class frmMain : Form{public frmMain(){InitializeComponent();}string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";string image_path = "";DateTime dt1 = DateTime.Now;DateTime dt2 = DateTime.Now;float confThreshold;float nmsThreshold;float objThreshold;float[,] anchors = new float[3, 6] {{31, 30, 28, 49, 50, 31},{46, 45, 58, 58, 74, 74},{94, 94, 115, 115, 151, 151}};float[] stride = new float[3] { 8.0f, 16.0f, 32.0f };string modelpath;int inpHeight;int inpWidth;List<string> class_names;int num_class;Net opencv_net;Mat BN_image;Mat image;Mat result_image;private void button1_Click(object sender, EventArgs e){OpenFileDialog ofd = new OpenFileDialog();ofd.Filter = fileFilter;if (ofd.ShowDialog() != DialogResult.OK) return;pictureBox1.Image = null;pictureBox2.Image = null;textBox1.Text = "";image_path = ofd.FileName;pictureBox1.Image = new Bitmap(image_path);image = new Mat(image_path);}private void Form1_Load(object sender, EventArgs e){confThreshold = 0.5f;nmsThreshold = 0.5f;objThreshold = 0.5f;modelpath = "model/best.onnx";inpHeight = 1024;inpWidth = 1024;opencv_net = CvDnn.ReadNetFromOnnx(modelpath);class_names = new List<string>();StreamReader sr = new StreamReader("model/coco.names");string line;while ((line = sr.ReadLine()) != null){class_names.Add(line);}num_class = class_names.Count();image_path = "test_img/1.png";pictureBox1.Image = new Bitmap(image_path);}float sigmoid(float x){return (float)(1.0 / (1 + Math.Exp(-x)));}Mat ResizeImage(Mat srcimg, out int newh, out int neww, out int top, out int left){int srch = srcimg.Rows, srcw = srcimg.Cols;top = 0;left = 0;newh = inpHeight;neww = inpWidth;Mat dstimg = new Mat();if (srch != srcw){float hw_scale = (float)srch / srcw;if (hw_scale > 1){newh = inpHeight;neww = (int)(inpWidth / hw_scale);Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh), 0, 0, InterpolationFlags.Area);left = (int)((inpWidth - neww) * 0.5);Cv2.CopyMakeBorder(dstimg, dstimg, 0, 0, left, inpWidth - neww - left, BorderTypes.Constant);}else{newh = (int)(inpHeight * hw_scale);neww = inpWidth;Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh), 0, 0, InterpolationFlags.Area);top = (int)((inpHeight - newh) * 0.5);Cv2.CopyMakeBorder(dstimg, dstimg, top, inpHeight - newh - top, 0, 0, BorderTypes.Constant);}}else{Cv2.Resize(srcimg, dstimg, new OpenCvSharp.Size(neww, newh));}return dstimg;}float IoU(BoxInfo polya, BoxInfo polyb, int max_w, int max_h){List<List<OpenCvSharp.Point>> poly_array0 = new List<List<OpenCvSharp.Point>>();List<List<OpenCvSharp.Point>> poly_array1 = new List<List<OpenCvSharp.Point>>();poly_array0.Add(polya.pts);poly_array1.Add(polyb.pts);Mat _poly0 = Mat.Zeros(max_h, max_w, MatType.CV_8UC1);Mat _poly1 = Mat.Zeros(max_h, max_w, MatType.CV_8UC1);Mat _result = new Mat();List<List<OpenCvSharp.Point>> _pts0 = new List<List<OpenCvSharp.Point>>();List<int> _npts0 = new List<int>();foreach (var item in poly_array0){if (item.Count < 3)//invalid polyreturn -1f;_pts0.Add(item);_npts0.Add(item.Count);}List<List<OpenCvSharp.Point>> _pts1 = new List<List<OpenCvSharp.Point>>();List<int> _npts1 = new List<int>();foreach (var item in poly_array1){if (item.Count < 3)//invalid polyreturn -1f;_pts1.Add(item);_npts1.Add(item.Count);}Cv2.FillPoly(_poly0, _pts0, new Scalar(1));Cv2.FillPoly(_poly1, _pts1, new Scalar(1));Cv2.BitwiseAnd(_poly0, _poly1, _result);int _area0 = Cv2.CountNonZero(_poly0);int _area1 = Cv2.CountNonZero(_poly1);int _intersection_area = Cv2.CountNonZero(_result);float _iou = (float)_intersection_area / (float)(_area0 + _area1 - _intersection_area);return _iou;}void nms(List<BoxInfo> input_boxes, int max_w, int max_h){input_boxes.Sort((a, b) => { return a.score > b.score ? -1 : 1; });bool[] isSuppressed = new bool[input_boxes.Count];for (int i = 0; i < input_boxes.Count(); ++i){if (isSuppressed[i]) { continue; }for (int j = i + 1; j < input_boxes.Count(); ++j){if (isSuppressed[j]) { continue; }float ovr = IoU(input_boxes[i], input_boxes[j], max_w, max_h);if (ovr >= nmsThreshold){isSuppressed[j] = true;}}}for (int i = isSuppressed.Length - 1; i >= 0; i--){if (isSuppressed[i]){input_boxes.RemoveAt(i);}}}private unsafe void button2_Click(object sender, EventArgs e){if (image_path == ""){return;}textBox1.Text = "检测中,请稍等……";pictureBox2.Image = null;Application.DoEvents();image = new Mat(image_path);int newh = 0, neww = 0, padh = 0, padw = 0;Mat dstimg = ResizeImage(image, out newh, out neww, out padh, out padw);BN_image = CvDnn.BlobFromImage(dstimg, 1 / 255.0, new OpenCvSharp.Size(inpWidth, inpHeight), new Scalar(0, 0, 0), true, false);//配置图片输入数据opencv_net.SetInput(BN_image);//模型推理,读取推理结果Mat[] outs = new Mat[3] { new Mat(), new Mat(), new Mat() };string[] outBlobNames = opencv_net.GetUnconnectedOutLayersNames().ToArray();dt1 = DateTime.Now;opencv_net.Forward(outs, outBlobNames);dt2 = DateTime.Now;int num_proposal = outs[0].Size(1);int nout = outs[0].Size(2);if (outs[0].Dims > 2){outs[0] = outs[0].Reshape(0, num_proposal);}float ratioh = 1.0f * image.Rows / newh, ratiow = 1.0f * image.Cols / neww;float* pdata = (float*)outs[0].Data;List<BoxInfo> generate_boxes = new List<BoxInfo>();int row_ind = 0;for (int n = 0; n < 3; n++){int num_grid_x = (int)(inpWidth / stride[n]);int num_grid_y = (int)(inpHeight / stride[n]);for (int q = 0; q < 3; q++)    //anchor{float anchor_w = anchors[n, q * 2];float anchor_h = anchors[n, q * 2 + 1];for (int i = 0; i < num_grid_y; i++){for (int j = 0; j < num_grid_x; j++){float box_score = sigmoid(pdata[8]);if (box_score > objThreshold){Mat scores = outs[0].Row(row_ind).ColRange(9, 9 + num_class);double minVal, max_class_socre;OpenCvSharp.Point minLoc, classIdPoint;// Get the value and location of the maximum scoreCv2.MinMaxLoc(scores, out minVal, out max_class_socre, out minLoc, out classIdPoint);int class_idx = classIdPoint.X;max_class_socre = sigmoid((float)max_class_socre) * box_score;if (max_class_socre > confThreshold){List<OpenCvSharp.Point> pts = new List<OpenCvSharp.Point>();for (int k = 0; k < 8; k += 2){float x = (pdata[k] + j) * stride[n];  //xfloat y = (pdata[k + 1] + i) * stride[n];   //yx = (x - padw) * ratiow;y = (y - padh) * ratioh;pts.Add(new OpenCvSharp.Point(x, y));}Rect r = Cv2.BoundingRect(pts);generate_boxes.Add(new BoxInfo(pts, (float)max_class_socre, class_idx));}}row_ind++;pdata += nout;}}}}nms(generate_boxes, image.Cols, image.Rows);result_image = image.Clone();for (int ii = 0; ii < generate_boxes.Count; ++ii){int idx = generate_boxes[ii].label;for (int jj = 0; jj < 4; jj++){Cv2.Line(result_image, generate_boxes[ii].pts[jj], generate_boxes[ii].pts[(jj + 1) % 4], new Scalar(0, 0, 255), 2);}string label = class_names[idx] + ":" + generate_boxes[ii].score.ToString("0.00");int xmin = (int)generate_boxes[ii].pts[0].X;int ymin = (int)generate_boxes[ii].pts[0].Y - 10;Cv2.PutText(result_image, label, new OpenCvSharp.Point(xmin, ymin - 5), HersheyFonts.HersheySimplex, 0.75, new Scalar(0, 0, 255), 1);}pictureBox2.Image = new Bitmap(result_image.ToMemoryStream());textBox1.Text = "推理耗时:" + (dt2 - dt1).TotalMilliseconds + "ms";}private void pictureBox2_DoubleClick(object sender, EventArgs e){Common.ShowNormalImg(pictureBox2.Image);}private void pictureBox1_DoubleClick(object sender, EventArgs e){Common.ShowNormalImg(pictureBox1.Image);}}
}

下载

源码下载

这篇关于C# OpenCvSharp DNN 部署yolov5不规则四边形目标检测的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/488871

相关文章

Nginx分布式部署流程分析

《Nginx分布式部署流程分析》文章介绍Nginx在分布式部署中的反向代理和负载均衡作用,用于分发请求、减轻服务器压力及解决session共享问题,涵盖配置方法、策略及Java项目应用,并提及分布式事... 目录分布式部署NginxJava中的代理代理分为正向代理和反向代理正向代理反向代理Nginx应用场景

一文解析C#中的StringSplitOptions枚举

《一文解析C#中的StringSplitOptions枚举》StringSplitOptions是C#中的一个枚举类型,用于控制string.Split()方法分割字符串时的行为,核心作用是处理分割后... 目录C#的StringSplitOptions枚举1.StringSplitOptions枚举的常用

C#自动化实现检测并删除PDF文件中的空白页面

《C#自动化实现检测并删除PDF文件中的空白页面》PDF文档在日常工作和生活中扮演着重要的角色,本文将深入探讨如何使用C#编程语言,结合强大的PDF处理库,自动化地检测并删除PDF文件中的空白页面,感... 目录理解PDF空白页的定义与挑战引入Spire.PDF for .NET库核心实现:检测并删除空白页

C#利用Free Spire.XLS for .NET复制Excel工作表

《C#利用FreeSpire.XLSfor.NET复制Excel工作表》在日常的.NET开发中,我们经常需要操作Excel文件,本文将详细介绍C#如何使用FreeSpire.XLSfor.NET... 目录1. 环境准备2. 核心功能3. android示例代码3.1 在同一工作簿内复制工作表3.2 在不同

C#中通过Response.Headers设置自定义参数的代码示例

《C#中通过Response.Headers设置自定义参数的代码示例》:本文主要介绍C#中通过Response.Headers设置自定义响应头的方法,涵盖基础添加、安全校验、生产实践及调试技巧,强... 目录一、基础设置方法1. 直接添加自定义头2. 批量设置模式二、高级配置技巧1. 安全校验机制2. 类型

C#使用iText获取PDF的trailer数据的代码示例

《C#使用iText获取PDF的trailer数据的代码示例》开发程序debug的时候,看到了PDF有个trailer数据,挺有意思,于是考虑用代码把它读出来,那么就用到我们常用的iText框架了,所... 目录引言iText 核心概念C# 代码示例步骤 1: 确保已安装 iText步骤 2: C# 代码程

C#实现高性能拍照与水印添加功能完整方案

《C#实现高性能拍照与水印添加功能完整方案》在工业检测、质量追溯等应用场景中,经常需要对产品进行拍照并添加相关信息水印,本文将详细介绍如何使用C#实现一个高性能的拍照和水印添加功能,包含完整的代码实现... 目录1. 概述2. 功能架构设计3. 核心代码实现python3.1 主拍照方法3.2 安全HBIT

C#实现SHP文件读取与地图显示的完整教程

《C#实现SHP文件读取与地图显示的完整教程》在地理信息系统(GIS)开发中,SHP文件是一种常见的矢量数据格式,本文将详细介绍如何使用C#读取SHP文件并实现地图显示功能,包括坐标转换、图形渲染、平... 目录概述功能特点核心代码解析1. 文件读取与初始化2. 坐标转换3. 图形绘制4. 地图交互功能缩放

linux部署NFS和autofs自动挂载实现过程

《linux部署NFS和autofs自动挂载实现过程》文章介绍了NFS(网络文件系统)和Autofs的原理与配置,NFS通过RPC实现跨系统文件共享,需配置/etc/exports和nfs.conf,... 目录(一)NFS1. 什么是NFS2.NFS守护进程3.RPC服务4. 原理5. 部署5.1安装NF

C#使用SendMessage实现进程间通信的示例代码

《C#使用SendMessage实现进程间通信的示例代码》在软件开发中,进程间通信(IPC)是关键技术之一,C#通过调用WindowsAPI的SendMessage函数实现这一功能,本文将通过实例介绍... 目录第一章:SendMessage的底层原理揭秘第二章:构建跨进程通信桥梁2.1 定义通信协议2.2