Home > Software engineering >  For image Mosaic algorithm
For image Mosaic algorithm

Time:10-10

For example, such as the size of the image size is 1024 x1280 Mosaic of 12 x12, adjacent points average pixel RGB

CodePudding user response:

http://files.cnblogs.com/Imageshop/VB%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86%E6%A8%A1%E6%9D%BF.rar

I Shared before, but this link is not mine,



CodePudding user response:

See for a long time all don't understand, don't know is that part

CodePudding user response:

http://dongtingyueh.blog.163.com/blog/static/461945320127217563098/

CodePudding user response:

Private Declare Function SetPixel Lib "gdi32" (ByVal HDC As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal HDC As Long, ByVal X As Long, ByVal Y As Long) As Long

Dim mark As Boolean
Dim color As Long

Dim r As Integer
Dim g As Integer

Dim As Integer b



Dim starttime As Data
Dim endtime As Data
Dim spendtime As Data


The Public Function of Mosaic (Picture1 As PictureBox)
Dim row As Integer
Dim Lin As Integer
Dim rl As Integer
Dim ll As Integer
Dim xl As Integer
Dim yl As Integer
Dim As Integer k
Dim j As Integer
Dim X As Integer
Dim Y As Integer
Dim color As Long
Dim r As Integer

Dim As Integer b

Row=Int (Picture1. ScaleWidth/10)
Lin=Int (Picture1. ScaleHeight/10)
Rl=Picture1. ScaleWidth Mod 10
Ll=Picture1. ScaleHeight Mod 10

For Y=0 To 10 Step (Lin - 1) * 10
For X=0 To (row 1) Step 10 * 10
Color=GetPixel (Picture1. HDC, X + 5, + 5 Y)
R=256
color ModB=(Int (65536) color/)
G=Int ((color - (b * 65536) - r)/256)
For k=0 To 9
For j=0 To 9
SetPixel Picture1. HDC, X + k, Y + j, RGB (r, g, and b)
Next j
Next k
Picture1. Refresh
Next X

If rl & lt;> 0 Then
Xl=Picture1. ScaleWidth - rl
Color=GetPixel (Picture1. HDC, xl + rl/2, Y + 5)
R=256
color ModB=(Int (65536) color/)
G=Int ((color - (b * 655356) - r)/256)

For k=0 To rl - 1
For j=0 To 9
SetPixel Picture1. HDC, xl + k, Y + j, RGB (r, g, and b)
Next j
Next k
Picture1. Refresh
End the If
Next Y

If ll & lt;> 0 Then
Yl=Picture1. ScaleHeight - ll
For X=0 To (row 1) Step 10 * 10
Color=GetPixel (Picture1. HDC, X + 5, + ll/2 yl)
R=256
color ModB=(Int (65536) color/)
G=Int ((color - (b * 65536) - r)/256)

For k=0 To 9
For j=0 To 1
ll -SetPixel Picture1. HDC, X + k, Y + j, RGB (r, g, and b)
Next j
Next k
Picture1. Refresh
Next X

If rl & lt;> 0 Then
Color=GetPixel (Picture1. HDC, xl + rl/2, + ll/2 yl)
R=256
color ModB=(Int (65536) color/)
G=Int ((color - (b * 65536) - r)/256)

For k=0 To rl - 1
For j=0 To 1
ll -SetPixel Picture1. HDC, X + k, Y + j, RGB (r, g, and b)
Next j
Next k
Picture1. Refresh
End the If
End the If
Endtime=Time
Spendtime=endtime - starttime

End the Function




Private Sub Command3_Click ()
Picture1. AutoRedraw=True
Mosaic Picture1
Picture1. AutoRedraw=False
End Sub



This section of the program where went wrong?




CodePudding user response:

655356? !
  •  Tags:  
  • API
  • Related