C#中的对比度测量 [英] Contrast Measuring in C#

查看:107
本文介绍了C#中的对比度测量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,



我是C-sharp的新手,我正在尝试在数码显微镜上实现自动对焦设置。我计划将相机放在一个小轴上,让相机拍摄几张不同距离的照片。我希望程序选择具有最高对比度的图片(最不模糊的图片)。在研究这个主题时,我发现有几种方法可以做到这一点,例如FFT,相位测量和对比度测量。我想使用对比度测量方法,只选择具有最高对比度的图片,但我找不到任何有关在Visual C#中实现它的信息。有没有人对如何解决这个问题有任何想法?



谢谢,

John K

Greetings,

I am new to C-sharp and I am trying to implement an auto focus setup on a digital microscope. I plan to have the camera on a small axis and have the camera take a couple of pictures at different distances. I would like the program to pick to picture that has the highest contrast(the least blurred picture). While researching this topic I found out there are several ways of doing this such as the FFT, phase measurement, and contrast measurement. I would like to use the contrast measurement method and just pick the picture with the highest contrast but I could not find any information on implementing that in Visual C#. Does anyone have any ideas as to how I could resolve this issue?

Thank you,
John K

推荐答案

首先,忘记 PictureBox 。它与图像完全无关,特别是对其测量。由于这是一个常见的错误,请查看我过去的答案:

如何从旧图纸中清除面板 [ ^ ],

用C#绘制一个矩形 [ ^ ],

在图片框中附上图片 [ ^ ]。



图像是位图,而不是控件。



获取所有信息在你需要使用的图像上 System.Drawing.Bitmap.LockBits

http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.lockbits.aspx [< a href =http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.lockbits.aspxtarget =_ blanktitle =New Window> ^ ]。< br $> b $ b

更好的是,我推荐着名的开源AForge.Net库:

http://en.wikipedia.org/wiki/AForge.NET [ ^ ],

http:/ /www.aforgenet.com/ [ ^ ]。



另见 Andrew Kirillov 撰写的CodeProject文章,作者AForge.Net : http://www.codeproject.com/Articles/Andrew-Kirillov#articles [ ^ ]。



-SA
First of all, forget the PictureBox. It is totally irrelevant to image, and especially to its measurement. As this is a usual mistake, please see my past answers:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^],
Append a picture within picturebox[^].

The image is the bitmap, not the control.

To get all information from an image you need to use System.Drawing.Bitmap.LockBits:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.lockbits.aspx[^].

Better yet, I would recommend well-known open-source AForge.Net library:
http://en.wikipedia.org/wiki/AForge.NET[^],
http://www.aforgenet.com/[^].

See also the CodeProject articles by Andrew Kirillov, the author of AForge.Net: http://www.codeproject.com/Articles/Andrew-Kirillov#articles[^].

—SA


这篇关于C#中的对比度测量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆