Hey, a while back I modified the GetPixel VB.NET component to also grab color information. I was getting good results but now I'm getting totally inaccurate color information. A lot of repeated colors in vertical bands (but not perfect bands), and not accurate to the JPG at all. Can you take a look at the script and see what the problem might be?
Thanks.
Marc
'-----
Sub RunScript(ByVal arrPts As List(Of On3dPoint), ByVal u As Integer, ByVal v As Integer, ByVal strFileName As String)
Dim arrPt(0 To u, 0 To v) As On3dPoint
Dim bm As New Bitmap(strFileName)
Dim lum_list As New List(Of Double)
Dim hue_list As New List(Of Color)
Dim counter As Integer = 0
v = v + 1
'create a multidimensional array from single list
For i As Int32 = 1 To u - 1
For j As Int32 = 1 To v - 1
arrPt(i, j) = arrPts(counter)
counter = counter + 1
Next
Next
' loop to read the pixels
For i As Int32 = 1 To u
For j As Int32 = 1 To v
Dim pix_x As Int32 = Convert.ToInt32(i * (bm.width - 1) / u)
Dim pix_y As Int32 = Convert.ToInt32(j * (bm.height - 1) / v)
Dim col As Color = bm.getPixel(pix_x, pix_y)
hue_list.Add(col)
lum_list.Add(col.GetBrightness())
Next
Next
'output
A = hue_list
arrLum = lum_list
End Sub
Tags: