新聞中心
請教 兩個關(guān)于 vb.net 的問題
只能回答第一個問題

我們是2013年開創(chuàng)至今的成都網(wǎng)站建設公司,提供網(wǎng)站建設,電商網(wǎng)站設計開發(fā),外貿(mào)網(wǎng)站建設,響應式網(wǎng)頁設計,重慶小程序開發(fā)、等服務。為客戶創(chuàng)造有價值的品牌營銷體驗,讓互聯(lián)網(wǎng)提升企業(yè)的競爭力!
.net里的ComboBox有一個DropDownStyle屬性,可以指定3種樣式之一:
DropDown:通過單擊下箭頭指定顯示列表,并指定文本部分可編輯。
DropDownList:通過單擊下箭頭指定顯示列表,并指定文本部分不可編輯。
Simple:指定列表始終可見,并指定文本部分可編輯。
幾種經(jīng)典的二值化方法及其vb.net實現(xiàn)
圖像二值化的目的是最大限度的將圖象中感興趣的部分保留下來,在很多情況下,也是進行圖像分析、特征提取與模式識別之前的必要的圖像預處理過程。這個看似簡單的問題,在過去的四十年里受到國內(nèi)外學者的廣泛關(guān)注,產(chǎn)生了數(shù)以百計的閾值選取方法,但如同其他圖像分割算法一樣,沒有一個現(xiàn)有方法對各種各樣的圖像都能得到令人滿意的結(jié)果。
本文針對幾種經(jīng)典而常用的二值發(fā)放進行了簡單的討論并給出了其vb.net 實現(xiàn)。
1、P-Tile法
Doyle于1962年提出的P-Tile (即P分位數(shù)法)可以說是最古老的一種閾值選取方法。該方法根據(jù)先驗概率來設定閾值,使得二值化后的目標或背景像素比例等于先驗概率,該方法簡單高效,但是對于先驗概率難于估計的圖像卻無能為力。
2、OTSU 算法(大津法)
OSTU算法可以說是自適應計算單閾值(用來轉(zhuǎn)換灰度圖像為二值圖像)的簡單高效方法。1978 OTSU年提出的最大類間方差法以其計算簡單、穩(wěn)定有效,一直廣為使用。
3、迭代法(最佳閥值法)
(1). 求出圖象的最大灰度值和最小灰度值,分別記為Zl和Zk,令初始閾值為:
(2). 根據(jù)閾值TK將圖象分割為前景和背景,分別求出兩者的平均灰度值Z0和ZB:
式中,Z(i,j)是圖像上(i,j)點的象素值,N(i,j)是(i,j)點的權(quán)值,一般取1。
(3). 若TK=TK+1,則所得即為閾值,否則轉(zhuǎn)2,迭代計算。
4、一維最大熵閾值法
它的思想是統(tǒng)計圖像中每一個灰度級出現(xiàn)的概率 ,計算該灰度級的熵 ,假設以灰度級T分割圖像,圖像中低于T灰度級的像素點構(gòu)成目標物體(O),高于灰度級T的像素點構(gòu)成背景(B),那么各個灰度級在本區(qū)的分布概率為:
O區(qū): i=1,2……,t
B區(qū): i=t+1,t+2……L-1
上式中的 ,這樣對于數(shù)字圖像中的目標和背景區(qū)域的熵分別為:
對圖像中的每一個灰度級分別求取W=H0 +HB,選取使W最大的灰度級作為分割圖像的閾值,這就是一維最大熵閾值圖像分割法。
VB.NET經(jīng)典問題(1)
這個問題看似簡單,實際上包含了三個問題:
1. 5/2 的結(jié)果是 Double 類型
2. dim aa as Integer = 5/2 將 Double 類型隱式轉(zhuǎn)換為 Integer 類型
3. 轉(zhuǎn)換過程將小數(shù)部分 Banker 舍入
因為你這兩個算式小數(shù)部分都是0.5,所以取最近的偶數(shù) aa = 2,bb = 4
vb.net問題
執(zhí)行 dispose 后,由.net 的GC垃圾回收器周期性地回收資源, me.close 方法的基類會調(diào)用 dispose 方法end 是從vb中繼承下來的語句,直接指示退出程序.程序的資源將被釋放,程序并未希望結(jié)束時,不適合使用該方法.若要強行退出應用程序,在.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
網(wǎng)頁名稱:vb.net經(jīng)典問題 vbnet using
本文來源:http://www.dlmjj.cn/article/dojdsji.html


咨詢
建站咨詢
