Tag: 图像处理

使用C#锐化位图

我想在图像上添加锐化滤镜。 我找到了一个简短教程的网站。 我试着在C#中这样做,所以这是我的代码。 无论如何,我试图找出它为什么不起作用。 我不知道我做错了什么,如果是的话,请告诉我该怎么做才能让它按原样运作。 谢谢 public static Bitmap sharpen(Bitmap image) { Bitmap sharpenImage = new Bitmap(image.Width, image.Height); int filterWidth = 3; int filterHeight = 3; int w = image.Width; int h = image.Height; double[,] filter = new double[filterWidth, filterHeight]; filter[0, 0] = filter[0, 1] = filter[0, 2] = filter[1, 0] = filter[1, 2] = […]

如何自动裁剪图像?

我正在尝试制作扫描应用程序。 该应用程序将扫描文档并将图像显示在图片框中。 我面临的问题是图像(保存在扫描仪中的文档图像或说“真实”图像)显示在具有一些背景的另一个图像内(背景颜色也在变化),它看起来像这个图像。 我尝试了很多东西,但没有给我一个完美的结果我用forge.net尝试过。 这是我试过的代码。 public static System.Drawing.Image AforgeAutoCrop(Bitmap selectedImage) { Bitmap autoCropImage = null; try { autoCropImage = selectedImage; // create grayscale filter (BT709) Grayscale filter = new Grayscale(0.2125, 0.7154, 0.0721); Bitmap grayImage = filter.Apply(autoCropImage); // create instance of skew checker DocumentSkewChecker skewChecker = new DocumentSkewChecker(); // get documents skew angle double angle = […]

C# – 将WPF Image.source转换为System.Drawing.Bitmap

我发现有很多人将BitmapSource转换为Bitmap ,但是ImageSource到Bitmap呢? 我正在制作一个成像程序,我需要从Image元素中显示的图像中提取位图。 有谁知道如何做到这一点? 编辑1: 这是将BitmapImage转换为Bitmap 。 请记住在编译器首选项中设置“unsafe”选项。 public static System.Drawing.Bitmap BitmapSourceToBitmap(BitmapSource srs) { System.Drawing.Bitmap btm = null; int width = srs.PixelWidth; int height = srs.PixelHeight; int stride = width * ((srs.Format.BitsPerPixel + 7) / 8); byte[] bits = new byte[height * stride]; srs.CopyPixels(bits, stride, 0); unsafe { fixed (byte* pB = bits) { IntPtr […]

如何在.net中使用imagemagick.net?

我正在寻找几乎一小时的c#中使用imagemagick.net的例子,我找不到反对的东西。 我所需要的只是将图像(.jpg)调整为新尺寸图像(jpg也是如此),如果您知道如何添加水印,那将会非常棒。 我从中下载了imagemagick.net http://imagemagick.codeplex.com/

调整图像的亮度对比度和灰度系数

什么是在.NET中调整图像的亮度对比度和灰度系数的简单方法 将自己发布答案,以便稍后找到它。

在BMP中浏览像素

嗨我有一个bmp加载到BMP对象,我需要通过像素作为上面的图像从(1,1)像素到(100,100) px。 使用getpixel()方法。 我使用的是一个循环,但没有成功。 如果我使用多维数组的概念应该是什么变量值?

加速位图灰度转换,OpenMP是C#中的一个选项吗?

请帮助我使用openmp使这个代码并行这个代码是在按钮点击运行,文本框是128 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace IMG { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string path = “”; public void openimage() { if (openFileDialog1.ShowDialog() == DialogResult.OK) { path = openFileDialog1.FileName; Graphics g = this.CreateGraphics(); g.Clear(this.BackColor); Bitmap curBitmap […]