十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營(yíng)維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
保存前加一句 myImage2.SetResolution(300, 300) 你設(shè)置的bMape不是保存的主畫布 所以無效,設(shè)置分辨率就是 SetResolution(X,Y)
烏審網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)公司!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、自適應(yīng)網(wǎng)站建設(shè)等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營(yíng)維護(hù)。成都創(chuàng)新互聯(lián)公司2013年至今到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選成都創(chuàng)新互聯(lián)公司。
在按鈕的點(diǎn)擊時(shí)間里面,把文本框的值取到,然后通過拼接sql語(yǔ)句的方式,去數(shù)據(jù)庫(kù)查詢,得到結(jié)果集Ds,綁定給DataGridView就行了。
思路如下:
得到圖片文件夾路徑里所有圖片的文件名。
對(duì)這些文件名進(jìn)行判斷,是否包含你所謂的模糊的文字。
當(dāng)判斷發(fā)現(xiàn)包含時(shí),就復(fù)制對(duì)應(yīng)的圖片到你想到的對(duì)應(yīng)的目錄。
Imports?System
Imports?System.Drawing
Imports?System.Drawing.Imaging
Imports?System.Runtime.InteropServices
'''?summary
'''?Summary?description?for?TextShadow
'''?/summary
'''?remarks/remarks
Public?Class?gaoshiBLUR
Public?newbmp?As?Bitmap
StructLayout(LayoutKind.Explicit)?Structure?rgbA
FieldOffset(0)?Public?R?As?Byte
FieldOffset(1)?Public?G?As?Byte
FieldOffset(2)?Public?B?As?Byte
FieldOffset(3)?Public?A?As?Byte
FieldOffset(0)?Public?col?As?Integer
End?Structure
Private?m_radius?As?Integer?=?5
'''?summary
'''?高斯卷積矩陣
'''?/summary
'''?remarks/remarks
Private?gaussMatrix?As?Integer()
'''?summary
'''?卷積核
'''?/summary
'''?remarks/remarks
Private?nuclear?As?Integer?=?0
'''?summary
'''?模糊半徑
'''?/summary
'''?value/value
'''?returns/returns
'''?remarks/remarks
Public?Property?Radius()?As?Integer
Get
Return?m_radius
End?Get
Set(ByVal?Value?As?Integer)
If?(m_radius??Value)?Then
m_radius?=?Value
MakeGaussMatrix()
End?If
End?Set
End?Property
'''?summary
'''?高斯模糊
'''?/summary
'''?param?name="bmp"要處理的圖像/param
'''?remarks/remarks
Public?Sub?MaskShadow(ByVal?bmp?As?Bitmap)
If?nuclear?=?0?Then?MakeGaussMatrix()
Dim?rt?As?Rectangle?=?New?Rectangle(0,?0,?bmp.Width,?bmp.Height)
'?克隆臨時(shí)位圖,作為卷積源
Dim?tmp?As?Bitmap?=?bmp.Clone()
Dim?dest?As?BitmapData?=?bmp.LockBits(rt,?ImageLockMode.WriteOnly,?PixelFormat.Format32bppArgb)
Dim?source?As?BitmapData?=?tmp.LockBits(rt,?ImageLockMode.ReadOnly,?PixelFormat.Format32bppArgb)
Debug.Print(Radius)
Debug.Print(dest.Width.ToString)
Debug.Print(nuclear)
Dim?Number?As?Integer?=?(bmp.Height?*?dest.Stride?-?1)?/?4???'?圖像數(shù)據(jù)元素的個(gè)數(shù),注意.net中數(shù)組下標(biāo)是從0開始的
Dim?bmpdata(Number)?As?Integer
Dim?tmpdata(Number)?As?Integer
Dim?TMPrgb(Number)?As?rgbA?'臨時(shí)參考顏色
Dim?BMPrgb(Number)?As?rgbA?'計(jì)算結(jié)果后的顏色
'ReDim?bmpdata(Number)
'ReDim?TMPrgb(Number)
Marshal.Copy(source.Scan0,?tmpdata,?0,?Number)
Dim?i?As?Long
Dim?j?As?Long
j?=?Number
Dim?w,?h?As?Long
Dim?yi,?xi?As?Long
Dim?iw,?ih,?iiw,?iih,?iii?As?Long
Dim?k?As?Long
Dim?nn?As?Integer?=?(Radius?*?2?+?1)?^?2
Dim?n?As?Integer?=?Radius?*?2?+?1
w?=?bmp.Width
h?=?bmp.Height
'?System.Array.Copy(TMPrgb,?tmpdata,?j)
For?i?=?0?To?j
TMPrgb(i).col?=?tmpdata(i)
Next?i
i?=?0
For?i?=?0?To?j
ih?=?Int(i?/?w)
iw?=?i?-?ih?*?w
Dim?r?As?Double?=?0
Dim?g?As?Double?=?0
Dim?b?As?Double?=?0
Dim?a?As?Double?=?0
Dim?weight?As?Double
For?k?=?0?To?nn
'需要解決的是周邊遍歷顏色值然后相加(r=r1*weight1+r2*weight2+r3*weight3+r4*weight4+r5*weight5+...r*weight)
yi?=?Int(k?/?n)
xi?=?k?-?yi?*?n
yi?-=?Radius
xi?-=?Radius
iiw?=?iw?+?xi
iih?=?ih?+?yi
'yi?=?Int(k?/?n)
'xi?=?k?-?yi?*?n
'iih?=?ih?+?yi?-?Radius
'iiw?=?iw?+?xi?-?Radius
If?(iiw??0?OrElse?iih??0)?Or?(iiw??w?-?1?OrElse?iih??h?-?1)?Then
iiw?=?iw
iih?=?ih
iii?=?i
Else
iii?=?iih?*?w
iii?+=?iiw
End?If
weight?=?gaussMatrix(k)?/?1000
r?+=?TMPrgb(iii).R?*?weight
g?+=?TMPrgb(iii).G?*?weight
b?+=?TMPrgb(iii).B?*?weight
a?+=?TMPrgb(iii).A?*?weight
Next
'TMPrgb(i).col?=?tmpdata(i)
'r?=?TMPrgb(i).R?*?weight
'g?=?TMPrgb(i).G?*?weight
'b?=?TMPrgb(i).B?*?weight
BMPrgb(i).R?=?IIf(r??255,?255,?r)
BMPrgb(i).G?=?IIf(g??255,?255,?g)
BMPrgb(i).B?=?IIf(b??255,?255,?b)
BMPrgb(i).A?=?IIf(a??255,?255,?a)
bmpdata(i)?=?BMPrgb(i).col
'Debug.Print(TMPrgb(i).R)
Next
Marshal.Copy(bmpdata,?0,?dest.Scan0,?Number)
tmp.UnlockBits(source)
bmp.UnlockBits(dest)
newbmp?=?bmp.Clone
tmp.Dispose()
'?End?Try
End?Sub
'''?summary
'''?高斯卷積矩陣
'''?/summary
'''?remarks/remarks
Protected?Sub?MakeGaussMatrix()
Dim?Q?As?Double?=?Radius?/?2
If?(Q?=?0.0)?Then?Q?=?0.1
Dim?n?As?Integer?=?Radius?*?2?+?1
Dim?index?As?Integer?=?0
nuclear?=?0
ReDim?gaussMatrix(n?*?n)
Dim?x?As?Integer
Dim?y?As?Integer
For?x?=?-Radius?To?Radius
For?y?=?-Radius?To?Radius
gaussMatrix(index)?=?Math.Round(Math.Exp(-((x?*?x?+?y?*?y))?/?(2.0?*?Q?*?Q))?/?(2.0?*?Math.PI?*?Q?*?Q)?*?1000.0)
nuclear?+=?gaussMatrix(index)
index?+=?1
Next
Next
End?Sub
End?Class
使用方法.
Dim?bmp?As?Bitmap?=?PictureBox1.Image.Clone
Dim?x?As?New?gaoshiBLUR
x.Radius?=?30
x.MaskShadow(bmp)
PictureBox2.Image?=?x.newbmp.Clone