欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C# OpenCvSharp實現(xiàn)去除字母后面的雜線

 更新時間:2023年11月16日 15:15:39   作者:天天代碼碼天天  
這篇文章主要為大家詳細介紹了C#如何使用OpenCvSharp實現(xiàn)去除字母后面的雜線效果,文中的示例代碼講解詳細,感興趣的小伙伴可以跟隨小編一起學習一下

效果

項目

代碼

/// <summary>
/// Applies an adaptive threshold to an array.
/// </summary>
/// <param name="src">Source 8-bit single-channel image.</param>
/// <param name="dst">Destination image of the same size and the same type as src .</param>
/// <param name="maxValue">Non-zero value assigned to the pixels for which the condition is satisfied. See the details below.</param>
/// <param name="adaptiveMethod">Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C .</param>
/// <param name="thresholdType">Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV .</param>
/// <param name="blockSize">Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.</param>
/// <param name="c">Constant subtracted from the mean or weighted mean (see the details below). 
/// Normally, it is positive but may be zero or negative as well.</param>
public static void AdaptiveThreshold(InputArray src, OutputArray dst,double maxValue, AdaptiveThresholdTypes adaptiveMethod, ThresholdTypes thresholdType, int blockSize, double c)

using OpenCvSharp;
using System;
using System.Drawing;
using System.Windows.Forms;
 
namespace OpenCvSharp_Demo
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }
 
        string image_path = "";
 
        private void Form1_Load(object sender, EventArgs e)
        {
            image_path = "1.jpg";
            pictureBox1.Image = new Bitmap(image_path);
        }
 
        private void button2_Click(object sender, EventArgs e)
        {
 
            Mat gray = new Mat(image_path, ImreadModes.Grayscale);
 
            Mat binary = new Mat();
 
            Cv2.AdaptiveThreshold(~gray, binary, 255, AdaptiveThresholdTypes.MeanC, ThresholdTypes.Binary, 15, -2);
 
            Mat kernel = Cv2.GetStructuringElement(MorphShapes.Rect, new OpenCvSharp.Size(4, 4), new OpenCvSharp.Point(-1, -1));
 
            //開運算
            Mat dst = new Mat();
            Cv2.MorphologyEx(binary, dst, MorphTypes.Open, kernel);
 
            pictureBox2.Image = new Bitmap(dst.ToMemoryStream());
 
        }
 
    }
}

以上就是C# OpenCvSharp實現(xiàn)去除字母后面的雜線的詳細內(nèi)容,更多關于C# OpenCvSharp去除字母雜線的資料請關注腳本之家其它相關文章!

相關文章

  • Oracle中for循環(huán)的使用方法

    Oracle中for循環(huán)的使用方法

    這篇文章介紹了Oracle中for循環(huán)的使用方法,文中通過示例代碼介紹的非常詳細。對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-08-08
  • winform實現(xiàn)五子棋游戲

    winform實現(xiàn)五子棋游戲

    這篇文章主要為大家詳細介紹了winform實現(xiàn)五子棋游戲,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-01-01
  • vs2005中總是保留最近打開的項目和文件的記錄

    vs2005中總是保留最近打開的項目和文件的記錄

    這篇文章主要介紹了vs2005中總是保留最近打開的項目和文件的記錄,需要的朋友可以參考下
    2016-06-06
  • C#不改變圖像長寬比例調(diào)整圖像大小方式

    C#不改變圖像長寬比例調(diào)整圖像大小方式

    文章介紹了在UI顯示圖片時,當容器大小固定而圖片尺寸大于容器時,可以通過編碼計算長寬來重繪圖像,以確保圖像的長寬比例不變,C#代碼示例展示了如何在Winform前端實現(xiàn)這一功能
    2025-01-01
  • C#在LINQ中使用GroupBy

    C#在LINQ中使用GroupBy

    這篇文章主要介紹了C#在LINQ中如何使用GroupBy,幫助大家更好的理解和學習c#,感興趣的朋友可以了解下
    2020-08-08
  • C#使用Microsoft消息隊列(MSMQ)的示例詳解

    C#使用Microsoft消息隊列(MSMQ)的示例詳解

    Microsoft?Message?Queuing?(MSMQ)?是在多個不同的應用之間實現(xiàn)相互通信的一種異步傳輸模式,本文主要介紹了C#如何使用Microsoft消息隊列,需要的可以了解下
    2024-01-01
  • 一文搞懂c# await,async執(zhí)行流

    一文搞懂c# await,async執(zhí)行流

    這篇文章主要介紹了c# await,async執(zhí)行流的相關知識,文章講解的非常細致,代碼幫助理解和學習,感興趣的朋友可以了解下
    2020-06-06
  • Unity實現(xiàn)簡單虛擬搖桿

    Unity實現(xiàn)簡單虛擬搖桿

    這篇文章主要為大家詳細介紹了Unity實現(xiàn)簡單虛擬搖桿,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2020-04-04
  • C# CSV文件讀寫的實現(xiàn)

    C# CSV文件讀寫的實現(xiàn)

    本文主要介紹了C# CSV文件讀寫的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2023-03-03
  • C#內(nèi)置隊列類Queue用法實例

    C#內(nèi)置隊列類Queue用法實例

    這篇文章主要介紹了C#內(nèi)置隊列類Queue用法,實例分析了C#內(nèi)置隊列的添加、移除等相關技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-04-04

最新評論