资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb.net经典问题 vbnet using

请教 两个关于 vb.net 的问题

只能回答第一个问题

我们是2013年开创至今的成都网站建设公司,提供网站建设,电商网站设计开发,外贸网站建设,响应式网页设计,重庆小程序开发、等服务。为客户创造有价值的品牌营销体验,让互联网提升企业的竞争力!

.net里的ComboBox有一个DropDownStyle属性,可以指定3种样式之一:

DropDown:通过单击下箭头指定显示列表,并指定文本部分可编辑。

DropDownList:通过单击下箭头指定显示列表,并指定文本部分不可编辑。

Simple:指定列表始终可见,并指定文本部分可编辑。

几种经典的二值化方法及其vb.net实现

图像二值化的目的是最大限度的将图象中感兴趣的部分保留下来,在很多情况下,也是进行图像分析、特征提取与模式识别之前的必要的图像预处理过程。这个看似简单的问题,在过去的四十年里受到国内外学者的广泛关注,产生了数以百计的阈值选取方法,但如同其他图像分割算法一样,没有一个现有方法对各种各样的图像都能得到令人满意的结果。

本文针对几种经典而常用的二值发放进行了简单的讨论并给出了其vb.net 实现。

1、P-Tile法

Doyle于1962年提出的P-Tile (即P分位数法)可以说是最古老的一种阈值选取方法。该方法根据先验概率来设定阈值,使得二值化后的目标或背景像素比例等于先验概率,该方法简单高效,但是对于先验概率难于估计的图像却无能为力。

2、OTSU 算法(大津法)

OSTU算法可以说是自适应计算单阈值(用来转换灰度图像为二值图像)的简单高效方法。1978 OTSU年提出的最大类间方差法以其计算简单、稳定有效,一直广为使用。

3、迭代法(最佳阀值法)

(1). 求出图象的最大灰度值和最小灰度值,分别记为Zl和Zk,令初始阈值为:

(2). 根据阈值TK将图象分割为前景和背景,分别求出两者的平均灰度值Z0和ZB:

式中,Z(i,j)是图像上(i,j)点的象素值,N(i,j)是(i,j)点的权值,一般取1。

(3). 若TK=TK+1,则所得即为阈值,否则转2,迭代计算。

4、一维最大熵阈值法

它的思想是统计图像中每一个灰度级出现的概率 ,计算该灰度级的熵 ,假设以灰度级T分割图像,图像中低于T灰度级的像素点构成目标物体(O),高于灰度级T的像素点构成背景(B),那么各个灰度级在本区的分布概率为:

O区: i=1,2……,t

B区: i=t+1,t+2……L-1

上式中的 ,这样对于数字图像中的目标和背景区域的熵分别为:

对图像中的每一个灰度级分别求取W=H0 +HB,选取使W最大的灰度级作为分割图像的阈值,这就是一维最大熵阈值图像分割法。

VB.NET经典问题(1)

这个问题看似简单,实际上包含了三个问题:

1. 5/2 的结果是 Double 类型

2. dim aa as Integer = 5/2 将 Double 类型隐式转换为 Integer 类型

3. 转换过程将小数部分 Banker 舍入

因为你这两个算式小数部分都是0.5,所以取最近的偶数 aa = 2,bb = 4

vb.net问题

执行 dispose 后,由.net 的GC垃圾回收器周期性地回收资源, me.close 方法的基类会调用 dispose 方法end 是从vb中继承下来的语句,直接指示退出程序.程序的资源将被释放,程序并未希望结束时,不适合使用该方法.若要强行退出应用程序,在.net中可以使用Environment.Exit(0) 下面是 system.windows.forms.form 类对 close 和 dispose 的封装:'------- ClosePublic Sub Close()

If MyBase.GetState(H40000) Then

Throw New InvalidOperationException(SR.GetString("ClosingWhileCreatingHandle", New Object() { "Close" }))

End If

If MyBase.IsHandleCreated Then

Me.closeReason = CloseReason.UserClosing

MyBase.SendMessage(H10, 0, 0)

Else

MyBase.Dispose

End If

End Sub '------- Dispose Protected Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

Me.CalledOnLoad = False

Me.CalledMakeVisible = False

Me.CalledCreateControl = False

If MyBase.Properties.ContainsObject(Form.PropAcceptButton) Then

MyBase.Properties.SetObject(Form.PropAcceptButton, Nothing)

End If

If MyBase.Properties.ContainsObject(Form.PropCancelButton) Then

MyBase.Properties.SetObject(Form.PropCancelButton, Nothing)

End If

If MyBase.Properties.ContainsObject(Form.PropDefaultButton) Then

MyBase.Properties.SetObject(Form.PropDefaultButton, Nothing)

End If

If MyBase.Properties.ContainsObject(Form.PropActiveMdiChild) Then

MyBase.Properties.SetObject(Form.PropActiveMdiChild, Nothing)

End If

If (Not Me.MdiWindowListStrip Is Nothing) Then

Me.MdiWindowListStrip.Dispose

Me.MdiWindowListStrip = Nothing

End If

If (Not Me.MdiControlStrip Is Nothing) Then

Me.MdiControlStrip.Dispose

Me.MdiControlStrip = Nothing

End If

If (Not Me.MainMenuStrip Is Nothing) Then

Me.MainMenuStrip = Nothing

End If

Dim form As Form = DirectCast(MyBase.Properties.GetObject(Form.PropOwner), Form)

If (Not form Is Nothing) Then

form.RemoveOwnedForm(Me)

MyBase.Properties.SetObject(Form.PropOwner, Nothing)

End If

Dim formArray As Form() = DirectCast(MyBase.Properties.GetObject(Form.PropOwnedForms), Form())

Dim i As Integer = (MyBase.Properties.GetInteger(Form.PropOwnedFormsCount) - 1)

Do While (i = 0)

If (Not formArray(i) Is Nothing) Then

formArray(i).Dispose

End If

i -= 1

Loop

If (Not Me.smallIcon Is Nothing) Then

Me.smallIcon.Dispose

Me.smallIcon = Nothing

End If

Me.ResetSecurityTip(False)

MyBase.Dispose(disposing)

Me.ctlClient = Nothing

Dim menu As MainMenu = Me.Menu

If ((Not menu Is Nothing) AndAlso (menu.ownerForm Is Me)) Then

menu.Dispose

MyBase.Properties.SetObject(Form.PropMainMenu, Nothing)

End If

If (Not MyBase.Properties.GetObject(Form.PropCurMenu) Is Nothing) Then

MyBase.Properties.SetObject(Form.PropCurMenu, Nothing)

End If

Me.MenuChanged(0, Nothing)

Dim menu2 As MainMenu = DirectCast(MyBase.Properties.GetObject(Form.PropDummyMenu), MainMenu)

If (Not menu2 Is Nothing) Then

menu2.Dispose

MyBase.Properties.SetObject(Form.PropDummyMenu, Nothing)

End If

Dim menu3 As MainMenu = DirectCast(MyBase.Properties.GetObject(Form.PropMergedMenu), MainMenu)

If (Not menu3 Is Nothing) Then

If ((menu3.ownerForm Is Me) OrElse (menu3.form Is Nothing)) Then

menu3.Dispose

End If

MyBase.Properties.SetObject(Form.PropMergedMenu, Nothing)

End If

Else

MyBase.Dispose(disposing)

End If

End Sub


网站栏目:vb.net经典问题 vbnet using
文章地址:http://cdkjz.cn/article/dojdsji.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220